embulk-input-http 0.0.20 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,125 +8,120 @@ import java.util.List;
8
8
 
9
9
  import static org.junit.Assert.assertEquals;
10
10
 
11
- public class TestQueryOption
12
- {
13
- @Test
14
- public void testUnexpandSingleValue() throws Exception
15
- {
16
- Optional<List<String>> nullValues = Optional.absent();
17
- QueryOption config = new QueryOption("test", Optional.of("awesome"), nullValues, false);
18
- List<QueryOption.Query> dest = config.expand();
19
- assertEquals(dest.size(), 1);
20
- assertEquals(dest.get(0).getName(), "test");
21
- assertEquals(dest.get(0).getValues().length, 1);
22
- assertEquals(dest.get(0).getValues()[0], "awesome");
23
- }
24
-
25
- @Test
26
- public void testUnexpandMultiValue() throws Exception
27
- {
28
- Optional<String> nullValue = Optional.absent();
29
- List<String> values = Lists.newArrayList("a", "b", "c");
30
- QueryOption config = new QueryOption("test", nullValue, Optional.of(values), false);
31
- List<QueryOption.Query> dest = config.expand();
32
- assertEquals(dest.size(), 1);
33
- assertEquals(dest.get(0).getName(), "test");
34
-
35
- assertEquals(dest.get(0).getValues().length, 3);
36
- assertEquals(dest.get(0).getValues()[0], "a");
37
- assertEquals(dest.get(0).getValues()[1], "b");
38
- assertEquals(dest.get(0).getValues()[2], "c");
39
- }
40
-
41
- @Test
42
- public void testExpandSingleValue() throws Exception
43
- {
44
- Optional<List<String>> nullValues = Optional.absent();
45
- QueryOption config = new QueryOption("test", Optional.of("awesome"), nullValues, true);
46
- List<QueryOption.Query> dest = config.expand();
47
- assertEquals(dest.size(), 1);
48
- assertEquals(dest.get(0).getName(), "test");
49
- assertEquals(dest.get(0).getValues()[0], "awesome");
50
- }
51
-
52
- @Test
53
- public void testExpandMultiValue() throws Exception
54
- {
55
- Optional<String> nullValue = Optional.absent();
56
- List<String> values = Lists.newArrayList("a", "b", "c");
57
- QueryOption config = new QueryOption("test", nullValue, Optional.of(values), true);
58
- List<QueryOption.Query> dest = config.expand();
59
- assertEquals(dest.size(), 3);
60
- assertEquals(dest.get(0).getName(), "test");
61
- assertEquals(dest.get(0).getValues().length, 1);
62
- assertEquals(dest.get(0).getValues()[0], "a");
63
-
64
- assertEquals(dest.get(1).getValues().length, 1);
65
- assertEquals(dest.get(1).getName(), "test");
66
- assertEquals(dest.get(1).getValues()[0], "b");
67
-
68
- assertEquals(dest.get(2).getValues().length, 1);
69
- assertEquals(dest.get(2).getName(), "test");
70
- assertEquals(dest.get(2).getValues()[0], "c");
71
- }
72
-
73
- @Test(expected = IllegalArgumentException.class)
74
- public void testExpandRaisesExceptionWhenBothValuesAreNull() throws Exception
75
- {
76
- Optional<List<String>> nullValues = Optional.absent();
77
- Optional<String> nullValue = Optional.absent();
78
- QueryOption config = new QueryOption("test", nullValue, nullValues, false);
79
- config.expand();
80
- }
81
-
82
- @Test
83
- public void testUnExpandBrace() throws Exception
84
- {
85
- Optional<List<String>> nullValues = Optional.absent();
86
- QueryOption config = new QueryOption("test", Optional.of("{awesome1,awesome2,awesome3}"), nullValues, false);
87
- List<QueryOption.Query> dest = config.expand();
88
- assertEquals(dest.size(), 1);
89
- assertEquals(dest.get(0).getName(), "test");
90
- assertEquals(dest.get(0).getValues().length, 1);
91
- assertEquals(dest.get(0).getValues()[0], "{awesome1,awesome2,awesome3}");
92
- }
93
-
94
- @Test
95
- public void testExpandBrace() throws Exception
96
- {
97
- Optional<List<String>> nullValues = Optional.absent();
98
- QueryOption config = new QueryOption("test", Optional.of("{awesome1,awesome2,awesome3}"), nullValues, true);
99
- List<QueryOption.Query> dest = config.expand();
100
- assertEquals(dest.size(), 3);
101
- assertEquals(dest.get(0).getName(), "test");
102
- assertEquals(dest.get(0).getValues().length, 1);
103
- assertEquals(dest.get(0).getValues()[0], "awesome1");
104
- assertEquals(dest.get(1).getName(), "test");
105
-
106
- assertEquals(dest.get(1).getValues().length, 1);
107
- assertEquals(dest.get(1).getValues()[0], "awesome2");
108
-
109
- assertEquals(dest.get(2).getValues().length, 1);
110
- assertEquals(dest.get(2).getName(), "test");
111
- assertEquals(dest.get(2).getValues()[0], "awesome3");
112
- }
113
-
114
- @Test
115
- public void testExpandEscapedBrace() throws Exception
116
- {
117
- Optional<List<String>> nullValues = Optional.absent();
118
- QueryOption config = new QueryOption("test", Optional.of("{awe\\,some1,awes\\{ome2,awes\\}ome3}"), nullValues, true);
119
- List<QueryOption.Query> dest = config.expand();
120
- assertEquals(dest.get(0).getName(), "test");
121
- assertEquals(dest.get(0).getValues().length, 1);
122
- assertEquals(dest.get(0).getValues()[0], "awe,some1");
123
-
124
- assertEquals(dest.get(1).getName(), "test");
125
- assertEquals(dest.get(1).getValues().length, 1);
126
- assertEquals(dest.get(1).getValues()[0], "awes{ome2");
127
-
128
- assertEquals(dest.get(2).getName(), "test");
129
- assertEquals(dest.get(2).getValues().length, 1);
130
- assertEquals(dest.get(2).getValues()[0], "awes}ome3");
131
- }
11
+ public class TestQueryOption {
12
+ @Test
13
+ public void testUnexpandSingleValue() throws Exception {
14
+ Optional<List<String>> nullValues = Optional.absent();
15
+ QueryOption config = new QueryOption("test", Optional.of("awesome"), nullValues, false);
16
+ List<QueryOption.Query> dest = config.expand();
17
+ assertEquals(dest.size(), 1);
18
+ assertEquals(dest.get(0).getName(), "test");
19
+ assertEquals(dest.get(0).getValues().length, 1);
20
+ assertEquals(dest.get(0).getValues()[0], "awesome");
21
+ }
22
+
23
+ @Test
24
+ public void testUnexpandMultiValue() throws Exception {
25
+ Optional<String> nullValue = Optional.absent();
26
+ List<String> values = Lists.newArrayList("a", "b", "c");
27
+ QueryOption config = new QueryOption("test", nullValue, Optional.of(values), false);
28
+ List<QueryOption.Query> dest = config.expand();
29
+ assertEquals(dest.size(), 1);
30
+ assertEquals(dest.get(0).getName(), "test");
31
+
32
+ assertEquals(dest.get(0).getValues().length, 3);
33
+ assertEquals(dest.get(0).getValues()[0], "a");
34
+ assertEquals(dest.get(0).getValues()[1], "b");
35
+ assertEquals(dest.get(0).getValues()[2], "c");
36
+ }
37
+
38
+ @Test
39
+ public void testExpandSingleValue() throws Exception {
40
+ Optional<List<String>> nullValues = Optional.absent();
41
+ QueryOption config = new QueryOption("test", Optional.of("awesome"), nullValues, true);
42
+ List<QueryOption.Query> dest = config.expand();
43
+ assertEquals(dest.size(), 1);
44
+ assertEquals(dest.get(0).getName(), "test");
45
+ assertEquals(dest.get(0).getValues()[0], "awesome");
46
+ }
47
+
48
+ @Test
49
+ public void testExpandMultiValue() throws Exception {
50
+ Optional<String> nullValue = Optional.absent();
51
+ List<String> values = Lists.newArrayList("a", "b", "c");
52
+ QueryOption config = new QueryOption("test", nullValue, Optional.of(values), true);
53
+ List<QueryOption.Query> dest = config.expand();
54
+ assertEquals(dest.size(), 3);
55
+ assertEquals(dest.get(0).getName(), "test");
56
+ assertEquals(dest.get(0).getValues().length, 1);
57
+ assertEquals(dest.get(0).getValues()[0], "a");
58
+
59
+ assertEquals(dest.get(1).getValues().length, 1);
60
+ assertEquals(dest.get(1).getName(), "test");
61
+ assertEquals(dest.get(1).getValues()[0], "b");
62
+
63
+ assertEquals(dest.get(2).getValues().length, 1);
64
+ assertEquals(dest.get(2).getName(), "test");
65
+ assertEquals(dest.get(2).getValues()[0], "c");
66
+ }
67
+
68
+ @Test(expected = IllegalArgumentException.class)
69
+ public void testExpandRaisesExceptionWhenBothValuesAreNull() throws Exception {
70
+ Optional<List<String>> nullValues = Optional.absent();
71
+ Optional<String> nullValue = Optional.absent();
72
+ QueryOption config = new QueryOption("test", nullValue, nullValues, false);
73
+ config.expand();
74
+ }
75
+
76
+ @Test
77
+ public void testUnExpandBrace() throws Exception {
78
+ Optional<List<String>> nullValues = Optional.absent();
79
+ QueryOption config =
80
+ new QueryOption("test", Optional.of("{awesome1,awesome2,awesome3}"), nullValues, false);
81
+ List<QueryOption.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
+ QueryOption config =
92
+ new QueryOption("test", Optional.of("{awesome1,awesome2,awesome3}"), nullValues, true);
93
+ List<QueryOption.Query> dest = config.expand();
94
+ assertEquals(dest.size(), 3);
95
+ assertEquals(dest.get(0).getName(), "test");
96
+ assertEquals(dest.get(0).getValues().length, 1);
97
+ assertEquals(dest.get(0).getValues()[0], "awesome1");
98
+ assertEquals(dest.get(1).getName(), "test");
99
+
100
+ assertEquals(dest.get(1).getValues().length, 1);
101
+ assertEquals(dest.get(1).getValues()[0], "awesome2");
102
+
103
+ assertEquals(dest.get(2).getValues().length, 1);
104
+ assertEquals(dest.get(2).getName(), "test");
105
+ assertEquals(dest.get(2).getValues()[0], "awesome3");
106
+ }
107
+
108
+ @Test
109
+ public void testExpandEscapedBrace() throws Exception {
110
+ Optional<List<String>> nullValues = Optional.absent();
111
+ QueryOption config =
112
+ new QueryOption(
113
+ "test", Optional.of("{awe\\,some1,awes\\{ome2,awes\\}ome3}"), nullValues, true);
114
+ List<QueryOption.Query> dest = config.expand();
115
+ assertEquals(dest.get(0).getName(), "test");
116
+ assertEquals(dest.get(0).getValues().length, 1);
117
+ assertEquals(dest.get(0).getValues()[0], "awe,some1");
118
+
119
+ assertEquals(dest.get(1).getName(), "test");
120
+ assertEquals(dest.get(1).getValues().length, 1);
121
+ assertEquals(dest.get(1).getValues()[0], "awes{ome2");
122
+
123
+ assertEquals(dest.get(2).getName(), "test");
124
+ assertEquals(dest.get(2).getValues().length, 1);
125
+ assertEquals(dest.get(2).getValues()[0], "awes}ome3");
126
+ }
132
127
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takuma kanari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-21 00:00:00.000000000 Z
11
+ date: 2019-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ files:
53
53
  - classpath/commons-codec-1.10.jar
54
54
  - classpath/commons-io-2.6.jar
55
55
  - classpath/commons-logging-1.2.jar
56
- - classpath/embulk-input-http-0.0.20.jar
56
+ - classpath/embulk-input-http-0.21.0.jar
57
57
  - classpath/httpclient-4.5.5.jar
58
58
  - classpath/httpcore-4.4.9.jar
59
59
  - config/checkstyle/checkstyle.xml