embulk-input-jira 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -5
- data/.travis.yml +4 -34
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +5 -4
- data/build.gradle +116 -0
- data/config/checkstyle/checkstyle.xml +128 -0
- data/config/checkstyle/default.xml +108 -0
- data/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/gradle/wrapper/gradle-wrapper.properties +5 -0
- data/gradlew +172 -0
- data/gradlew.bat +84 -0
- data/lib/embulk/guess/jira.rb +24 -0
- data/lib/embulk/input/jira.rb +3 -169
- data/src/main/java/org/embulk/input/jira/AuthenticateMethod.java +27 -0
- data/src/main/java/org/embulk/input/jira/Constant.java +17 -0
- data/src/main/java/org/embulk/input/jira/Issue.java +150 -0
- data/src/main/java/org/embulk/input/jira/JiraInputPlugin.java +226 -0
- data/src/main/java/org/embulk/input/jira/client/JiraClient.java +254 -0
- data/src/main/java/org/embulk/input/jira/util/JiraException.java +18 -0
- data/src/main/java/org/embulk/input/jira/util/JiraUtil.java +264 -0
- data/src/test/java/org/embulk/input/jira/IssueTest.java +278 -0
- data/src/test/java/org/embulk/input/jira/JiraInputPluginTest.java +204 -0
- data/src/test/java/org/embulk/input/jira/JiraPluginTestRuntime.java +133 -0
- data/src/test/java/org/embulk/input/jira/TestHelpers.java +41 -0
- data/src/test/java/org/embulk/input/jira/client/JiraClientTest.java +222 -0
- data/src/test/java/org/embulk/input/jira/util/JiraUtilTest.java +318 -0
- data/src/test/resources/config.yml +13 -0
- data/src/test/resources/issue_flatten.json +129 -0
- data/src/test/resources/issue_flatten_expected.json +73 -0
- data/src/test/resources/issue_get.json +36 -0
- data/src/test/resources/issue_get_expected.json +62 -0
- data/src/test/resources/jira_client.json +81 -0
- data/src/test/resources/jira_input_plugin.json +114 -0
- data/src/test/resources/jira_util.json +26 -0
- metadata +55 -175
- data/Gemfile +0 -3
- data/LICENSE +0 -13
- data/Rakefile +0 -15
- data/embulk-input-jira.gemspec +0 -27
- data/gemfiles/embulk-0.8.0-latest +0 -4
- data/gemfiles/embulk-0.8.7 +0 -4
- data/gemfiles/embulk-0.8.8 +0 -4
- data/gemfiles/embulk-latest +0 -4
- data/gemfiles/template.erb +0 -4
- data/lib/embulk/input/jira_api.rb +0 -9
- data/lib/embulk/input/jira_api/client.rb +0 -144
- data/lib/embulk/input/jira_api/issue.rb +0 -133
- data/lib/embulk/input/jira_input_plugin_utils.rb +0 -58
- data/spec/embulk/input/jira-input-plugin-utils_spec.rb +0 -89
- data/spec/embulk/input/jira_api/client_spec.rb +0 -224
- data/spec/embulk/input/jira_api/issue_spec.rb +0 -394
- data/spec/embulk/input/jira_spec.rb +0 -322
- data/spec/embulk_spec.rb +0 -32
- data/spec/spec_helper.rb +0 -26
- data/spec/support/stdout_and_err_capture.rb +0 -45
@@ -0,0 +1,18 @@
|
|
1
|
+
package org.embulk.input.jira.util;
|
2
|
+
|
3
|
+
public class JiraException extends Exception
|
4
|
+
{
|
5
|
+
private static final long serialVersionUID = -256731723520584046L;
|
6
|
+
private final int statusCode;
|
7
|
+
|
8
|
+
public JiraException(int statusCode, String message)
|
9
|
+
{
|
10
|
+
super(message + ":" + Integer.toString(statusCode));
|
11
|
+
this.statusCode = statusCode;
|
12
|
+
}
|
13
|
+
|
14
|
+
public int getStatusCode()
|
15
|
+
{
|
16
|
+
return statusCode;
|
17
|
+
}
|
18
|
+
}
|
@@ -0,0 +1,264 @@
|
|
1
|
+
package org.embulk.input.jira.util;
|
2
|
+
|
3
|
+
import com.google.gson.JsonElement;
|
4
|
+
|
5
|
+
import org.embulk.config.ConfigException;
|
6
|
+
import org.embulk.input.jira.Issue;
|
7
|
+
import org.embulk.input.jira.JiraInputPlugin.PluginTask;
|
8
|
+
import org.embulk.spi.Column;
|
9
|
+
import org.embulk.spi.ColumnConfig;
|
10
|
+
import org.embulk.spi.ColumnVisitor;
|
11
|
+
import org.embulk.spi.PageBuilder;
|
12
|
+
import org.embulk.spi.Schema;
|
13
|
+
import org.embulk.spi.json.JsonParser;
|
14
|
+
import org.embulk.spi.time.Timestamp;
|
15
|
+
import org.embulk.spi.time.TimestampParser;
|
16
|
+
|
17
|
+
import javax.ws.rs.core.UriBuilder;
|
18
|
+
|
19
|
+
import java.io.IOException;
|
20
|
+
import java.net.HttpURLConnection;
|
21
|
+
import java.net.URL;
|
22
|
+
import java.util.List;
|
23
|
+
import java.util.stream.Collectors;
|
24
|
+
import java.util.stream.StreamSupport;
|
25
|
+
|
26
|
+
import static com.google.common.base.Strings.isNullOrEmpty;
|
27
|
+
import static org.embulk.input.jira.Constant.CREDENTIAL_URI_PATH;
|
28
|
+
import static org.embulk.input.jira.Constant.DEFAULT_TIMESTAMP_PATTERN;
|
29
|
+
import static org.embulk.input.jira.Constant.SEARCH_URI_PATH;
|
30
|
+
|
31
|
+
public final class JiraUtil
|
32
|
+
{
|
33
|
+
private JiraUtil() {}
|
34
|
+
|
35
|
+
public static int calculateTotalPage(int totalCount, int resultPerPage)
|
36
|
+
{
|
37
|
+
return (int) Math.ceil((double) totalCount / resultPerPage);
|
38
|
+
}
|
39
|
+
|
40
|
+
public static String buildPermissionUrl(String url)
|
41
|
+
{
|
42
|
+
return UriBuilder.fromUri(url).path(CREDENTIAL_URI_PATH).build().toString();
|
43
|
+
}
|
44
|
+
|
45
|
+
public static String buildSearchUrl(String url)
|
46
|
+
{
|
47
|
+
return UriBuilder.fromUri(url).path(SEARCH_URI_PATH).build().toString();
|
48
|
+
}
|
49
|
+
|
50
|
+
public static void validateTaskConfig(final PluginTask task)
|
51
|
+
{
|
52
|
+
String username = task.getUsername();
|
53
|
+
if (isNullOrEmpty(username)) {
|
54
|
+
throw new ConfigException("Username or email could not be empty");
|
55
|
+
}
|
56
|
+
String password = task.getPassword();
|
57
|
+
if (isNullOrEmpty(password)) {
|
58
|
+
throw new ConfigException("Password could not be empty");
|
59
|
+
}
|
60
|
+
String uri = task.getUri();
|
61
|
+
if (isNullOrEmpty(uri)) {
|
62
|
+
throw new ConfigException("JIRA API endpoint could not be empty");
|
63
|
+
}
|
64
|
+
HttpURLConnection connection = null;
|
65
|
+
try {
|
66
|
+
URL u = new URL(uri);
|
67
|
+
connection = (HttpURLConnection) u.openConnection();
|
68
|
+
connection.setRequestMethod("GET");
|
69
|
+
connection.getResponseCode();
|
70
|
+
}
|
71
|
+
catch (IOException e) {
|
72
|
+
throw new ConfigException("JIRA API endpoint is incorrect or not available");
|
73
|
+
}
|
74
|
+
finally {
|
75
|
+
if (connection != null) {
|
76
|
+
connection.disconnect();
|
77
|
+
}
|
78
|
+
}
|
79
|
+
String jql = task.getJQL();
|
80
|
+
if (isNullOrEmpty(jql)) {
|
81
|
+
throw new ConfigException("JQL could not be empty");
|
82
|
+
}
|
83
|
+
int retryInitialWaitSec = task.getInitialRetryIntervalMillis();
|
84
|
+
if (retryInitialWaitSec < 1) {
|
85
|
+
throw new ConfigException("Initial retry delay should be equal or greater than 1");
|
86
|
+
}
|
87
|
+
int retryLimit = task.getRetryLimit();
|
88
|
+
if (retryLimit < 0 || retryLimit > 10) {
|
89
|
+
throw new ConfigException("Retry limit should between 0 and 10");
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
/*
|
94
|
+
* For getting the timestamp value of the node
|
95
|
+
* Sometime if the parser could not parse the value then return null
|
96
|
+
* */
|
97
|
+
private static Timestamp getTimestampValue(PluginTask task, Column column, String value)
|
98
|
+
{
|
99
|
+
List<ColumnConfig> columnConfigs = task.getColumns().getColumns();
|
100
|
+
String pattern = DEFAULT_TIMESTAMP_PATTERN;
|
101
|
+
for (ColumnConfig config : columnConfigs) {
|
102
|
+
if (config.getName().equals(column.getName())
|
103
|
+
&& config.getConfigSource() != null
|
104
|
+
&& config.getConfigSource().getObjectNode() != null
|
105
|
+
&& config.getConfigSource().getObjectNode().get("format") != null
|
106
|
+
&& config.getConfigSource().getObjectNode().get("format").isTextual()) {
|
107
|
+
pattern = config.getConfigSource().getObjectNode().get("format").asText();
|
108
|
+
break;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
TimestampParser parser = TimestampParser.of(pattern, "UTC");
|
112
|
+
Timestamp result = null;
|
113
|
+
try {
|
114
|
+
result = parser.parse(value);
|
115
|
+
}
|
116
|
+
catch (Exception e) {
|
117
|
+
}
|
118
|
+
return result;
|
119
|
+
}
|
120
|
+
|
121
|
+
/*
|
122
|
+
* For getting the Long value of the node
|
123
|
+
* Sometime if error occurs (i.e a JSON value but user modified it as long) then return null
|
124
|
+
* */
|
125
|
+
private static Long getLongValue(JsonElement value)
|
126
|
+
{
|
127
|
+
Long result = null;
|
128
|
+
try {
|
129
|
+
result = value.getAsLong();
|
130
|
+
}
|
131
|
+
catch (Exception e) {
|
132
|
+
}
|
133
|
+
return result;
|
134
|
+
}
|
135
|
+
|
136
|
+
/*
|
137
|
+
* For getting the Double value of the node
|
138
|
+
* Sometime if error occurs (i.e a JSON value but user modified it as double) then return null
|
139
|
+
* */
|
140
|
+
private static Double getDoubleValue(JsonElement value)
|
141
|
+
{
|
142
|
+
Double result = null;
|
143
|
+
try {
|
144
|
+
result = value.getAsDouble();
|
145
|
+
}
|
146
|
+
catch (Exception e) {
|
147
|
+
}
|
148
|
+
return result;
|
149
|
+
}
|
150
|
+
|
151
|
+
/*
|
152
|
+
* For getting the Boolean value of the node
|
153
|
+
* Sometime if error occurs (i.e a JSON value but user modified it as boolean) then return null
|
154
|
+
* */
|
155
|
+
private static Boolean getBooleanValue(JsonElement value)
|
156
|
+
{
|
157
|
+
Boolean result = null;
|
158
|
+
try {
|
159
|
+
result = value.getAsBoolean();
|
160
|
+
}
|
161
|
+
catch (Exception e) {
|
162
|
+
}
|
163
|
+
return result;
|
164
|
+
}
|
165
|
+
|
166
|
+
public static void addRecord(Issue issue, Schema schema, PluginTask task, PageBuilder pageBuilder)
|
167
|
+
{
|
168
|
+
schema.visitColumns(new ColumnVisitor() {
|
169
|
+
@Override
|
170
|
+
public void jsonColumn(Column column)
|
171
|
+
{
|
172
|
+
JsonElement data = issue.getValue(column.getName());
|
173
|
+
if (data.isJsonNull() || data.isJsonPrimitive()) {
|
174
|
+
pageBuilder.setNull(column);
|
175
|
+
}
|
176
|
+
else {
|
177
|
+
pageBuilder.setJson(column, new JsonParser().parse(data.toString()));
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
@Override
|
182
|
+
public void stringColumn(Column column)
|
183
|
+
{
|
184
|
+
JsonElement data = issue.getValue(column.getName());
|
185
|
+
if (data.isJsonNull()) {
|
186
|
+
pageBuilder.setNull(column);
|
187
|
+
}
|
188
|
+
else if (data.isJsonPrimitive()) {
|
189
|
+
pageBuilder.setString(column, data.getAsString());
|
190
|
+
}
|
191
|
+
else if (data.isJsonArray()) {
|
192
|
+
pageBuilder.setString(column, StreamSupport.stream(data.getAsJsonArray().spliterator(), false)
|
193
|
+
.map(obj -> {
|
194
|
+
if (obj.isJsonPrimitive()) {
|
195
|
+
return obj.getAsString();
|
196
|
+
}
|
197
|
+
else {
|
198
|
+
return obj.toString();
|
199
|
+
}
|
200
|
+
})
|
201
|
+
.collect(Collectors.joining(",")));
|
202
|
+
}
|
203
|
+
else {
|
204
|
+
pageBuilder.setString(column, data.toString());
|
205
|
+
}
|
206
|
+
}
|
207
|
+
|
208
|
+
@Override
|
209
|
+
public void timestampColumn(Column column)
|
210
|
+
{
|
211
|
+
JsonElement data = issue.getValue(column.getName());
|
212
|
+
if (data.isJsonNull() || data.isJsonObject() || data.isJsonArray()) {
|
213
|
+
pageBuilder.setNull(column);
|
214
|
+
}
|
215
|
+
else {
|
216
|
+
Timestamp value = getTimestampValue(task, column, data.getAsString());
|
217
|
+
if (value == null) {
|
218
|
+
pageBuilder.setNull(column);
|
219
|
+
}
|
220
|
+
else {
|
221
|
+
pageBuilder.setTimestamp(column, value);
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}
|
225
|
+
|
226
|
+
@Override
|
227
|
+
public void booleanColumn(Column column)
|
228
|
+
{
|
229
|
+
Boolean value = getBooleanValue(issue.getValue(column.getName()));
|
230
|
+
if (value == null) {
|
231
|
+
pageBuilder.setNull(column);
|
232
|
+
}
|
233
|
+
else {
|
234
|
+
pageBuilder.setBoolean(column, value);
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
@Override
|
239
|
+
public void longColumn(Column column)
|
240
|
+
{
|
241
|
+
Long value = getLongValue(issue.getValue(column.getName()));
|
242
|
+
if (value == null) {
|
243
|
+
pageBuilder.setNull(column);
|
244
|
+
}
|
245
|
+
else {
|
246
|
+
pageBuilder.setLong(column, value);
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
@Override
|
251
|
+
public void doubleColumn(Column column)
|
252
|
+
{
|
253
|
+
Double value = getDoubleValue(issue.getValue(column.getName()));
|
254
|
+
if (value == null) {
|
255
|
+
pageBuilder.setNull(column);
|
256
|
+
}
|
257
|
+
else {
|
258
|
+
pageBuilder.setDouble(column, value);
|
259
|
+
}
|
260
|
+
}
|
261
|
+
});
|
262
|
+
pageBuilder.addRecord();
|
263
|
+
}
|
264
|
+
}
|
@@ -0,0 +1,278 @@
|
|
1
|
+
package org.embulk.input.jira;
|
2
|
+
|
3
|
+
import com.google.gson.JsonElement;
|
4
|
+
import com.google.gson.JsonObject;
|
5
|
+
|
6
|
+
import org.junit.BeforeClass;
|
7
|
+
import org.junit.Test;
|
8
|
+
|
9
|
+
import java.io.IOException;
|
10
|
+
|
11
|
+
import static org.junit.Assert.assertEquals;
|
12
|
+
|
13
|
+
public class IssueTest
|
14
|
+
{
|
15
|
+
private static JsonObject flattenData;
|
16
|
+
private static JsonObject flattenExpected;
|
17
|
+
private static JsonObject issueGet;
|
18
|
+
private static JsonObject issueGetExpected;
|
19
|
+
@BeforeClass
|
20
|
+
public static void setUp() throws IOException
|
21
|
+
{
|
22
|
+
flattenData = TestHelpers.getJsonFromFile("issue_flatten.json");
|
23
|
+
flattenExpected = TestHelpers.getJsonFromFile("issue_flatten_expected.json");
|
24
|
+
issueGet = TestHelpers.getJsonFromFile("issue_get.json");
|
25
|
+
issueGetExpected = TestHelpers.getJsonFromFile("issue_get_expected.json");
|
26
|
+
}
|
27
|
+
|
28
|
+
@Test
|
29
|
+
public void test_toRecord_simple()
|
30
|
+
{
|
31
|
+
String testName = "simple";
|
32
|
+
Issue issue = new Issue(flattenData.get(testName).getAsJsonObject());
|
33
|
+
JsonObject expected = flattenExpected.get(testName).getAsJsonObject();
|
34
|
+
assertEquals(expected, issue.getFlatten());
|
35
|
+
}
|
36
|
+
|
37
|
+
@Test
|
38
|
+
public void test_toRecord_twoLevels()
|
39
|
+
{
|
40
|
+
String testName = "twoLevels";
|
41
|
+
Issue issue = new Issue(flattenData.get(testName).getAsJsonObject());
|
42
|
+
JsonObject expected = flattenExpected.get(testName).getAsJsonObject();
|
43
|
+
assertEquals(expected, issue.getFlatten());
|
44
|
+
}
|
45
|
+
|
46
|
+
@Test
|
47
|
+
public void test_toRecord_threeLevels()
|
48
|
+
{
|
49
|
+
String testName = "threeLevels";
|
50
|
+
Issue issue = new Issue(flattenData.get(testName).getAsJsonObject());
|
51
|
+
JsonObject expected = flattenExpected.get(testName).getAsJsonObject();
|
52
|
+
assertEquals(expected, issue.getFlatten());
|
53
|
+
}
|
54
|
+
|
55
|
+
@Test
|
56
|
+
public void test_toRecord_threeLevelsWithoutKeys()
|
57
|
+
{
|
58
|
+
String testName = "threeLevelsWithoutKeys";
|
59
|
+
Issue issue = new Issue(flattenData.get(testName).getAsJsonObject());
|
60
|
+
JsonObject expected = flattenExpected.get(testName).getAsJsonObject();
|
61
|
+
assertEquals(expected, issue.getFlatten());
|
62
|
+
}
|
63
|
+
|
64
|
+
@Test
|
65
|
+
public void test_toRecord_threeLevelsWithKeys()
|
66
|
+
{
|
67
|
+
String testName = "threeLevelsWithKeys";
|
68
|
+
Issue issue = new Issue(flattenData.get(testName).getAsJsonObject());
|
69
|
+
JsonObject expected = flattenExpected.get(testName).getAsJsonObject();
|
70
|
+
assertEquals(expected, issue.getFlatten());
|
71
|
+
}
|
72
|
+
|
73
|
+
@Test
|
74
|
+
public void test_toRecord_threeLevelsWithNullKeys()
|
75
|
+
{
|
76
|
+
String testName = "threeLevelsWithNullKeys";
|
77
|
+
Issue issue = new Issue(flattenData.get(testName).getAsJsonObject());
|
78
|
+
JsonObject expected = flattenExpected.get(testName).getAsJsonObject();
|
79
|
+
assertEquals(expected, issue.getFlatten());
|
80
|
+
}
|
81
|
+
|
82
|
+
@Test
|
83
|
+
public void test_toRecord_arrayWithAllJsonObjectWithSameKeysAndEmptyObject()
|
84
|
+
{
|
85
|
+
String testName = "arrayWithAllJsonObjectWithSameKeysAndEmptyObject";
|
86
|
+
Issue issue = new Issue(flattenData.get(testName).getAsJsonObject());
|
87
|
+
JsonObject expected = flattenExpected.get(testName).getAsJsonObject();
|
88
|
+
assertEquals(expected, issue.getFlatten());
|
89
|
+
}
|
90
|
+
|
91
|
+
@Test
|
92
|
+
public void test_toRecord_arrayWithAllJsonObjectWithSameKeysAndNotEmptyObject()
|
93
|
+
{
|
94
|
+
String testName = "arrayWithAllJsonObjectWithSameKeysAndNotEmptyObject";
|
95
|
+
Issue issue = new Issue(flattenData.get(testName).getAsJsonObject());
|
96
|
+
JsonObject expected = flattenExpected.get(testName).getAsJsonObject();
|
97
|
+
assertEquals(expected, issue.getFlatten());
|
98
|
+
}
|
99
|
+
|
100
|
+
@Test
|
101
|
+
public void test_toRecord_arrayWithAllJsonObjectWithoutSameKeys()
|
102
|
+
{
|
103
|
+
String testName = "arrayWithAllJsonObjectWithoutSameKeys";
|
104
|
+
Issue issue = new Issue(flattenData.get(testName).getAsJsonObject());
|
105
|
+
JsonObject expected = flattenExpected.get(testName).getAsJsonObject();
|
106
|
+
assertEquals(expected, issue.getFlatten());
|
107
|
+
}
|
108
|
+
|
109
|
+
@Test
|
110
|
+
public void test_getValue_primitive()
|
111
|
+
{
|
112
|
+
String testName = "primitive";
|
113
|
+
Issue issue = new Issue(issueGet);
|
114
|
+
String path = issueGetExpected.get(testName).getAsString();
|
115
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
116
|
+
assertEquals(expected, issue.getValue(path));
|
117
|
+
}
|
118
|
+
|
119
|
+
@Test
|
120
|
+
public void test_getValue_string()
|
121
|
+
{
|
122
|
+
String testName = "string";
|
123
|
+
Issue issue = new Issue(issueGet);
|
124
|
+
String path = issueGetExpected.get(testName).getAsString();
|
125
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
126
|
+
assertEquals(expected, issue.getValue(path));
|
127
|
+
}
|
128
|
+
|
129
|
+
@Test
|
130
|
+
public void test_getValue_emptyObject()
|
131
|
+
{
|
132
|
+
String testName = "emptyObject";
|
133
|
+
Issue issue = new Issue(issueGet);
|
134
|
+
String path = issueGetExpected.get(testName).getAsString();
|
135
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
136
|
+
assertEquals(expected, issue.getValue(path));
|
137
|
+
}
|
138
|
+
|
139
|
+
@Test
|
140
|
+
public void test_getValue_object()
|
141
|
+
{
|
142
|
+
String testName = "object";
|
143
|
+
Issue issue = new Issue(issueGet);
|
144
|
+
String path = issueGetExpected.get(testName).getAsString();
|
145
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
146
|
+
assertEquals(expected, issue.getValue(path));
|
147
|
+
}
|
148
|
+
|
149
|
+
@Test
|
150
|
+
public void test_getValue_null()
|
151
|
+
{
|
152
|
+
String testName = "null";
|
153
|
+
Issue issue = new Issue(issueGet);
|
154
|
+
String path = issueGetExpected.get(testName).getAsString();
|
155
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
156
|
+
assertEquals(expected, issue.getValue(path));
|
157
|
+
}
|
158
|
+
|
159
|
+
@Test
|
160
|
+
public void test_getValue_notExisted()
|
161
|
+
{
|
162
|
+
String testName = "notExisted";
|
163
|
+
Issue issue = new Issue(issueGet);
|
164
|
+
String path = issueGetExpected.get(testName).getAsString();
|
165
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
166
|
+
assertEquals(expected, issue.getValue(path));
|
167
|
+
}
|
168
|
+
|
169
|
+
@Test
|
170
|
+
public void test_getValue_notExisted2Levels()
|
171
|
+
{
|
172
|
+
String testName = "notExisted2Levels";
|
173
|
+
Issue issue = new Issue(issueGet);
|
174
|
+
String path = issueGetExpected.get(testName).getAsString();
|
175
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
176
|
+
assertEquals(expected, issue.getValue(path));
|
177
|
+
}
|
178
|
+
|
179
|
+
@Test
|
180
|
+
public void test_getValue_emptyArray()
|
181
|
+
{
|
182
|
+
String testName = "emptyArray";
|
183
|
+
Issue issue = new Issue(issueGet);
|
184
|
+
String path = issueGetExpected.get(testName).getAsString();
|
185
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
186
|
+
assertEquals(expected, issue.getValue(path));
|
187
|
+
}
|
188
|
+
|
189
|
+
@Test
|
190
|
+
public void test_getValue_primitiveArray()
|
191
|
+
{
|
192
|
+
String testName = "primitiveArray";
|
193
|
+
Issue issue = new Issue(issueGet);
|
194
|
+
String path = issueGetExpected.get(testName).getAsString();
|
195
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
196
|
+
assertEquals(expected, issue.getValue(path));
|
197
|
+
}
|
198
|
+
|
199
|
+
@Test
|
200
|
+
public void test_getValue_nestedPrimitive()
|
201
|
+
{
|
202
|
+
String testName = "nestedPrimitive";
|
203
|
+
Issue issue = new Issue(issueGet);
|
204
|
+
String path = issueGetExpected.get(testName).getAsString();
|
205
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
206
|
+
assertEquals(expected, issue.getValue(path));
|
207
|
+
}
|
208
|
+
|
209
|
+
@Test
|
210
|
+
public void test_getValue_nestedObject()
|
211
|
+
{
|
212
|
+
String testName = "nestedObject";
|
213
|
+
Issue issue = new Issue(issueGet);
|
214
|
+
String path = issueGetExpected.get(testName).getAsString();
|
215
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
216
|
+
assertEquals(expected, issue.getValue(path));
|
217
|
+
}
|
218
|
+
|
219
|
+
@Test
|
220
|
+
public void test_getValue_nestedArray()
|
221
|
+
{
|
222
|
+
String testName = "nestedArray";
|
223
|
+
Issue issue = new Issue(issueGet);
|
224
|
+
String path = issueGetExpected.get(testName).getAsString();
|
225
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
226
|
+
assertEquals(expected, issue.getValue(path));
|
227
|
+
}
|
228
|
+
|
229
|
+
@Test
|
230
|
+
public void test_getValue_3levelsArraysNull()
|
231
|
+
{
|
232
|
+
String testName = "3levelsArraysNull";
|
233
|
+
Issue issue = new Issue(issueGet);
|
234
|
+
String path = issueGetExpected.get(testName).getAsString();
|
235
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
236
|
+
assertEquals(expected, issue.getValue(path));
|
237
|
+
}
|
238
|
+
|
239
|
+
@Test
|
240
|
+
public void test_getValue_allJsonObjectArrayPrimitive()
|
241
|
+
{
|
242
|
+
String testName = "allJsonObjectArrayPrimitive";
|
243
|
+
Issue issue = new Issue(issueGet);
|
244
|
+
String path = issueGetExpected.get(testName).getAsString();
|
245
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
246
|
+
assertEquals(expected, issue.getValue(path));
|
247
|
+
}
|
248
|
+
|
249
|
+
@Test
|
250
|
+
public void test_getValue_allJsonObjectArrayString()
|
251
|
+
{
|
252
|
+
String testName = "allJsonObjectArrayString";
|
253
|
+
Issue issue = new Issue(issueGet);
|
254
|
+
String path = issueGetExpected.get(testName).getAsString();
|
255
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
256
|
+
assertEquals(expected, issue.getValue(path));
|
257
|
+
}
|
258
|
+
|
259
|
+
@Test
|
260
|
+
public void test_getValue_allJsonObjectArrayOnly1()
|
261
|
+
{
|
262
|
+
String testName = "allJsonObjectArrayOnly1";
|
263
|
+
Issue issue = new Issue(issueGet);
|
264
|
+
String path = issueGetExpected.get(testName).getAsString();
|
265
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
266
|
+
assertEquals(expected, issue.getValue(path));
|
267
|
+
}
|
268
|
+
|
269
|
+
@Test
|
270
|
+
public void test_getValue_allJsonObjectArrayOnly2()
|
271
|
+
{
|
272
|
+
String testName = "allJsonObjectArrayOnly2";
|
273
|
+
Issue issue = new Issue(issueGet);
|
274
|
+
String path = issueGetExpected.get(testName).getAsString();
|
275
|
+
JsonElement expected = issueGetExpected.get(testName + "Result");
|
276
|
+
assertEquals(expected, issue.getValue(path));
|
277
|
+
}
|
278
|
+
}
|