embulk-input-jira 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/build.gradle +1 -5
- data/src/main/java/org/embulk/input/jira/Constant.java +1 -0
- data/src/main/java/org/embulk/input/jira/client/JiraClient.java +21 -18
- data/src/main/java/org/embulk/input/jira/util/JiraUtil.java +20 -14
- data/src/test/java/org/embulk/input/jira/JiraInputPluginTest.java +4 -4
- data/src/test/java/org/embulk/input/jira/client/JiraClientTest.java +5 -5
- data/src/test/java/org/embulk/input/jira/util/JiraUtilTest.java +117 -119
- metadata +3 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a67c13f110c81d075bc30d0b79aa5db339431a43
|
4
|
+
data.tar.gz: 968ad554324ad49f97be6f10a63dbb762aa5f440
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70811ba56c74a396048b42cc84d06198a4c14d020d05b78ef568d6fbe13a9ac6450577e386438aa909e91fab6d9be659bce9bf73e80655aa9c27101cb1cf1ff9
|
7
|
+
data.tar.gz: a15ceba7b9bda157a4017fd4fa6f4a2a1c08e559328adae2a8d86c069245fed899028ea027cd7cd22f7cc2239011720aeb5abbbcd5f68ab573661b68f0c26604
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.2.8 - 2019-04-08
|
2
|
+
|
3
|
+
* [fixed] Process is hang forever when validate task [#56](https://github.com/treasure-data/embulk-input-jira/pull/56)
|
4
|
+
|
1
5
|
## 0.2.7 - 2019-03-05
|
2
6
|
|
3
7
|
* [enhancement] Support empty JQL [#55](https://github.com/treasure-data/embulk-input-jira/pull/55)
|
data/build.gradle
CHANGED
@@ -9,15 +9,12 @@ import com.github.jrubygradle.JRubyExec
|
|
9
9
|
repositories {
|
10
10
|
mavenCentral()
|
11
11
|
jcenter()
|
12
|
-
maven {
|
13
|
-
url "https://dl.bintray.com/embulk-base-restclient/maven"
|
14
|
-
}
|
15
12
|
}
|
16
13
|
configurations {
|
17
14
|
provided
|
18
15
|
}
|
19
16
|
|
20
|
-
version = "0.2.
|
17
|
+
version = "0.2.8"
|
21
18
|
|
22
19
|
sourceCompatibility = 1.8
|
23
20
|
targetCompatibility = 1.8
|
@@ -25,7 +22,6 @@ targetCompatibility = 1.8
|
|
25
22
|
dependencies {
|
26
23
|
compile "org.embulk:embulk-core:0.9.11"
|
27
24
|
provided "org.embulk:embulk-core:0.9.11"
|
28
|
-
compile "org.embulk.base.restclient:embulk-util-retryhelper-jetty92:0.6.0"
|
29
25
|
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
|
30
26
|
compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.27'
|
31
27
|
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
|
@@ -7,6 +7,7 @@ public final class Constant
|
|
7
7
|
public static final int GUESS_RECORDS_COUNT = 50;
|
8
8
|
public static final int PREVIEW_RECORDS_COUNT = 10;
|
9
9
|
public static final int GUESS_BUFFER_SIZE = 5 * 1024 * 1024;
|
10
|
+
public static final int HTTP_TIMEOUT = 300 * 1000;
|
10
11
|
|
11
12
|
public static final String DEFAULT_TIMESTAMP_PATTERN = "%Y-%m-%dT%H:%M:%S.%L%z";
|
12
13
|
|
@@ -8,14 +8,15 @@ import com.google.gson.JsonObject;
|
|
8
8
|
import com.google.gson.JsonParser;
|
9
9
|
import com.google.gson.JsonPrimitive;
|
10
10
|
|
11
|
-
import org.apache.http.HttpResponse;
|
12
11
|
import org.apache.http.HttpStatus;
|
13
|
-
import org.apache.http.client.
|
12
|
+
import org.apache.http.client.config.CookieSpecs;
|
14
13
|
import org.apache.http.client.config.RequestConfig;
|
14
|
+
import org.apache.http.client.methods.CloseableHttpResponse;
|
15
15
|
import org.apache.http.client.methods.HttpGet;
|
16
16
|
import org.apache.http.client.methods.HttpPost;
|
17
17
|
import org.apache.http.client.methods.HttpRequestBase;
|
18
18
|
import org.apache.http.entity.StringEntity;
|
19
|
+
import org.apache.http.impl.client.CloseableHttpClient;
|
19
20
|
import org.apache.http.impl.client.HttpClientBuilder;
|
20
21
|
import org.apache.http.util.EntityUtils;
|
21
22
|
import org.embulk.config.ConfigException;
|
@@ -40,6 +41,7 @@ import static java.util.Base64.getEncoder;
|
|
40
41
|
import static org.apache.http.HttpHeaders.ACCEPT;
|
41
42
|
import static org.apache.http.HttpHeaders.AUTHORIZATION;
|
42
43
|
import static org.apache.http.HttpHeaders.CONTENT_TYPE;
|
44
|
+
import static org.embulk.input.jira.Constant.HTTP_TIMEOUT;
|
43
45
|
import static org.embulk.input.jira.Constant.MIN_RESULTS;
|
44
46
|
import static org.embulk.spi.util.RetryExecutor.retryExecutor;
|
45
47
|
|
@@ -47,8 +49,6 @@ public class JiraClient
|
|
47
49
|
{
|
48
50
|
public JiraClient() {}
|
49
51
|
|
50
|
-
private static final int CONNECTION_TIME_OUT = 300000;
|
51
|
-
|
52
52
|
private static final Logger LOGGER = Exec.getLogger(JiraClient.class);
|
53
53
|
|
54
54
|
public void checkUserCredentials(final PluginTask task)
|
@@ -157,8 +157,7 @@ public class JiraClient
|
|
157
157
|
|
158
158
|
private String authorizeAndRequest(final PluginTask task, String url, String body) throws JiraException
|
159
159
|
{
|
160
|
-
try {
|
161
|
-
HttpClient client = createHttpClient();
|
160
|
+
try (CloseableHttpClient client = createHttpClient()) {
|
162
161
|
HttpRequestBase request;
|
163
162
|
if (body == null) {
|
164
163
|
request = createGetRequest(task, url);
|
@@ -166,13 +165,14 @@ public class JiraClient
|
|
166
165
|
else {
|
167
166
|
request = createPostRequest(task, url, body);
|
168
167
|
}
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
168
|
+
try (CloseableHttpResponse response = client.execute(request)) {
|
169
|
+
// Check for HTTP response code : 200 : SUCCESS
|
170
|
+
int statusCode = response.getStatusLine().getStatusCode();
|
171
|
+
if (statusCode != HttpStatus.SC_OK) {
|
172
|
+
throw new JiraException(statusCode, extractErrorMessages(EntityUtils.toString(response.getEntity())));
|
173
|
+
}
|
174
|
+
return EntityUtils.toString(response.getEntity());
|
174
175
|
}
|
175
|
-
return EntityUtils.toString(response.getEntity());
|
176
176
|
}
|
177
177
|
catch (IOException e) {
|
178
178
|
throw new JiraException(-1, e.getMessage());
|
@@ -195,13 +195,16 @@ public class JiraClient
|
|
195
195
|
}
|
196
196
|
|
197
197
|
@VisibleForTesting
|
198
|
-
public
|
198
|
+
public CloseableHttpClient createHttpClient()
|
199
199
|
{
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
200
|
+
return HttpClientBuilder.create()
|
201
|
+
.setDefaultRequestConfig(RequestConfig.custom()
|
202
|
+
.setConnectTimeout(HTTP_TIMEOUT)
|
203
|
+
.setConnectionRequestTimeout(HTTP_TIMEOUT)
|
204
|
+
.setSocketTimeout(HTTP_TIMEOUT)
|
205
|
+
.setCookieSpec(CookieSpecs.STANDARD)
|
206
|
+
.build())
|
207
|
+
.build();
|
205
208
|
}
|
206
209
|
|
207
210
|
private HttpRequestBase createPostRequest(PluginTask task, String url, String body) throws IOException
|
@@ -2,6 +2,12 @@ package org.embulk.input.jira.util;
|
|
2
2
|
|
3
3
|
import com.google.gson.JsonElement;
|
4
4
|
|
5
|
+
import org.apache.http.client.config.CookieSpecs;
|
6
|
+
import org.apache.http.client.config.RequestConfig;
|
7
|
+
import org.apache.http.client.methods.CloseableHttpResponse;
|
8
|
+
import org.apache.http.client.methods.HttpGet;
|
9
|
+
import org.apache.http.impl.client.CloseableHttpClient;
|
10
|
+
import org.apache.http.impl.client.HttpClientBuilder;
|
5
11
|
import org.embulk.config.ConfigException;
|
6
12
|
import org.embulk.input.jira.Issue;
|
7
13
|
import org.embulk.input.jira.JiraInputPlugin.PluginTask;
|
@@ -17,8 +23,6 @@ import org.embulk.spi.time.TimestampParser;
|
|
17
23
|
import javax.ws.rs.core.UriBuilder;
|
18
24
|
|
19
25
|
import java.io.IOException;
|
20
|
-
import java.net.HttpURLConnection;
|
21
|
-
import java.net.URL;
|
22
26
|
import java.util.List;
|
23
27
|
import java.util.stream.Collectors;
|
24
28
|
import java.util.stream.StreamSupport;
|
@@ -26,6 +30,7 @@ import java.util.stream.StreamSupport;
|
|
26
30
|
import static com.google.common.base.Strings.isNullOrEmpty;
|
27
31
|
import static org.embulk.input.jira.Constant.CREDENTIAL_URI_PATH;
|
28
32
|
import static org.embulk.input.jira.Constant.DEFAULT_TIMESTAMP_PATTERN;
|
33
|
+
import static org.embulk.input.jira.Constant.HTTP_TIMEOUT;
|
29
34
|
import static org.embulk.input.jira.Constant.SEARCH_URI_PATH;
|
30
35
|
|
31
36
|
public final class JiraUtil
|
@@ -61,21 +66,22 @@ public final class JiraUtil
|
|
61
66
|
if (isNullOrEmpty(uri)) {
|
62
67
|
throw new ConfigException("JIRA API endpoint could not be empty");
|
63
68
|
}
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
69
|
+
try (CloseableHttpClient client = HttpClientBuilder.create()
|
70
|
+
.setDefaultRequestConfig(RequestConfig.custom()
|
71
|
+
.setConnectTimeout(HTTP_TIMEOUT)
|
72
|
+
.setConnectionRequestTimeout(HTTP_TIMEOUT)
|
73
|
+
.setSocketTimeout(HTTP_TIMEOUT)
|
74
|
+
.setCookieSpec(CookieSpecs.STANDARD)
|
75
|
+
.build())
|
76
|
+
.build()) {
|
77
|
+
HttpGet request = new HttpGet(uri);
|
78
|
+
try (CloseableHttpResponse response = client.execute(request)) {
|
79
|
+
response.getStatusLine().getStatusCode();
|
80
|
+
}
|
70
81
|
}
|
71
|
-
catch (IOException e) {
|
82
|
+
catch (IOException | IllegalArgumentException e) {
|
72
83
|
throw new ConfigException("JIRA API endpoint is incorrect or not available");
|
73
84
|
}
|
74
|
-
finally {
|
75
|
-
if (connection != null) {
|
76
|
-
connection.disconnect();
|
77
|
-
}
|
78
|
-
}
|
79
85
|
int retryInitialWaitSec = task.getInitialRetryIntervalMillis();
|
80
86
|
if (retryInitialWaitSec < 1) {
|
81
87
|
throw new ConfigException("Initial retry delay should be equal or greater than 1");
|
@@ -3,11 +3,11 @@ package org.embulk.input.jira;
|
|
3
3
|
import com.google.gson.JsonElement;
|
4
4
|
import com.google.gson.JsonObject;
|
5
5
|
import com.google.gson.JsonParser;
|
6
|
-
import org.apache.http.HttpResponse;
|
7
6
|
import org.apache.http.StatusLine;
|
8
|
-
import org.apache.http.client.
|
7
|
+
import org.apache.http.client.methods.CloseableHttpResponse;
|
9
8
|
import org.apache.http.client.methods.HttpUriRequest;
|
10
9
|
import org.apache.http.entity.StringEntity;
|
10
|
+
import org.apache.http.impl.client.CloseableHttpClient;
|
11
11
|
import org.embulk.config.ConfigDiff;
|
12
12
|
import org.embulk.config.ConfigSource;
|
13
13
|
import org.embulk.config.TaskReport;
|
@@ -42,8 +42,8 @@ public class JiraInputPluginTest
|
|
42
42
|
private JiraClient jiraClient;
|
43
43
|
private JsonObject data;
|
44
44
|
private ConfigSource config;
|
45
|
-
private
|
46
|
-
private
|
45
|
+
private CloseableHttpClient client = Mockito.mock(CloseableHttpClient.class);
|
46
|
+
private CloseableHttpResponse response = Mockito.mock(CloseableHttpResponse.class);
|
47
47
|
private StatusLine statusLine = Mockito.mock(StatusLine.class);
|
48
48
|
|
49
49
|
private MockPageOutput output = new MockPageOutput();
|
@@ -2,10 +2,10 @@ package org.embulk.input.jira.client;
|
|
2
2
|
|
3
3
|
import com.google.gson.JsonObject;
|
4
4
|
|
5
|
-
import org.apache.http.HttpResponse;
|
6
5
|
import org.apache.http.StatusLine;
|
7
|
-
import org.apache.http.client.
|
6
|
+
import org.apache.http.client.methods.CloseableHttpResponse;
|
8
7
|
import org.apache.http.entity.StringEntity;
|
8
|
+
import org.apache.http.impl.client.CloseableHttpClient;
|
9
9
|
import org.embulk.EmbulkTestRuntime;
|
10
10
|
import org.embulk.config.ConfigException;
|
11
11
|
import org.embulk.config.ConfigSource;
|
@@ -34,8 +34,8 @@ public class JiraClientTest
|
|
34
34
|
private JiraClient jiraClient;
|
35
35
|
private PluginTask task;
|
36
36
|
|
37
|
-
private
|
38
|
-
private
|
37
|
+
private CloseableHttpClient client = Mockito.mock(CloseableHttpClient.class);
|
38
|
+
private CloseableHttpResponse response = Mockito.mock(CloseableHttpResponse.class);
|
39
39
|
private StatusLine statusLine = Mockito.mock(StatusLine.class);
|
40
40
|
private JsonObject data;
|
41
41
|
|
@@ -44,7 +44,7 @@ public class JiraClientTest
|
|
44
44
|
{
|
45
45
|
if (jiraClient == null) {
|
46
46
|
jiraClient = Mockito.spy(new JiraClient());
|
47
|
-
response = Mockito.mock(
|
47
|
+
response = Mockito.mock(CloseableHttpResponse.class);
|
48
48
|
task = TestHelpers.config().loadConfig(PluginTask.class);
|
49
49
|
data = TestHelpers.getJsonFromFile("jira_client.json");
|
50
50
|
}
|
@@ -21,9 +21,7 @@ import org.msgpack.value.Value;
|
|
21
21
|
import java.io.IOException;
|
22
22
|
|
23
23
|
import static org.junit.Assert.assertEquals;
|
24
|
-
import static org.junit.Assert.
|
25
|
-
import static org.junit.Assert.assertNull;
|
26
|
-
import static org.junit.Assert.assertTrue;
|
24
|
+
import static org.junit.Assert.assertThrows;
|
27
25
|
import static org.mockito.Mockito.times;
|
28
26
|
import static org.mockito.Mockito.verify;
|
29
27
|
|
@@ -111,148 +109,148 @@ public class JiraUtilTest
|
|
111
109
|
}
|
112
110
|
|
113
111
|
@Test
|
114
|
-
public void
|
112
|
+
public void test_validateTaskConfig_allValid() throws IOException
|
115
113
|
{
|
116
|
-
// Happy case
|
117
114
|
ConfigSource configSource = TestHelpers.config();
|
118
115
|
PluginTask task = configSource.loadConfig(PluginTask.class);
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
configSource = TestHelpers.config();
|
130
|
-
configSource.set("username", "");
|
131
|
-
task = configSource.loadConfig(PluginTask.class);
|
132
|
-
exception = null;
|
133
|
-
try {
|
116
|
+
JiraUtil.validateTaskConfig(task);
|
117
|
+
}
|
118
|
+
|
119
|
+
@Test
|
120
|
+
public void test_validateTaskConfig_emptyUsername() throws IOException
|
121
|
+
{
|
122
|
+
ConfigException exception = assertThrows("Username or email could not be empty", ConfigException.class, () -> {
|
123
|
+
ConfigSource configSource = TestHelpers.config();
|
124
|
+
configSource.set("username", "");
|
125
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
134
126
|
JiraUtil.validateTaskConfig(task);
|
135
|
-
}
|
136
|
-
catch (Exception e) {
|
137
|
-
exception = e;
|
138
|
-
}
|
139
|
-
assertNotNull(exception);
|
140
|
-
assertTrue(exception instanceof ConfigException);
|
127
|
+
});
|
141
128
|
assertEquals("Username or email could not be empty", exception.getMessage());
|
129
|
+
}
|
142
130
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
131
|
+
@Test
|
132
|
+
public void test_validateTaskConfig_emptyPassword() throws IOException
|
133
|
+
{
|
134
|
+
ConfigException exception = assertThrows(ConfigException.class, () -> {
|
135
|
+
ConfigSource configSource = TestHelpers.config();
|
136
|
+
configSource.set("password", "");
|
137
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
149
138
|
JiraUtil.validateTaskConfig(task);
|
150
|
-
}
|
151
|
-
catch (Exception e) {
|
152
|
-
exception = e;
|
153
|
-
}
|
154
|
-
assertNotNull(exception);
|
155
|
-
assertTrue(exception instanceof ConfigException);
|
139
|
+
});
|
156
140
|
assertEquals("Password could not be empty", exception.getMessage());
|
141
|
+
}
|
157
142
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
143
|
+
@Test
|
144
|
+
public void test_validateTaskConfig_emptyUri() throws IOException
|
145
|
+
{
|
146
|
+
ConfigException exception = assertThrows(ConfigException.class, () -> {
|
147
|
+
ConfigSource configSource = TestHelpers.config();
|
148
|
+
configSource.set("uri", "");
|
149
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
164
150
|
JiraUtil.validateTaskConfig(task);
|
165
|
-
}
|
166
|
-
catch (Exception e) {
|
167
|
-
exception = e;
|
168
|
-
}
|
169
|
-
assertNotNull(exception);
|
170
|
-
assertTrue(exception instanceof ConfigException);
|
151
|
+
});
|
171
152
|
assertEquals("JIRA API endpoint could not be empty", exception.getMessage());
|
153
|
+
}
|
154
|
+
|
155
|
+
@Test
|
156
|
+
public void test_validateTaskConfig_nonExistedUri() throws IOException
|
157
|
+
{
|
158
|
+
ConfigException exception = assertThrows(ConfigException.class, () -> {
|
159
|
+
ConfigSource configSource = TestHelpers.config();
|
160
|
+
configSource.set("uri", "https://not-existed-domain");
|
161
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
162
|
+
JiraUtil.validateTaskConfig(task);
|
163
|
+
});
|
164
|
+
assertEquals("JIRA API endpoint is incorrect or not available", exception.getMessage());
|
165
|
+
}
|
172
166
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
167
|
+
@Test
|
168
|
+
public void test_validateTaskConfig_invalidUriProtocol() throws IOException
|
169
|
+
{
|
170
|
+
ConfigException exception = assertThrows(ConfigException.class, () -> {
|
171
|
+
ConfigSource configSource = TestHelpers.config();
|
172
|
+
configSource.set("uri", "ftp://example.com");
|
173
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
179
174
|
JiraUtil.validateTaskConfig(task);
|
180
|
-
}
|
181
|
-
catch (Exception e) {
|
182
|
-
exception = e;
|
183
|
-
}
|
184
|
-
assertNotNull(exception);
|
185
|
-
assertTrue(exception instanceof ConfigException);
|
175
|
+
});
|
186
176
|
assertEquals("JIRA API endpoint is incorrect or not available", exception.getMessage());
|
177
|
+
}
|
187
178
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
179
|
+
@Test
|
180
|
+
public void test_validateTaskConfig_containSpaceUri() throws IOException
|
181
|
+
{
|
182
|
+
ConfigException exception = assertThrows(ConfigException.class, () -> {
|
183
|
+
ConfigSource configSource = TestHelpers.config();
|
184
|
+
configSource.set("uri", "https://example .com");
|
185
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
194
186
|
JiraUtil.validateTaskConfig(task);
|
195
|
-
}
|
196
|
-
|
197
|
-
|
198
|
-
}
|
199
|
-
assertNull(exception);
|
187
|
+
});
|
188
|
+
assertEquals("JIRA API endpoint is incorrect or not available", exception.getMessage());
|
189
|
+
}
|
200
190
|
|
201
|
-
|
191
|
+
@Test
|
192
|
+
public void test_validateTaskConfig_emptyJql() throws IOException
|
193
|
+
{
|
194
|
+
ConfigSource configSource = TestHelpers.config();
|
195
|
+
configSource.set("jql", "");
|
196
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
197
|
+
JiraUtil.validateTaskConfig(task);
|
198
|
+
}
|
199
|
+
|
200
|
+
@Test
|
201
|
+
public void test_validateTaskConfig_missingJql() throws IOException
|
202
|
+
{
|
203
|
+
ConfigSource configSource = TestHelpers.config();
|
202
204
|
configSource.remove("jql");
|
203
|
-
task = configSource.loadConfig(PluginTask.class);
|
204
|
-
|
205
|
-
|
205
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
206
|
+
JiraUtil.validateTaskConfig(task);
|
207
|
+
}
|
208
|
+
|
209
|
+
@Test
|
210
|
+
public void test_validateTaskConfig_RetryIntervalIs0() throws IOException
|
211
|
+
{
|
212
|
+
ConfigException exception = assertThrows(ConfigException.class, () -> {
|
213
|
+
ConfigSource configSource = TestHelpers.config();
|
214
|
+
configSource.set("initial_retry_interval_millis", 0);
|
215
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
206
216
|
JiraUtil.validateTaskConfig(task);
|
207
|
-
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
try {
|
217
|
+
});
|
218
|
+
assertEquals("Initial retry delay should be equal or greater than 1", exception.getMessage());
|
219
|
+
}
|
220
|
+
|
221
|
+
@Test
|
222
|
+
public void test_validateTaskConfig_RetryIntervalIsNegative() throws IOException
|
223
|
+
{
|
224
|
+
ConfigException exception = assertThrows(ConfigException.class, () -> {
|
225
|
+
ConfigSource configSource = TestHelpers.config();
|
226
|
+
configSource.set("initial_retry_interval_millis", -1);
|
227
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
219
228
|
JiraUtil.validateTaskConfig(task);
|
220
|
-
}
|
221
|
-
catch (Exception e) {
|
222
|
-
exception = e;
|
223
|
-
}
|
224
|
-
assertNotNull(exception);
|
225
|
-
assertTrue(exception instanceof ConfigException);
|
229
|
+
});
|
226
230
|
assertEquals("Initial retry delay should be equal or greater than 1", exception.getMessage());
|
231
|
+
}
|
227
232
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
233
|
+
@Test
|
234
|
+
public void test_validateTaskConfig_RetryLimitGreaterThan10() throws IOException
|
235
|
+
{
|
236
|
+
ConfigException exception = assertThrows(ConfigException.class, () -> {
|
237
|
+
ConfigSource configSource = TestHelpers.config();
|
238
|
+
configSource.set("retry_limit", 11);
|
239
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
234
240
|
JiraUtil.validateTaskConfig(task);
|
235
|
-
}
|
236
|
-
catch (Exception e) {
|
237
|
-
exception = e;
|
238
|
-
}
|
239
|
-
assertNotNull(exception);
|
240
|
-
assertTrue(exception instanceof ConfigException);
|
241
|
+
});
|
241
242
|
assertEquals("Retry limit should between 0 and 10", exception.getMessage());
|
243
|
+
}
|
242
244
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
245
|
+
@Test
|
246
|
+
public void test_validateTaskConfig_RetryLimitLessThan0() throws IOException
|
247
|
+
{
|
248
|
+
ConfigException exception = assertThrows(ConfigException.class, () -> {
|
249
|
+
ConfigSource configSource = TestHelpers.config();
|
250
|
+
configSource.set("retry_limit", -1);
|
251
|
+
PluginTask task = configSource.loadConfig(PluginTask.class);
|
249
252
|
JiraUtil.validateTaskConfig(task);
|
250
|
-
}
|
251
|
-
catch (Exception e) {
|
252
|
-
exception = e;
|
253
|
-
}
|
254
|
-
assertNotNull(exception);
|
255
|
-
assertTrue(exception instanceof ConfigException);
|
253
|
+
});
|
256
254
|
assertEquals("Retry limit should between 0 and 10", exception.getMessage());
|
257
255
|
}
|
258
256
|
|
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.8
|
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-
|
12
|
+
date: 2019-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,8 +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.
|
60
|
-
- classpath/embulk-util-retryhelper-jetty92-0.6.0.jar
|
59
|
+
- classpath/embulk-input-jira-0.2.8.jar
|
61
60
|
- classpath/gson-2.8.5.jar
|
62
61
|
- classpath/httpclient-4.5.6.jar
|
63
62
|
- classpath/httpcore-4.4.10.jar
|
@@ -66,10 +65,6 @@ files:
|
|
66
65
|
- classpath/javax.ws.rs-api-2.1.jar
|
67
66
|
- classpath/jersey-client-2.27.jar
|
68
67
|
- classpath/jersey-common-2.27.jar
|
69
|
-
- classpath/jetty-client-9.2.14.v20151106.jar
|
70
|
-
- classpath/jetty-http-9.2.14.v20151106.jar
|
71
|
-
- classpath/jetty-io-9.2.14.v20151106.jar
|
72
|
-
- classpath/jetty-util-9.2.14.v20151106.jar
|
73
68
|
- classpath/osgi-resource-locator-1.0.1.jar
|
74
69
|
- config/checkstyle/checkstyle.xml
|
75
70
|
- config/checkstyle/default.xml
|