embulk-input-http 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/classpath/{embulk-input-http-0.0.13.jar → embulk-input-http-0.0.14.jar} +0 -0
- data/classpath/{httpclient-4.4.jar → httpclient-4.5.jar} +0 -0
- data/classpath/{httpcore-4.4.jar → httpcore-4.4.1.jar} +0 -0
- metadata +5 -28
- data/.gitignore +0 -8
- data/LICENSE.txt +0 -21
- data/README.md +0 -188
- data/build.gradle +0 -76
- data/config/checkstyle/checkstyle.xml +0 -128
- data/config/checkstyle/default.xml +0 -108
- data/example/json-example.yml +0 -21
- data/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/gradle/wrapper/gradle-wrapper.properties +0 -6
- data/gradlew +0 -164
- data/gradlew.bat +0 -90
- data/lib/embulk/input/http.rb +0 -3
- data/settings.gradle +0 -1
- data/src/main/java/org/embulk/input/BasicAuthConfig.java +0 -39
- data/src/main/java/org/embulk/input/HttpInputPlugin.java +0 -332
- data/src/main/java/org/embulk/input/PagerConfig.java +0 -86
- data/src/main/java/org/embulk/input/ParamsConfig.java +0 -82
- data/src/main/java/org/embulk/input/QueryConfig.java +0 -171
- data/src/main/java/org/embulk/input/RetryableHandler.java +0 -90
- data/src/test/java/org/embulk/input/TestHttpInputPlugin.java +0 -5
- data/src/test/java/org/embulk/input/TestPagerConfig.java +0 -78
- data/src/test/java/org/embulk/input/TestParamsConfig.java +0 -105
- data/src/test/java/org/embulk/input/TestQueryConfig.java +0 -125
@@ -1,125 +0,0 @@
|
|
1
|
-
package org.embulk.input;
|
2
|
-
|
3
|
-
import com.google.common.base.Optional;
|
4
|
-
import com.google.common.collect.Lists;
|
5
|
-
import org.junit.Test;
|
6
|
-
|
7
|
-
import java.util.List;
|
8
|
-
|
9
|
-
import static org.junit.Assert.assertEquals;
|
10
|
-
|
11
|
-
public class TestQueryConfig {
|
12
|
-
|
13
|
-
@Test
|
14
|
-
public void testUnexpandSingleValue() throws Exception {
|
15
|
-
Optional<List<String>> nullValues = Optional.absent();
|
16
|
-
QueryConfig config = new QueryConfig("test", Optional.of("awesome"), nullValues, false);
|
17
|
-
List<QueryConfig.Query> dest = config.expand();
|
18
|
-
assertEquals(dest.size(), 1);
|
19
|
-
assertEquals(dest.get(0).getName(), "test");
|
20
|
-
assertEquals(dest.get(0).getValues().length, 1);
|
21
|
-
assertEquals(dest.get(0).getValues()[0], "awesome");
|
22
|
-
}
|
23
|
-
|
24
|
-
@Test
|
25
|
-
public void testUnexpandMultiValue() throws Exception {
|
26
|
-
Optional<String> nullValue = Optional.absent();
|
27
|
-
List<String> values = Lists.newArrayList("a", "b", "c");
|
28
|
-
QueryConfig config = new QueryConfig("test", nullValue, Optional.of(values), false);
|
29
|
-
List<QueryConfig.Query> dest = config.expand();
|
30
|
-
assertEquals(dest.size(), 1);
|
31
|
-
assertEquals(dest.get(0).getName(), "test");
|
32
|
-
|
33
|
-
assertEquals(dest.get(0).getValues().length, 3);
|
34
|
-
assertEquals(dest.get(0).getValues()[0], "a");
|
35
|
-
assertEquals(dest.get(0).getValues()[1], "b");
|
36
|
-
assertEquals(dest.get(0).getValues()[2], "c");
|
37
|
-
}
|
38
|
-
|
39
|
-
@Test
|
40
|
-
public void testExpandSingleValue() throws Exception {
|
41
|
-
Optional<List<String>> nullValues = Optional.absent();
|
42
|
-
QueryConfig config = new QueryConfig("test", Optional.of("awesome"), nullValues, true);
|
43
|
-
List<QueryConfig.Query> dest = config.expand();
|
44
|
-
assertEquals(dest.size(), 1);
|
45
|
-
assertEquals(dest.get(0).getName(), "test");
|
46
|
-
assertEquals(dest.get(0).getValues()[0], "awesome");
|
47
|
-
}
|
48
|
-
|
49
|
-
@Test
|
50
|
-
public void testExpandMultiValue() throws Exception {
|
51
|
-
Optional<String> nullValue = Optional.absent();
|
52
|
-
List<String> values = Lists.newArrayList("a", "b", "c");
|
53
|
-
QueryConfig config = new QueryConfig("test", nullValue, Optional.of(values), true);
|
54
|
-
List<QueryConfig.Query> dest = config.expand();
|
55
|
-
assertEquals(dest.size(), 3);
|
56
|
-
assertEquals(dest.get(0).getName(), "test");
|
57
|
-
assertEquals(dest.get(0).getValues().length, 1);
|
58
|
-
assertEquals(dest.get(0).getValues()[0], "a");
|
59
|
-
|
60
|
-
assertEquals(dest.get(1).getValues().length, 1);
|
61
|
-
assertEquals(dest.get(1).getName(), "test");
|
62
|
-
assertEquals(dest.get(1).getValues()[0], "b");
|
63
|
-
|
64
|
-
assertEquals(dest.get(2).getValues().length, 1);
|
65
|
-
assertEquals(dest.get(2).getName(), "test");
|
66
|
-
assertEquals(dest.get(2).getValues()[0], "c");
|
67
|
-
}
|
68
|
-
|
69
|
-
@Test(expected = IllegalArgumentException.class)
|
70
|
-
public void testExpandRaisesExceptionWhenBothValuesAreNull() throws Exception {
|
71
|
-
Optional<List<String>> nullValues = Optional.absent();
|
72
|
-
Optional<String> nullValue = Optional.absent();
|
73
|
-
QueryConfig config = new QueryConfig("test", nullValue, nullValues, false);
|
74
|
-
config.expand();
|
75
|
-
}
|
76
|
-
|
77
|
-
@Test
|
78
|
-
public void testUnExpandBrace() throws Exception {
|
79
|
-
Optional<List<String>> nullValues = Optional.absent();
|
80
|
-
QueryConfig config = new QueryConfig("test", Optional.of("{awesome1,awesome2,awesome3}"), nullValues, false);
|
81
|
-
List<QueryConfig.Query> dest = config.expand();
|
82
|
-
assertEquals(dest.size(), 1);
|
83
|
-
assertEquals(dest.get(0).getName(), "test");
|
84
|
-
assertEquals(dest.get(0).getValues().length, 1);
|
85
|
-
assertEquals(dest.get(0).getValues()[0], "{awesome1,awesome2,awesome3}");
|
86
|
-
}
|
87
|
-
|
88
|
-
@Test
|
89
|
-
public void testExpandBrace() throws Exception {
|
90
|
-
Optional<List<String>> nullValues = Optional.absent();
|
91
|
-
QueryConfig config = new QueryConfig("test", Optional.of("{awesome1,awesome2,awesome3}"), nullValues, true);
|
92
|
-
List<QueryConfig.Query> dest = config.expand();
|
93
|
-
assertEquals(dest.size(), 3);
|
94
|
-
assertEquals(dest.get(0).getName(), "test");
|
95
|
-
assertEquals(dest.get(0).getValues().length, 1);
|
96
|
-
assertEquals(dest.get(0).getValues()[0], "awesome1");
|
97
|
-
assertEquals(dest.get(1).getName(), "test");
|
98
|
-
|
99
|
-
assertEquals(dest.get(1).getValues().length, 1);
|
100
|
-
assertEquals(dest.get(1).getValues()[0], "awesome2");
|
101
|
-
|
102
|
-
assertEquals(dest.get(2).getValues().length, 1);
|
103
|
-
assertEquals(dest.get(2).getName(), "test");
|
104
|
-
assertEquals(dest.get(2).getValues()[0], "awesome3");
|
105
|
-
}
|
106
|
-
|
107
|
-
@Test
|
108
|
-
public void testExpandEscapedBrace() throws Exception {
|
109
|
-
Optional<List<String>> nullValues = Optional.absent();
|
110
|
-
QueryConfig config = new QueryConfig("test", Optional.of("{awe\\,some1,awes\\{ome2,awes\\}ome3}"), nullValues, true);
|
111
|
-
List<QueryConfig.Query> dest = config.expand();
|
112
|
-
assertEquals(dest.get(0).getName(), "test");
|
113
|
-
assertEquals(dest.get(0).getValues().length, 1);
|
114
|
-
assertEquals(dest.get(0).getValues()[0], "awe,some1");
|
115
|
-
|
116
|
-
assertEquals(dest.get(1).getName(), "test");
|
117
|
-
assertEquals(dest.get(1).getValues().length, 1);
|
118
|
-
assertEquals(dest.get(1).getValues()[0], "awes{ome2");
|
119
|
-
|
120
|
-
assertEquals(dest.get(2).getName(), "test");
|
121
|
-
assertEquals(dest.get(2).getValues().length, 1);
|
122
|
-
assertEquals(dest.get(2).getValues()[0], "awes}ome3");
|
123
|
-
}
|
124
|
-
|
125
|
-
}
|