embulk-input-jira 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a67c13f110c81d075bc30d0b79aa5db339431a43
4
- data.tar.gz: 968ad554324ad49f97be6f10a63dbb762aa5f440
3
+ metadata.gz: 871da4fb82630f92834e2b00784c8e7ccd8b06b6
4
+ data.tar.gz: 96b6ced1eef2d43a1c258b1d985da224506e2b23
5
5
  SHA512:
6
- metadata.gz: 70811ba56c74a396048b42cc84d06198a4c14d020d05b78ef568d6fbe13a9ac6450577e386438aa909e91fab6d9be659bce9bf73e80655aa9c27101cb1cf1ff9
7
- data.tar.gz: a15ceba7b9bda157a4017fd4fa6f4a2a1c08e559328adae2a8d86c069245fed899028ea027cd7cd22f7cc2239011720aeb5abbbcd5f68ab573661b68f0c26604
6
+ metadata.gz: c9aab03ff69b21824422a998039c2f0d17eae69d85b59c3aed382acbeb6b940f2b1152b54eb3218c7f252d1360ca2f2cbd92288d8b412fe1c724999ea3a438a8
7
+ data.tar.gz: e7fd609dc219332b64a9c0a67ffb529b0d65b32b439cce67c506ba986ac2b9cfa26c069e84634a146a9b8afbabb58d962ad2f9ea5b1ac7ddbee70be34a653183
@@ -2,6 +2,8 @@ language: java
2
2
 
3
3
  jdk: oraclejdk8
4
4
 
5
+ dist: trusty
6
+
5
7
  env:
6
8
  global:
7
9
  secure: "NCkU3f60cn5Gmzq+NwDmKdQSq+ApF/rPqSHPirk1+ZPW9n+H9912meUuJr9qyn03MPdc6wAQinsl3skdPNh1Qz02TI/WZGMiCQTLh3nKIMzaaxx6I+OZ1TV7A4MoJMQ7oYQdXdbvRYXpOVRnfVDxpUC+BDk2T8xmjfm9cht+PGTzM6RxpmSL842hiudkcyxHxgEf66EGpi6h2G2PqYNfQrksqiVMWlLiTO5a2ee+iw9qTMhgKrhEKLCb+dFB56gtKIOpd3MxieLwf3PDcsjM+TSaWo6Bp+mjdA3zGJNz5wbWRVSdrIvKvxmf3eRqAGssBhBDO/LUN3LnI+/T/7J9XZZd7WXNudo/t6HQXhJkUIvOucCxSg8/uRsxrMAmF2zkJOnYGSvN3HNqdzyz86TK4/Xckl+gX51b0uYncHfZYSojn4py1RWPYpX/L2RHbzMn1MJ7B3/VZ21vY97aHhDgNyyAMxPnTAuR1IZicEgA8y8AmZkkK9tWq5wvAOKI91V+W8iBEaO2dZIib+KdJSUUj/Q3TM3i4wX9O/AU7tknsnCApvxQeveELJ4SxfFd/Z2imqmQWM0wIgp1u7Vjguf8kSaxcuQHonZNdwvvYOkbYxHvUqltzlmE1qFC/kQe6o9fS3NuiugHCYVeFs+LXVVW+nl0pWztFYMicUmQq7T781w="
@@ -1,3 +1,7 @@
1
+ ## 0.2.9 - 2019-11-17
2
+
3
+ * [enhancement] Remove usage of `ConfigSource#getObjectNode` [#57](https://github.com/treasure-data/embulk-input-jira/pull/57)
4
+
1
5
  ## 0.2.8 - 2019-04-08
2
6
 
3
7
  * [fixed] Process is hang forever when validate task [#56](https://github.com/treasure-data/embulk-input-jira/pull/56)
data/README.md CHANGED
@@ -9,7 +9,7 @@ embulk-input-jira is the Embulk input plugin for [JIRA](https://www.atlassian.co
9
9
 
10
10
  ## Overview
11
11
 
12
- Required Embulk version >= 0.8.7
12
+ Required Embulk version >= 0.9.20
13
13
 
14
14
  * **Plugin type**: input
15
15
  * **Resume supported**: no
@@ -14,21 +14,21 @@ configurations {
14
14
  provided
15
15
  }
16
16
 
17
- version = "0.2.8"
17
+ version = "0.2.9"
18
18
 
19
19
  sourceCompatibility = 1.8
20
20
  targetCompatibility = 1.8
21
21
 
22
22
  dependencies {
23
- compile "org.embulk:embulk-core:0.9.11"
24
- provided "org.embulk:embulk-core:0.9.11"
23
+ compile "org.embulk:embulk-core:0.9.20"
24
+ provided "org.embulk:embulk-core:0.9.20"
25
25
  compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
26
26
  compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.27'
27
27
  compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
28
28
  testCompile "junit:junit:4.+"
29
29
  testCompile "org.mockito:mockito-core:2.+"
30
- testCompile "org.embulk:embulk-test:0.9.11"
31
- testCompile "org.embulk:embulk-core:0.9.11:tests"
30
+ testCompile "org.embulk:embulk-test:0.9.20"
31
+ testCompile "org.embulk:embulk-core:0.9.20:tests"
32
32
  }
33
33
 
34
34
  task classpath(type: Copy, dependsOn: ["jar"]) {
@@ -162,7 +162,7 @@ public class JiraInputPlugin
162
162
  Buffer sample = Buffer.copyOf(createSamples(issues, getUniqueAttributes(issues)).toString().getBytes());
163
163
  JsonNode columns = Exec.getInjector().getInstance(GuessExecutor.class)
164
164
  .guessParserConfig(sample, Exec.newConfigSource(), createGuessConfig())
165
- .getObjectNode().get("columns");
165
+ .get(JsonNode.class, "columns");
166
166
  return Exec.newConfigDiff().set("columns", columns);
167
167
  }
168
168
 
@@ -9,6 +9,7 @@ import org.apache.http.client.methods.HttpGet;
9
9
  import org.apache.http.impl.client.CloseableHttpClient;
10
10
  import org.apache.http.impl.client.HttpClientBuilder;
11
11
  import org.embulk.config.ConfigException;
12
+ import org.embulk.config.ConfigSource;
12
13
  import org.embulk.input.jira.Issue;
13
14
  import org.embulk.input.jira.JiraInputPlugin.PluginTask;
14
15
  import org.embulk.spi.Column;
@@ -37,32 +38,32 @@ public final class JiraUtil
37
38
  {
38
39
  private JiraUtil() {}
39
40
 
40
- public static int calculateTotalPage(int totalCount, int resultPerPage)
41
+ public static int calculateTotalPage(final int totalCount, final int resultPerPage)
41
42
  {
42
43
  return (int) Math.ceil((double) totalCount / resultPerPage);
43
44
  }
44
45
 
45
- public static String buildPermissionUrl(String url)
46
+ public static String buildPermissionUrl(final String url)
46
47
  {
47
48
  return UriBuilder.fromUri(url).path(CREDENTIAL_URI_PATH).build().toString();
48
49
  }
49
50
 
50
- public static String buildSearchUrl(String url)
51
+ public static String buildSearchUrl(final String url)
51
52
  {
52
53
  return UriBuilder.fromUri(url).path(SEARCH_URI_PATH).build().toString();
53
54
  }
54
55
 
55
56
  public static void validateTaskConfig(final PluginTask task)
56
57
  {
57
- String username = task.getUsername();
58
+ final String username = task.getUsername();
58
59
  if (isNullOrEmpty(username)) {
59
60
  throw new ConfigException("Username or email could not be empty");
60
61
  }
61
- String password = task.getPassword();
62
+ final String password = task.getPassword();
62
63
  if (isNullOrEmpty(password)) {
63
64
  throw new ConfigException("Password could not be empty");
64
65
  }
65
- String uri = task.getUri();
66
+ final String uri = task.getUri();
66
67
  if (isNullOrEmpty(uri)) {
67
68
  throw new ConfigException("JIRA API endpoint could not be empty");
68
69
  }
@@ -74,7 +75,7 @@ public final class JiraUtil
74
75
  .setCookieSpec(CookieSpecs.STANDARD)
75
76
  .build())
76
77
  .build()) {
77
- HttpGet request = new HttpGet(uri);
78
+ final HttpGet request = new HttpGet(uri);
78
79
  try (CloseableHttpResponse response = client.execute(request)) {
79
80
  response.getStatusLine().getStatusCode();
80
81
  }
@@ -82,11 +83,11 @@ public final class JiraUtil
82
83
  catch (IOException | IllegalArgumentException e) {
83
84
  throw new ConfigException("JIRA API endpoint is incorrect or not available");
84
85
  }
85
- int retryInitialWaitSec = task.getInitialRetryIntervalMillis();
86
+ final int retryInitialWaitSec = task.getInitialRetryIntervalMillis();
86
87
  if (retryInitialWaitSec < 1) {
87
88
  throw new ConfigException("Initial retry delay should be equal or greater than 1");
88
89
  }
89
- int retryLimit = task.getRetryLimit();
90
+ final int retryLimit = task.getRetryLimit();
90
91
  if (retryLimit < 0 || retryLimit > 10) {
91
92
  throw new ConfigException("Retry limit should between 0 and 10");
92
93
  }
@@ -96,26 +97,25 @@ public final class JiraUtil
96
97
  * For getting the timestamp value of the node
97
98
  * Sometime if the parser could not parse the value then return null
98
99
  * */
99
- private static Timestamp getTimestampValue(PluginTask task, Column column, String value)
100
+ private static Timestamp getTimestampValue(final PluginTask task, final Column column, final String value)
100
101
  {
101
- List<ColumnConfig> columnConfigs = task.getColumns().getColumns();
102
+ final List<ColumnConfig> columnConfigs = task.getColumns().getColumns();
102
103
  String pattern = DEFAULT_TIMESTAMP_PATTERN;
103
- for (ColumnConfig config : columnConfigs) {
104
- if (config.getName().equals(column.getName())
105
- && config.getConfigSource() != null
106
- && config.getConfigSource().getObjectNode() != null
107
- && config.getConfigSource().getObjectNode().get("format") != null
108
- && config.getConfigSource().getObjectNode().get("format").isTextual()) {
109
- pattern = config.getConfigSource().getObjectNode().get("format").asText();
104
+ for (final ColumnConfig columnConfig : columnConfigs) {
105
+ final ConfigSource columnConfigSource = columnConfig.getConfigSource();
106
+ if (columnConfig.getName().equals(column.getName())
107
+ && columnConfigSource != null
108
+ && columnConfigSource.has("format")) {
109
+ pattern = columnConfigSource.get(String.class, "format");
110
110
  break;
111
111
  }
112
112
  }
113
- TimestampParser parser = TimestampParser.of(pattern, "UTC");
113
+ final TimestampParser parser = TimestampParser.of(pattern, "UTC");
114
114
  Timestamp result = null;
115
115
  try {
116
116
  result = parser.parse(value);
117
117
  }
118
- catch (Exception e) {
118
+ catch (final Exception e) {
119
119
  }
120
120
  return result;
121
121
  }
@@ -124,13 +124,13 @@ public final class JiraUtil
124
124
  * For getting the Long value of the node
125
125
  * Sometime if error occurs (i.e a JSON value but user modified it as long) then return null
126
126
  * */
127
- private static Long getLongValue(JsonElement value)
127
+ private static Long getLongValue(final JsonElement value)
128
128
  {
129
129
  Long result = null;
130
130
  try {
131
131
  result = value.getAsLong();
132
132
  }
133
- catch (Exception e) {
133
+ catch (final Exception e) {
134
134
  }
135
135
  return result;
136
136
  }
@@ -139,13 +139,13 @@ public final class JiraUtil
139
139
  * For getting the Double value of the node
140
140
  * Sometime if error occurs (i.e a JSON value but user modified it as double) then return null
141
141
  * */
142
- private static Double getDoubleValue(JsonElement value)
142
+ private static Double getDoubleValue(final JsonElement value)
143
143
  {
144
144
  Double result = null;
145
145
  try {
146
146
  result = value.getAsDouble();
147
147
  }
148
- catch (Exception e) {
148
+ catch (final Exception e) {
149
149
  }
150
150
  return result;
151
151
  }
@@ -154,24 +154,24 @@ public final class JiraUtil
154
154
  * For getting the Boolean value of the node
155
155
  * Sometime if error occurs (i.e a JSON value but user modified it as boolean) then return null
156
156
  * */
157
- private static Boolean getBooleanValue(JsonElement value)
157
+ private static Boolean getBooleanValue(final JsonElement value)
158
158
  {
159
159
  Boolean result = null;
160
160
  try {
161
161
  result = value.getAsBoolean();
162
162
  }
163
- catch (Exception e) {
163
+ catch (final Exception e) {
164
164
  }
165
165
  return result;
166
166
  }
167
167
 
168
- public static void addRecord(Issue issue, Schema schema, PluginTask task, PageBuilder pageBuilder)
168
+ public static void addRecord(final Issue issue, final Schema schema, final PluginTask task, final PageBuilder pageBuilder)
169
169
  {
170
170
  schema.visitColumns(new ColumnVisitor() {
171
171
  @Override
172
- public void jsonColumn(Column column)
172
+ public void jsonColumn(final Column column)
173
173
  {
174
- JsonElement data = issue.getValue(column.getName());
174
+ final JsonElement data = issue.getValue(column.getName());
175
175
  if (data.isJsonNull() || data.isJsonPrimitive()) {
176
176
  pageBuilder.setNull(column);
177
177
  }
@@ -181,9 +181,9 @@ public final class JiraUtil
181
181
  }
182
182
 
183
183
  @Override
184
- public void stringColumn(Column column)
184
+ public void stringColumn(final Column column)
185
185
  {
186
- JsonElement data = issue.getValue(column.getName());
186
+ final JsonElement data = issue.getValue(column.getName());
187
187
  if (data.isJsonNull()) {
188
188
  pageBuilder.setNull(column);
189
189
  }
@@ -208,14 +208,14 @@ public final class JiraUtil
208
208
  }
209
209
 
210
210
  @Override
211
- public void timestampColumn(Column column)
211
+ public void timestampColumn(final Column column)
212
212
  {
213
- JsonElement data = issue.getValue(column.getName());
213
+ final JsonElement data = issue.getValue(column.getName());
214
214
  if (data.isJsonNull() || data.isJsonObject() || data.isJsonArray()) {
215
215
  pageBuilder.setNull(column);
216
216
  }
217
217
  else {
218
- Timestamp value = getTimestampValue(task, column, data.getAsString());
218
+ final Timestamp value = getTimestampValue(task, column, data.getAsString());
219
219
  if (value == null) {
220
220
  pageBuilder.setNull(column);
221
221
  }
@@ -226,9 +226,9 @@ public final class JiraUtil
226
226
  }
227
227
 
228
228
  @Override
229
- public void booleanColumn(Column column)
229
+ public void booleanColumn(final Column column)
230
230
  {
231
- Boolean value = getBooleanValue(issue.getValue(column.getName()));
231
+ final Boolean value = getBooleanValue(issue.getValue(column.getName()));
232
232
  if (value == null) {
233
233
  pageBuilder.setNull(column);
234
234
  }
@@ -238,9 +238,9 @@ public final class JiraUtil
238
238
  }
239
239
 
240
240
  @Override
241
- public void longColumn(Column column)
241
+ public void longColumn(final Column column)
242
242
  {
243
- Long value = getLongValue(issue.getValue(column.getName()));
243
+ final Long value = getLongValue(issue.getValue(column.getName()));
244
244
  if (value == null) {
245
245
  pageBuilder.setNull(column);
246
246
  }
@@ -250,9 +250,9 @@ public final class JiraUtil
250
250
  }
251
251
 
252
252
  @Override
253
- public void doubleColumn(Column column)
253
+ public void doubleColumn(final Column column)
254
254
  {
255
- Double value = getDoubleValue(issue.getValue(column.getName()));
255
+ final Double value = getDoubleValue(issue.getValue(column.getName()));
256
256
  if (value == null) {
257
257
  pageBuilder.setNull(column);
258
258
  }
@@ -19,7 +19,6 @@ import org.embulk.exec.SystemConfigModule;
19
19
  import org.embulk.jruby.JRubyScriptingModule;
20
20
  import org.embulk.plugin.BuiltinPluginSourceModule;
21
21
  import org.embulk.plugin.PluginClassLoaderFactory;
22
- import org.embulk.plugin.PluginClassLoaderModule;
23
22
  import org.embulk.spi.BufferAllocator;
24
23
  import org.embulk.spi.Exec;
25
24
  import org.embulk.spi.ExecAction;
@@ -37,7 +36,7 @@ public class JiraPluginTestRuntime extends GuiceBinder
37
36
  {
38
37
  private static ConfigSource getSystemConfig()
39
38
  {
40
- ObjectNode configNode = JsonNodeFactory.instance.objectNode();
39
+ final ObjectNode configNode = JsonNodeFactory.instance.objectNode();
41
40
  configNode.set("jruby_load_path", JsonNodeFactory.instance.arrayNode().add("lib"));
42
41
 
43
42
  return new DataSourceImpl(new ModelManager(null, new ObjectMapper()), configNode);
@@ -46,27 +45,26 @@ public class JiraPluginTestRuntime extends GuiceBinder
46
45
  public static class TestRuntimeModule implements Module
47
46
  {
48
47
  @Override
49
- public void configure(Binder binder)
48
+ public void configure(final Binder binder)
50
49
  {
51
- ConfigSource systemConfig = getSystemConfig();
50
+ final ConfigSource systemConfig = getSystemConfig();
52
51
  new SystemConfigModule(systemConfig).configure(binder);
53
- new ExecModule().configure(binder);
52
+ new ExecModule(systemConfig).configure(binder);
54
53
  new ExtensionServiceLoaderModule(systemConfig).configure(binder);
55
54
  new BuiltinPluginSourceModule().configure(binder);
56
55
  new JRubyScriptingModule(systemConfig).configure(binder);
57
- new PluginClassLoaderModule(systemConfig).configure(binder);
58
56
  new TestUtilityModule().configure(binder);
59
57
  new TestPluginSourceModule().configure(binder);
60
58
  }
61
59
  }
62
60
 
63
- private ExecSession exec;
61
+ private final ExecSession exec;
64
62
 
65
63
  public JiraPluginTestRuntime()
66
64
  {
67
65
  super(new TestRuntimeModule());
68
- Injector injector = getInjector();
69
- ConfigSource execConfig = new DataSourceImpl(injector.getInstance(ModelManager.class));
66
+ final Injector injector = getInjector();
67
+ final ConfigSource execConfig = new DataSourceImpl(injector.getInstance(ModelManager.class));
70
68
  this.exec = ExecSession.builder(injector).fromExecConfig(execConfig).build();
71
69
  }
72
70
 
@@ -96,10 +94,11 @@ public class JiraPluginTestRuntime extends GuiceBinder
96
94
  }
97
95
 
98
96
  @Override
99
- public Statement apply(Statement base, Description description)
97
+ public Statement apply(final Statement base, final Description description)
100
98
  {
101
99
  final Statement superStatement = JiraPluginTestRuntime.super.apply(base, description);
102
100
  return new Statement() {
101
+ @Override
103
102
  public void evaluate() throws Throwable
104
103
  {
105
104
  try {
@@ -107,13 +106,13 @@ public class JiraPluginTestRuntime extends GuiceBinder
107
106
  try {
108
107
  superStatement.evaluate();
109
108
  }
110
- catch (Throwable ex) {
109
+ catch (final Throwable ex) {
111
110
  throw new RuntimeExecutionException(ex);
112
111
  }
113
112
  return null;
114
113
  });
115
114
  }
116
- catch (RuntimeException ex) {
115
+ catch (final RuntimeException ex) {
117
116
  throw ex.getCause();
118
117
  }
119
118
  finally {
@@ -125,7 +124,7 @@ public class JiraPluginTestRuntime extends GuiceBinder
125
124
 
126
125
  private static class RuntimeExecutionException extends RuntimeException
127
126
  {
128
- public RuntimeExecutionException(Throwable cause)
127
+ public RuntimeExecutionException(final Throwable cause)
129
128
  {
130
129
  super(cause);
131
130
  }
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.8
4
+ version: 0.2.9
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: 2019-04-08 00:00:00.000000000 Z
12
+ date: 2019-11-13 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.8.jar
59
+ - classpath/embulk-input-jira-0.2.9.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