embulk-input-jira 0.2.6 → 0.2.7
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 +4 -4
- data/CHANGELOG.md +5 -1
- data/build.gradle +1 -1
- data/src/main/java/org/embulk/input/jira/JiraInputPlugin.java +3 -1
- data/src/main/java/org/embulk/input/jira/client/JiraClient.java +3 -1
- data/src/main/java/org/embulk/input/jira/util/JiraUtil.java +0 -4
- data/src/test/java/org/embulk/input/jira/client/JiraClientTest.java +25 -0
- data/src/test/java/org/embulk/input/jira/util/JiraUtilTest.java +13 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bffa95b4ab1e2b43adb69e1a94ca3264d4c50589
|
4
|
+
data.tar.gz: 949d00a53b677ad6264db49eaceaa405bbb6607b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b238a357a63fab9aeefd3b195dcc2ad1c9f934c1a310b031c7648c63ea72537c9ab2fdd13f88519d2fab516d3d5c508b6d33e592b1af4a64f18f4d9a7852a630
|
7
|
+
data.tar.gz: e35f6c9bf319e7b4802ce031592ade24b11781c7231f6191ed437550275bce3a05cb77f090902a2749037c4aa33982d6ed505f2ca994e73a5f22430eb823eef2
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
## 0.2.
|
1
|
+
## 0.2.7 - 2019-03-05
|
2
|
+
|
3
|
+
* [enhancement] Support empty JQL [#55](https://github.com/treasure-data/embulk-input-jira/pull/55)
|
4
|
+
|
5
|
+
## 0.2.6 - 2019-03-01
|
2
6
|
|
3
7
|
* [enhancement] Change from ruby to java plugin [#53](https://github.com/treasure-data/embulk-input-jira/pull/53)
|
4
8
|
|
data/build.gradle
CHANGED
@@ -3,6 +3,7 @@ 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;
|
6
7
|
import com.google.common.collect.ImmutableList;
|
7
8
|
import com.google.gson.JsonArray;
|
8
9
|
import com.google.gson.JsonElement;
|
@@ -74,7 +75,8 @@ public class JiraInputPlugin
|
|
74
75
|
public int getRetryLimit();
|
75
76
|
|
76
77
|
@Config("jql")
|
77
|
-
|
78
|
+
@ConfigDefault("null")
|
79
|
+
public Optional<String> getJQL();
|
78
80
|
|
79
81
|
@Config("columns")
|
80
82
|
public SchemaConfig getColumns();
|
@@ -1,6 +1,7 @@
|
|
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;
|
4
5
|
import com.google.gson.JsonArray;
|
5
6
|
import com.google.gson.JsonElement;
|
6
7
|
import com.google.gson.JsonObject;
|
@@ -243,7 +244,8 @@ public class JiraClient
|
|
243
244
|
private String createSearchIssuesBody(PluginTask task, int startAt, int maxResults)
|
244
245
|
{
|
245
246
|
JsonObject body = new JsonObject();
|
246
|
-
|
247
|
+
Optional<String> jql = task.getJQL();
|
248
|
+
body.add("jql", new JsonPrimitive(jql.or("")));
|
247
249
|
body.add("startAt", new JsonPrimitive(startAt));
|
248
250
|
body.add("maxResults", new JsonPrimitive(maxResults));
|
249
251
|
JsonArray fields = new JsonArray();
|
@@ -76,10 +76,6 @@ public final class JiraUtil
|
|
76
76
|
connection.disconnect();
|
77
77
|
}
|
78
78
|
}
|
79
|
-
String jql = task.getJQL();
|
80
|
-
if (isNullOrEmpty(jql)) {
|
81
|
-
throw new ConfigException("JQL could not be empty");
|
82
|
-
}
|
83
79
|
int retryInitialWaitSec = task.getInitialRetryIntervalMillis();
|
84
80
|
if (retryInitialWaitSec < 1) {
|
85
81
|
throw new ConfigException("Initial retry delay should be equal or greater than 1");
|
@@ -8,6 +8,7 @@ import org.apache.http.client.HttpClient;
|
|
8
8
|
import org.apache.http.entity.StringEntity;
|
9
9
|
import org.embulk.EmbulkTestRuntime;
|
10
10
|
import org.embulk.config.ConfigException;
|
11
|
+
import org.embulk.config.ConfigSource;
|
11
12
|
import org.embulk.input.jira.Issue;
|
12
13
|
import org.embulk.input.jira.JiraInputPlugin.PluginTask;
|
13
14
|
import org.embulk.input.jira.TestHelpers;
|
@@ -219,4 +220,28 @@ public class JiraClientTest
|
|
219
220
|
|
220
221
|
assertThrows(ConfigException.class, () -> jiraClient.searchIssues(task, 0, 50));
|
221
222
|
}
|
223
|
+
|
224
|
+
@Test
|
225
|
+
public void test_searchIssues_emptyJql() throws IOException
|
226
|
+
{
|
227
|
+
String dataName = "searchIssuesSuccess";
|
228
|
+
JsonObject messageResponse = data.get(dataName).getAsJsonObject();
|
229
|
+
|
230
|
+
int statusCode = messageResponse.get("statusCode").getAsInt();
|
231
|
+
String body = messageResponse.get("body").toString();
|
232
|
+
|
233
|
+
when(statusLine.getStatusCode()).thenReturn(statusCode);
|
234
|
+
when(response.getEntity()).thenReturn(new StringEntity(body));
|
235
|
+
ConfigSource config = TestHelpers.config().remove("jql");
|
236
|
+
task = config.loadConfig(PluginTask.class);
|
237
|
+
|
238
|
+
List<Issue> issues = jiraClient.searchIssues(task, 0, 50);
|
239
|
+
assertEquals(issues.size(), 2);
|
240
|
+
|
241
|
+
config = TestHelpers.config().set("jql", "");
|
242
|
+
task = config.loadConfig(PluginTask.class);
|
243
|
+
|
244
|
+
issues = jiraClient.searchIssues(task, 0, 50);
|
245
|
+
assertEquals(issues.size(), 2);
|
246
|
+
}
|
222
247
|
}
|
@@ -196,9 +196,19 @@ public class JiraUtilTest
|
|
196
196
|
catch (Exception e) {
|
197
197
|
exception = e;
|
198
198
|
}
|
199
|
-
|
200
|
-
|
201
|
-
|
199
|
+
assertNull(exception);
|
200
|
+
|
201
|
+
configSource = TestHelpers.config();
|
202
|
+
configSource.remove("jql");
|
203
|
+
task = configSource.loadConfig(PluginTask.class);
|
204
|
+
exception = null;
|
205
|
+
try {
|
206
|
+
JiraUtil.validateTaskConfig(task);
|
207
|
+
}
|
208
|
+
catch (Exception e) {
|
209
|
+
exception = e;
|
210
|
+
}
|
211
|
+
assertNull(exception);
|
202
212
|
|
203
213
|
// initial_retry_interval_millis = 0
|
204
214
|
configSource = TestHelpers.config();
|
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.7
|
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-03-
|
12
|
+
date: 2019-03-04 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.7.jar
|
60
60
|
- classpath/embulk-util-retryhelper-jetty92-0.6.0.jar
|
61
61
|
- classpath/gson-2.8.5.jar
|
62
62
|
- classpath/httpclient-4.5.6.jar
|