embulk-input-jira 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59b1ced33586839216b5590e44c33f57496af807
|
4
|
+
data.tar.gz: 507c7b27b8a4d5820a1603a9bdf1ef8c0038684f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40ea0eca3da6112d3cf4a571234ea892f6736d695274a503d756cc5f50261f519162ff9beede190688e3e23c7bfb95401006f6bc49d74b30be2e28d8365a6f2d
|
7
|
+
data.tar.gz: 19b48eef1db34c3cd2cb9379b08e000d9c056af2d5f9e1280efba31dd58b6dbf9a6a4b6e69f9a579e92216037c2570b15b240c2878bc036ffea203874b848181
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.2.10 - 2020-03-18
|
2
|
+
|
3
|
+
* [enhancement] Use `java.util.Optional` instead of `com.google.common.base.Optional`, use `LoggerFactory.getLogger` instead of `Exec.getLogger` [#58](https://github.com/treasure-data/embulk-input-jira/pull/58)
|
4
|
+
|
1
5
|
## 0.2.9 - 2019-11-17
|
2
6
|
|
3
7
|
* [enhancement] Remove usage of `ConfigSource#getObjectNode` [#57](https://github.com/treasure-data/embulk-input-jira/pull/57)
|
data/build.gradle
CHANGED
@@ -3,7 +3,6 @@ package org.embulk.input.jira;
|
|
3
3
|
import com.fasterxml.jackson.databind.JsonNode;
|
4
4
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
5
5
|
import com.google.common.annotations.VisibleForTesting;
|
6
|
-
import com.google.common.base.Optional;
|
7
6
|
import com.google.common.collect.ImmutableList;
|
8
7
|
import com.google.gson.JsonArray;
|
9
8
|
import com.google.gson.JsonElement;
|
@@ -29,9 +28,11 @@ import org.embulk.spi.PageOutput;
|
|
29
28
|
import org.embulk.spi.Schema;
|
30
29
|
import org.embulk.spi.SchemaConfig;
|
31
30
|
import org.slf4j.Logger;
|
31
|
+
import org.slf4j.LoggerFactory;
|
32
32
|
|
33
33
|
import java.util.List;
|
34
34
|
import java.util.Map.Entry;
|
35
|
+
import java.util.Optional;
|
35
36
|
import java.util.Set;
|
36
37
|
import java.util.SortedSet;
|
37
38
|
import java.util.TreeSet;
|
@@ -44,7 +45,7 @@ import static org.embulk.input.jira.Constant.PREVIEW_RECORDS_COUNT;
|
|
44
45
|
public class JiraInputPlugin
|
45
46
|
implements InputPlugin
|
46
47
|
{
|
47
|
-
private static final Logger LOGGER =
|
48
|
+
private static final Logger LOGGER = LoggerFactory.getLogger(JiraInputPlugin.class);
|
48
49
|
|
49
50
|
public interface PluginTask
|
50
51
|
extends Task
|
@@ -88,55 +89,55 @@ public class JiraInputPlugin
|
|
88
89
|
}
|
89
90
|
|
90
91
|
@Override
|
91
|
-
public ConfigDiff transaction(ConfigSource config,
|
92
|
-
InputPlugin.Control control)
|
92
|
+
public ConfigDiff transaction(final ConfigSource config,
|
93
|
+
final InputPlugin.Control control)
|
93
94
|
{
|
94
|
-
PluginTask task = config.loadConfig(PluginTask.class);
|
95
|
+
final PluginTask task = config.loadConfig(PluginTask.class);
|
95
96
|
|
96
|
-
Schema schema = task.getColumns().toSchema();
|
97
|
-
int taskCount = 1;
|
97
|
+
final Schema schema = task.getColumns().toSchema();
|
98
|
+
final int taskCount = 1;
|
98
99
|
|
99
100
|
return resume(task.dump(), schema, taskCount, control);
|
100
101
|
}
|
101
102
|
|
102
103
|
@Override
|
103
|
-
public ConfigDiff resume(TaskSource taskSource,
|
104
|
-
Schema schema, int taskCount,
|
105
|
-
InputPlugin.Control control)
|
104
|
+
public ConfigDiff resume(final TaskSource taskSource,
|
105
|
+
final Schema schema, final int taskCount,
|
106
|
+
final InputPlugin.Control control)
|
106
107
|
{
|
107
108
|
control.run(taskSource, schema, taskCount);
|
108
109
|
return Exec.newConfigDiff();
|
109
110
|
}
|
110
111
|
|
111
112
|
@Override
|
112
|
-
public void cleanup(TaskSource taskSource,
|
113
|
-
Schema schema, int taskCount,
|
114
|
-
List<TaskReport> successTaskReports)
|
113
|
+
public void cleanup(final TaskSource taskSource,
|
114
|
+
final Schema schema, final int taskCount,
|
115
|
+
final List<TaskReport> successTaskReports)
|
115
116
|
{
|
116
117
|
}
|
117
118
|
|
118
119
|
@Override
|
119
|
-
public TaskReport run(TaskSource taskSource,
|
120
|
-
Schema schema, int taskIndex,
|
121
|
-
PageOutput output)
|
120
|
+
public TaskReport run(final TaskSource taskSource,
|
121
|
+
final Schema schema, final int taskIndex,
|
122
|
+
final PageOutput output)
|
122
123
|
{
|
123
|
-
PluginTask task = taskSource.loadTask(PluginTask.class);
|
124
|
+
final PluginTask task = taskSource.loadTask(PluginTask.class);
|
124
125
|
JiraUtil.validateTaskConfig(task);
|
125
|
-
JiraClient jiraClient = getJiraClient();
|
126
|
+
final JiraClient jiraClient = getJiraClient();
|
126
127
|
jiraClient.checkUserCredentials(task);
|
127
128
|
try (final PageBuilder pageBuilder = getPageBuilder(schema, output)) {
|
128
129
|
if (isPreview()) {
|
129
|
-
List<Issue> issues = jiraClient.searchIssues(task, 0, PREVIEW_RECORDS_COUNT);
|
130
|
+
final List<Issue> issues = jiraClient.searchIssues(task, 0, PREVIEW_RECORDS_COUNT);
|
130
131
|
issues.forEach(issue -> JiraUtil.addRecord(issue, schema, task, pageBuilder));
|
131
132
|
}
|
132
133
|
else {
|
133
134
|
int currentPage = 0;
|
134
|
-
int totalCount = jiraClient.getTotalCount(task);
|
135
|
-
int totalPage = JiraUtil.calculateTotalPage(totalCount, MAX_RESULTS);
|
135
|
+
final int totalCount = jiraClient.getTotalCount(task);
|
136
|
+
final int totalPage = JiraUtil.calculateTotalPage(totalCount, MAX_RESULTS);
|
136
137
|
LOGGER.info(String.format("Total pages (%d)", totalPage));
|
137
138
|
while (currentPage < totalPage) {
|
138
139
|
LOGGER.info(String.format("Fetching page %d/%d", (currentPage + 1), totalPage));
|
139
|
-
List<Issue> issues = jiraClient.searchIssues(task, (currentPage * MAX_RESULTS), MAX_RESULTS);
|
140
|
+
final List<Issue> issues = jiraClient.searchIssues(task, (currentPage * MAX_RESULTS), MAX_RESULTS);
|
140
141
|
issues.forEach(issue -> JiraUtil.addRecord(issue, schema, task, pageBuilder));
|
141
142
|
currentPage++;
|
142
143
|
}
|
@@ -147,20 +148,20 @@ public class JiraInputPlugin
|
|
147
148
|
}
|
148
149
|
|
149
150
|
@Override
|
150
|
-
public ConfigDiff guess(ConfigSource config)
|
151
|
+
public ConfigDiff guess(final ConfigSource config)
|
151
152
|
{
|
152
153
|
// Reset columns in case already have or missing on configuration
|
153
154
|
config.set("columns", new ObjectMapper().createArrayNode());
|
154
|
-
PluginTask task = config.loadConfig(PluginTask.class);
|
155
|
+
final PluginTask task = config.loadConfig(PluginTask.class);
|
155
156
|
JiraUtil.validateTaskConfig(task);
|
156
|
-
JiraClient jiraClient = getJiraClient();
|
157
|
+
final JiraClient jiraClient = getJiraClient();
|
157
158
|
jiraClient.checkUserCredentials(task);
|
158
|
-
List<Issue> issues = jiraClient.searchIssues(task, 0, GUESS_RECORDS_COUNT);
|
159
|
+
final List<Issue> issues = jiraClient.searchIssues(task, 0, GUESS_RECORDS_COUNT);
|
159
160
|
if (issues.isEmpty()) {
|
160
161
|
throw new ConfigException("Could not guess schema due to empty data set");
|
161
162
|
}
|
162
|
-
Buffer sample = Buffer.copyOf(createSamples(issues, getUniqueAttributes(issues)).toString().getBytes());
|
163
|
-
JsonNode columns = Exec.getInjector().getInstance(GuessExecutor.class)
|
163
|
+
final Buffer sample = Buffer.copyOf(createSamples(issues, getUniqueAttributes(issues)).toString().getBytes());
|
164
|
+
final JsonNode columns = Exec.getInjector().getInstance(GuessExecutor.class)
|
164
165
|
.guessParserConfig(sample, Exec.newConfigSource(), createGuessConfig())
|
165
166
|
.get(JsonNode.class, "columns");
|
166
167
|
return Exec.newConfigDiff().set("columns", columns);
|
@@ -173,24 +174,24 @@ public class JiraInputPlugin
|
|
173
174
|
.set("guess_sample_buffer_bytes", GUESS_BUFFER_SIZE);
|
174
175
|
}
|
175
176
|
|
176
|
-
private SortedSet<String> getUniqueAttributes(List<Issue> issues)
|
177
|
+
private SortedSet<String> getUniqueAttributes(final List<Issue> issues)
|
177
178
|
{
|
178
|
-
SortedSet<String> uniqueAttributes = new TreeSet<>();
|
179
|
-
for (Issue issue : issues) {
|
180
|
-
for (Entry<String, JsonElement> entry : issue.getFlatten().entrySet()) {
|
179
|
+
final SortedSet<String> uniqueAttributes = new TreeSet<>();
|
180
|
+
for (final Issue issue : issues) {
|
181
|
+
for (final Entry<String, JsonElement> entry : issue.getFlatten().entrySet()) {
|
181
182
|
uniqueAttributes.add(entry.getKey());
|
182
183
|
}
|
183
184
|
}
|
184
185
|
return uniqueAttributes;
|
185
186
|
}
|
186
187
|
|
187
|
-
private JsonArray createSamples(List<Issue> issues, Set<String> uniqueAttributes)
|
188
|
+
private JsonArray createSamples(final List<Issue> issues, final Set<String> uniqueAttributes)
|
188
189
|
{
|
189
|
-
JsonArray samples = new JsonArray();
|
190
|
-
for (Issue issue : issues) {
|
191
|
-
JsonObject flatten = issue.getFlatten();
|
192
|
-
JsonObject unified = new JsonObject();
|
193
|
-
for (String key : uniqueAttributes) {
|
190
|
+
final JsonArray samples = new JsonArray();
|
191
|
+
for (final Issue issue : issues) {
|
192
|
+
final JsonObject flatten = issue.getFlatten();
|
193
|
+
final JsonObject unified = new JsonObject();
|
194
|
+
for (final String key : uniqueAttributes) {
|
194
195
|
JsonElement value = flatten.get(key);
|
195
196
|
if (value == null) {
|
196
197
|
value = JsonNull.INSTANCE;
|
@@ -209,7 +210,7 @@ public class JiraInputPlugin
|
|
209
210
|
}
|
210
211
|
|
211
212
|
@VisibleForTesting
|
212
|
-
public PageBuilder getPageBuilder(Schema schema, PageOutput output)
|
213
|
+
public PageBuilder getPageBuilder(final Schema schema, final PageOutput output)
|
213
214
|
{
|
214
215
|
return new PageBuilder(Exec.getBufferAllocator(), schema, output);
|
215
216
|
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
package org.embulk.input.jira.client;
|
2
2
|
|
3
3
|
import com.google.common.annotations.VisibleForTesting;
|
4
|
-
import com.google.common.base.Optional;
|
5
4
|
import com.google.gson.JsonArray;
|
6
5
|
import com.google.gson.JsonElement;
|
7
6
|
import com.google.gson.JsonObject;
|
@@ -24,15 +23,16 @@ import org.embulk.input.jira.Issue;
|
|
24
23
|
import org.embulk.input.jira.JiraInputPlugin.PluginTask;
|
25
24
|
import org.embulk.input.jira.util.JiraException;
|
26
25
|
import org.embulk.input.jira.util.JiraUtil;
|
27
|
-
import org.embulk.spi.Exec;
|
28
26
|
import org.embulk.spi.util.RetryExecutor.RetryGiveupException;
|
29
27
|
import org.embulk.spi.util.RetryExecutor.Retryable;
|
30
28
|
import org.slf4j.Logger;
|
29
|
+
import org.slf4j.LoggerFactory;
|
31
30
|
|
32
31
|
import java.io.IOException;
|
33
32
|
import java.util.ArrayList;
|
34
33
|
import java.util.List;
|
35
34
|
import java.util.Map.Entry;
|
35
|
+
import java.util.Optional;
|
36
36
|
import java.util.Set;
|
37
37
|
import java.util.stream.Collectors;
|
38
38
|
import java.util.stream.StreamSupport;
|
@@ -49,14 +49,14 @@ public class JiraClient
|
|
49
49
|
{
|
50
50
|
public JiraClient() {}
|
51
51
|
|
52
|
-
private static final Logger LOGGER =
|
52
|
+
private static final Logger LOGGER = LoggerFactory.getLogger(JiraClient.class);
|
53
53
|
|
54
54
|
public void checkUserCredentials(final PluginTask task)
|
55
55
|
{
|
56
56
|
try {
|
57
57
|
authorizeAndRequest(task, JiraUtil.buildPermissionUrl(task.getUri()), null);
|
58
58
|
}
|
59
|
-
catch (JiraException e) {
|
59
|
+
catch (final JiraException e) {
|
60
60
|
LOGGER.error(String.format("JIRA return status (%s), reason (%s)", e.getStatusCode(), e.getMessage()));
|
61
61
|
if (e.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
|
62
62
|
throw new ConfigException("Could not authorize with your credential.");
|
@@ -67,18 +67,18 @@ public class JiraClient
|
|
67
67
|
}
|
68
68
|
}
|
69
69
|
|
70
|
-
public List<Issue> searchIssues(final PluginTask task, int startAt, int maxResults)
|
70
|
+
public List<Issue> searchIssues(final PluginTask task, final int startAt, final int maxResults)
|
71
71
|
{
|
72
|
-
String response = searchJiraAPI(task, startAt, maxResults);
|
73
|
-
JsonObject result = new JsonParser().parse(response).getAsJsonObject();
|
72
|
+
final String response = searchJiraAPI(task, startAt, maxResults);
|
73
|
+
final JsonObject result = new JsonParser().parse(response).getAsJsonObject();
|
74
74
|
return StreamSupport.stream(result.get("issues").getAsJsonArray().spliterator(), false)
|
75
75
|
.map(jsonElement -> {
|
76
|
-
JsonObject json = jsonElement.getAsJsonObject();
|
77
|
-
JsonObject fields = json.get("fields").getAsJsonObject();
|
78
|
-
Set<Entry<String, JsonElement>> entries = fields.entrySet();
|
76
|
+
final JsonObject json = jsonElement.getAsJsonObject();
|
77
|
+
final JsonObject fields = json.get("fields").getAsJsonObject();
|
78
|
+
final Set<Entry<String, JsonElement>> entries = fields.entrySet();
|
79
79
|
json.remove("fields");
|
80
80
|
// Merged all properties in fields to the object
|
81
|
-
for (Entry<String, JsonElement> entry : entries) {
|
81
|
+
for (final Entry<String, JsonElement> entry : entries) {
|
82
82
|
json.add(entry.getKey(), entry.getValue());
|
83
83
|
}
|
84
84
|
return new Issue(json);
|
@@ -91,7 +91,7 @@ public class JiraClient
|
|
91
91
|
return new JsonParser().parse(searchJiraAPI(task, 0, MIN_RESULTS)).getAsJsonObject().get("total").getAsInt();
|
92
92
|
}
|
93
93
|
|
94
|
-
private String searchJiraAPI(final PluginTask task, int startAt, int maxResults)
|
94
|
+
private String searchJiraAPI(final PluginTask task, final int startAt, final int maxResults)
|
95
95
|
{
|
96
96
|
try {
|
97
97
|
return retryExecutor().withRetryLimit(task.getRetryLimit())
|
@@ -106,10 +106,10 @@ public class JiraClient
|
|
106
106
|
}
|
107
107
|
|
108
108
|
@Override
|
109
|
-
public boolean isRetryableException(Exception exception)
|
109
|
+
public boolean isRetryableException(final Exception exception)
|
110
110
|
{
|
111
111
|
if (exception instanceof JiraException) {
|
112
|
-
int statusCode = ((JiraException) exception).getStatusCode();
|
112
|
+
final int statusCode = ((JiraException) exception).getStatusCode();
|
113
113
|
// When overloading JIRA APIs (i.e 100 requests per second) the API will return 401 although the credential is correct. So add retry for this
|
114
114
|
// 429 is stand for "Too many requests"
|
115
115
|
// Other 4xx considered errors
|
@@ -119,11 +119,11 @@ public class JiraClient
|
|
119
119
|
}
|
120
120
|
|
121
121
|
@Override
|
122
|
-
public void onRetry(Exception exception, int retryCount, int retryLimit, int retryWait)
|
122
|
+
public void onRetry(final Exception exception, final int retryCount, final int retryLimit, final int retryWait)
|
123
123
|
throws RetryGiveupException
|
124
124
|
{
|
125
125
|
if (exception instanceof JiraException) {
|
126
|
-
String message = String
|
126
|
+
final String message = String
|
127
127
|
.format("Retrying %d/%d after %d seconds. HTTP status code: %s",
|
128
128
|
retryCount, retryLimit,
|
129
129
|
retryWait / 1000,
|
@@ -131,7 +131,7 @@ public class JiraClient
|
|
131
131
|
LOGGER.warn(message);
|
132
132
|
}
|
133
133
|
else {
|
134
|
-
String message = String
|
134
|
+
final String message = String
|
135
135
|
.format("Retrying %d/%d after %d seconds. Message: %s",
|
136
136
|
retryCount, retryLimit,
|
137
137
|
retryWait / 1000,
|
@@ -141,7 +141,7 @@ public class JiraClient
|
|
141
141
|
}
|
142
142
|
|
143
143
|
@Override
|
144
|
-
public void onGiveup(Exception firstException, Exception lastException) throws RetryGiveupException
|
144
|
+
public void onGiveup(final Exception firstException, final Exception lastException) throws RetryGiveupException
|
145
145
|
{
|
146
146
|
LOGGER.warn("Retry Limit Exceeded");
|
147
147
|
}
|
@@ -155,7 +155,7 @@ public class JiraClient
|
|
155
155
|
}
|
156
156
|
}
|
157
157
|
|
158
|
-
private String authorizeAndRequest(final PluginTask task, String url, String body) throws JiraException
|
158
|
+
private String authorizeAndRequest(final PluginTask task, final String url, final String body) throws JiraException
|
159
159
|
{
|
160
160
|
try (CloseableHttpClient client = createHttpClient()) {
|
161
161
|
HttpRequestBase request;
|
@@ -167,28 +167,28 @@ public class JiraClient
|
|
167
167
|
}
|
168
168
|
try (CloseableHttpResponse response = client.execute(request)) {
|
169
169
|
// Check for HTTP response code : 200 : SUCCESS
|
170
|
-
int statusCode = response.getStatusLine().getStatusCode();
|
170
|
+
final int statusCode = response.getStatusLine().getStatusCode();
|
171
171
|
if (statusCode != HttpStatus.SC_OK) {
|
172
172
|
throw new JiraException(statusCode, extractErrorMessages(EntityUtils.toString(response.getEntity())));
|
173
173
|
}
|
174
174
|
return EntityUtils.toString(response.getEntity());
|
175
175
|
}
|
176
176
|
}
|
177
|
-
catch (IOException e) {
|
177
|
+
catch (final IOException e) {
|
178
178
|
throw new JiraException(-1, e.getMessage());
|
179
179
|
}
|
180
180
|
}
|
181
181
|
|
182
|
-
private String extractErrorMessages(String errorResponse)
|
182
|
+
private String extractErrorMessages(final String errorResponse)
|
183
183
|
{
|
184
|
-
List<String> messages = new ArrayList<>();
|
184
|
+
final List<String> messages = new ArrayList<>();
|
185
185
|
try {
|
186
|
-
JsonObject errorObject = new JsonParser().parse(errorResponse).getAsJsonObject();
|
187
|
-
for (JsonElement element : errorObject.get("errorMessages").getAsJsonArray()) {
|
186
|
+
final JsonObject errorObject = new JsonParser().parse(errorResponse).getAsJsonObject();
|
187
|
+
for (final JsonElement element : errorObject.get("errorMessages").getAsJsonArray()) {
|
188
188
|
messages.add(element.getAsString());
|
189
189
|
}
|
190
190
|
}
|
191
|
-
catch (Exception e) {
|
191
|
+
catch (final Exception e) {
|
192
192
|
messages.add(errorResponse);
|
193
193
|
}
|
194
194
|
return String.join(" , ", messages);
|
@@ -207,9 +207,9 @@ public class JiraClient
|
|
207
207
|
.build();
|
208
208
|
}
|
209
209
|
|
210
|
-
private HttpRequestBase createPostRequest(PluginTask task, String url, String body) throws IOException
|
210
|
+
private HttpRequestBase createPostRequest(final PluginTask task, final String url, final String body) throws IOException
|
211
211
|
{
|
212
|
-
HttpPost request = new HttpPost(url);
|
212
|
+
final HttpPost request = new HttpPost(url);
|
213
213
|
switch (task.getAuthMethod()) {
|
214
214
|
default:
|
215
215
|
request.setHeader(
|
@@ -226,9 +226,9 @@ public class JiraClient
|
|
226
226
|
return request;
|
227
227
|
}
|
228
228
|
|
229
|
-
private HttpRequestBase createGetRequest(PluginTask task, String url)
|
229
|
+
private HttpRequestBase createGetRequest(final PluginTask task, final String url)
|
230
230
|
{
|
231
|
-
HttpGet request = new HttpGet(url);
|
231
|
+
final HttpGet request = new HttpGet(url);
|
232
232
|
switch (task.getAuthMethod()) {
|
233
233
|
default:
|
234
234
|
request.setHeader(
|
@@ -244,14 +244,14 @@ public class JiraClient
|
|
244
244
|
return request;
|
245
245
|
}
|
246
246
|
|
247
|
-
private String createSearchIssuesBody(PluginTask task, int startAt, int maxResults)
|
247
|
+
private String createSearchIssuesBody(final PluginTask task, final int startAt, final int maxResults)
|
248
248
|
{
|
249
|
-
JsonObject body = new JsonObject();
|
250
|
-
Optional<String> jql = task.getJQL();
|
251
|
-
body.add("jql", new JsonPrimitive(jql.
|
249
|
+
final JsonObject body = new JsonObject();
|
250
|
+
final Optional<String> jql = task.getJQL();
|
251
|
+
body.add("jql", new JsonPrimitive(jql.orElse("")));
|
252
252
|
body.add("startAt", new JsonPrimitive(startAt));
|
253
253
|
body.add("maxResults", new JsonPrimitive(maxResults));
|
254
|
-
JsonArray fields = new JsonArray();
|
254
|
+
final JsonArray fields = new JsonArray();
|
255
255
|
fields.add("*all");
|
256
256
|
body.add("fields", fields);
|
257
257
|
return body.toString();
|
@@ -2,7 +2,7 @@ package org.embulk.input.jira;
|
|
2
2
|
|
3
3
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
4
4
|
import com.fasterxml.jackson.datatype.guava.GuavaModule;
|
5
|
-
import com.fasterxml.jackson.datatype.
|
5
|
+
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
|
6
6
|
import com.google.common.io.Resources;
|
7
7
|
import com.google.gson.JsonObject;
|
8
8
|
import com.google.gson.JsonParser;
|
@@ -20,22 +20,22 @@ public final class TestHelpers
|
|
20
20
|
{
|
21
21
|
private TestHelpers() {}
|
22
22
|
|
23
|
-
public static JsonObject getJsonFromFile(String fileName) throws IOException
|
23
|
+
public static JsonObject getJsonFromFile(final String fileName) throws IOException
|
24
24
|
{
|
25
|
-
String path = Resources.getResource(fileName).getPath();
|
25
|
+
final String path = Resources.getResource(fileName).getPath();
|
26
26
|
try (JsonReader reader = new JsonReader(new FileReader(path))) {
|
27
|
-
JsonParser parser = new JsonParser();
|
27
|
+
final JsonParser parser = new JsonParser();
|
28
28
|
return parser.parse(reader).getAsJsonObject();
|
29
29
|
}
|
30
30
|
}
|
31
31
|
|
32
32
|
public static ConfigSource config() throws IOException
|
33
33
|
{
|
34
|
-
String path = Resources.getResource("config.yml").getPath();
|
35
|
-
ObjectMapper mapper = new ObjectMapper()
|
34
|
+
final String path = Resources.getResource("config.yml").getPath();
|
35
|
+
final ObjectMapper mapper = new ObjectMapper()
|
36
36
|
.registerModule(new GuavaModule())
|
37
|
-
.registerModule(new
|
38
|
-
ConfigLoader configLoader = new ConfigLoader(new ModelManager(null, mapper));
|
37
|
+
.registerModule(new Jdk8Module());
|
38
|
+
final ConfigLoader configLoader = new ConfigLoader(new ModelManager(null, mapper));
|
39
39
|
return configLoader.fromYamlFile(new File(path));
|
40
40
|
}
|
41
41
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-jira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- uu59
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,7 +56,7 @@ files:
|
|
56
56
|
- build.gradle
|
57
57
|
- classpath/commons-codec-1.10.jar
|
58
58
|
- classpath/commons-logging-1.2.jar
|
59
|
-
- classpath/embulk-input-jira-0.2.
|
59
|
+
- classpath/embulk-input-jira-0.2.10.jar
|
60
60
|
- classpath/gson-2.8.5.jar
|
61
61
|
- classpath/httpclient-4.5.6.jar
|
62
62
|
- classpath/httpcore-4.4.10.jar
|