embulk-input-http 0.0.15 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,11 +7,12 @@ import java.util.List;
7
7
 
8
8
  import static org.junit.Assert.assertEquals;
9
9
 
10
- public class TestPagerConfig {
11
-
10
+ public class TestPagerOption
11
+ {
12
12
  @Test
13
- public void testExpandFromTo() throws Exception {
14
- List<List<QueryConfig.Query>> dest = new PagerConfig("from", Optional.of("to"), Optional.of(1), 3,
13
+ public void testExpandFromTo() throws Exception
14
+ {
15
+ List<List<QueryOption.Query>> dest = new PagerOption("from", Optional.of("to"), Optional.of(1), 3,
15
16
  Optional.of(2)).expand();
16
17
  assertEquals(dest.size(), 3);
17
18
 
@@ -35,10 +36,11 @@ public class TestPagerConfig {
35
36
  }
36
37
 
37
38
  @Test
38
- public void testExpandFromToWithDefault() throws Exception {
39
+ public void testExpandFromToWithDefault() throws Exception
40
+ {
39
41
  Optional<Integer> nullValue = Optional.absent();
40
42
 
41
- List<List<QueryConfig.Query>> dest = new PagerConfig("from", Optional.of("to"), nullValue, 2, nullValue)
43
+ List<List<QueryOption.Query>> dest = new PagerOption("from", Optional.of("to"), nullValue, 2, nullValue)
42
44
  .expand();
43
45
  assertEquals(dest.size(), 2);
44
46
 
@@ -56,9 +58,10 @@ public class TestPagerConfig {
56
58
  }
57
59
 
58
60
  @Test
59
- public void testExpandPagenate() throws Exception {
61
+ public void testExpandPagenate() throws Exception
62
+ {
60
63
  Optional<String> nullValue = Optional.absent();
61
- List<List<QueryConfig.Query>> dest = new PagerConfig("page", nullValue, Optional.of(1), 3,
64
+ List<List<QueryOption.Query>> dest = new PagerOption("page", nullValue, Optional.of(1), 3,
62
65
  Optional.of(1)).expand();
63
66
  assertEquals(dest.size(), 3);
64
67
 
@@ -74,5 +77,4 @@ public class TestPagerConfig {
74
77
  assertEquals(dest.get(2).get(0).getName(), "page");
75
78
  assertEquals(dest.get(2).get(0).getValues()[0], "3");
76
79
  }
77
-
78
80
  }
@@ -8,16 +8,17 @@ import java.util.List;
8
8
 
9
9
  import static org.junit.Assert.assertEquals;
10
10
 
11
- public class TestParamsConfig {
12
-
11
+ public class TestParamsOption
12
+ {
13
13
  @Test
14
- public void testUnexpandQueriesSinglePair() throws Exception {
14
+ public void testUnexpandQueriesSinglePair() throws Exception
15
+ {
15
16
  Optional<List<String>> nullValues = Optional.absent();
16
- QueryConfig q1 = new QueryConfig("test1", Optional.of("awasome1"), nullValues, false);
17
- QueryConfig q2 = new QueryConfig("test2", Optional.of("awasome2"), nullValues, false);
18
- ParamsConfig paramsConfig = new ParamsConfig(Lists.newArrayList(q1, q2));
19
- Optional<PagerConfig> pagerConfig = Optional.absent();
20
- List<List<QueryConfig.Query>> dest = paramsConfig.generateQueries(pagerConfig);
17
+ QueryOption q1 = new QueryOption("test1", Optional.of("awasome1"), nullValues, false);
18
+ QueryOption q2 = new QueryOption("test2", Optional.of("awasome2"), nullValues, false);
19
+ ParamsOption paramsOption = new ParamsOption(Lists.newArrayList(q1, q2));
20
+ Optional<PagerOption> pagerOption = Optional.absent();
21
+ List<List<QueryOption.Query>> dest = paramsOption.generateQueries(pagerOption);
21
22
  assertEquals(dest.size(), 1);
22
23
  assertEquals(dest.get(0).size(), 2);
23
24
  assertEquals(dest.get(0).get(0).getName(), "test1");
@@ -27,17 +28,18 @@ public class TestParamsConfig {
27
28
  }
28
29
 
29
30
  @Test
30
- public void testUnexpandQueriesExpandPair() throws Exception {
31
+ public void testUnexpandQueriesExpandPair() throws Exception
32
+ {
31
33
  Optional<String> nullValue = Optional.absent();
32
34
  List<String> values1 = Lists.newArrayList("a", "b");
33
35
  List<String> values2 = Lists.newArrayList("c", "d");
34
36
 
35
- QueryConfig q1 = new QueryConfig("test1", nullValue, Optional.of(values1), false);
36
- QueryConfig q2 = new QueryConfig("test2", nullValue, Optional.of(values2), false);
37
+ QueryOption q1 = new QueryOption("test1", nullValue, Optional.of(values1), false);
38
+ QueryOption q2 = new QueryOption("test2", nullValue, Optional.of(values2), false);
37
39
 
38
- ParamsConfig paramsConfig = new ParamsConfig(Lists.newArrayList(q1, q2));
39
- Optional<PagerConfig> pagerConfig = Optional.absent();
40
- List<List<QueryConfig.Query>> dest = paramsConfig.generateQueries(pagerConfig);
40
+ ParamsOption paramsOption = new ParamsOption(Lists.newArrayList(q1, q2));
41
+ Optional<PagerOption> pagerOption = Optional.absent();
42
+ List<List<QueryOption.Query>> dest = paramsOption.generateQueries(pagerOption);
41
43
  assertEquals(dest.size(), 1);
42
44
  assertEquals(dest.get(0).size(), 2);
43
45
  assertEquals(dest.get(0).get(0).getName(), "test1");
@@ -49,13 +51,14 @@ public class TestParamsConfig {
49
51
  }
50
52
 
51
53
  @Test
52
- public void testExpandQueriesSinglePair() throws Exception {
54
+ public void testExpandQueriesSinglePair() throws Exception
55
+ {
53
56
  Optional<List<String>> nullValues = Optional.absent();
54
- QueryConfig q1 = new QueryConfig("test1", Optional.of("awasome1"), nullValues, true);
55
- QueryConfig q2 = new QueryConfig("test2", Optional.of("awasome2"), nullValues, true);
56
- ParamsConfig paramsConfig = new ParamsConfig(Lists.newArrayList(q1, q2));
57
- Optional<PagerConfig> pagerConfig = Optional.absent();
58
- List<List<QueryConfig.Query>> dest = paramsConfig.generateQueries(pagerConfig);
57
+ QueryOption q1 = new QueryOption("test1", Optional.of("awasome1"), nullValues, true);
58
+ QueryOption q2 = new QueryOption("test2", Optional.of("awasome2"), nullValues, true);
59
+ ParamsOption paramsOption = new ParamsOption(Lists.newArrayList(q1, q2));
60
+ Optional<PagerOption> pagerOption = Optional.absent();
61
+ List<List<QueryOption.Query>> dest = paramsOption.generateQueries(pagerOption);
59
62
  assertEquals(dest.size(), 1);
60
63
  assertEquals(dest.get(0).size(), 2);
61
64
  assertEquals(dest.get(0).get(0).getName(), "test1");
@@ -65,17 +68,18 @@ public class TestParamsConfig {
65
68
  }
66
69
 
67
70
  @Test
68
- public void testExpandQueriesExpandPair() throws Exception {
71
+ public void testExpandQueriesExpandPair() throws Exception
72
+ {
69
73
  Optional<String> nullValue = Optional.absent();
70
74
  List<String> values1 = Lists.newArrayList("a", "b");
71
75
  List<String> values2 = Lists.newArrayList("c", "d");
72
76
 
73
- QueryConfig q1 = new QueryConfig("test1", nullValue, Optional.of(values1), true);
74
- QueryConfig q2 = new QueryConfig("test2", nullValue, Optional.of(values2), true);
77
+ QueryOption q1 = new QueryOption("test1", nullValue, Optional.of(values1), true);
78
+ QueryOption q2 = new QueryOption("test2", nullValue, Optional.of(values2), true);
75
79
 
76
- ParamsConfig paramsConfig = new ParamsConfig(Lists.newArrayList(q1, q2));
77
- Optional<PagerConfig> pagerConfig = Optional.absent();
78
- List<List<QueryConfig.Query>> dest = paramsConfig.generateQueries(pagerConfig);
80
+ ParamsOption paramsOption = new ParamsOption(Lists.newArrayList(q1, q2));
81
+ Optional<PagerOption> pagerOption = Optional.absent();
82
+ List<List<QueryOption.Query>> dest = paramsOption.generateQueries(pagerOption);
79
83
  assertEquals(dest.size(), 4);
80
84
 
81
85
  assertEquals(dest.get(0).size(), 2);
@@ -102,4 +106,4 @@ public class TestParamsConfig {
102
106
  assertEquals(dest.get(3).get(1).getName(), "test2");
103
107
  assertEquals(dest.get(3).get(1).getValues()[0], "d");
104
108
  }
105
- }
109
+ }
@@ -8,13 +8,14 @@ import java.util.List;
8
8
 
9
9
  import static org.junit.Assert.assertEquals;
10
10
 
11
- public class TestQueryConfig {
12
-
11
+ public class TestQueryOption
12
+ {
13
13
  @Test
14
- public void testUnexpandSingleValue() throws Exception {
14
+ public void testUnexpandSingleValue() throws Exception
15
+ {
15
16
  Optional<List<String>> nullValues = Optional.absent();
16
- QueryConfig config = new QueryConfig("test", Optional.of("awesome"), nullValues, false);
17
- List<QueryConfig.Query> dest = config.expand();
17
+ QueryOption config = new QueryOption("test", Optional.of("awesome"), nullValues, false);
18
+ List<QueryOption.Query> dest = config.expand();
18
19
  assertEquals(dest.size(), 1);
19
20
  assertEquals(dest.get(0).getName(), "test");
20
21
  assertEquals(dest.get(0).getValues().length, 1);
@@ -22,11 +23,12 @@ public class TestQueryConfig {
22
23
  }
23
24
 
24
25
  @Test
25
- public void testUnexpandMultiValue() throws Exception {
26
+ public void testUnexpandMultiValue() throws Exception
27
+ {
26
28
  Optional<String> nullValue = Optional.absent();
27
29
  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
+ QueryOption config = new QueryOption("test", nullValue, Optional.of(values), false);
31
+ List<QueryOption.Query> dest = config.expand();
30
32
  assertEquals(dest.size(), 1);
31
33
  assertEquals(dest.get(0).getName(), "test");
32
34
 
@@ -37,21 +39,23 @@ public class TestQueryConfig {
37
39
  }
38
40
 
39
41
  @Test
40
- public void testExpandSingleValue() throws Exception {
42
+ public void testExpandSingleValue() throws Exception
43
+ {
41
44
  Optional<List<String>> nullValues = Optional.absent();
42
- QueryConfig config = new QueryConfig("test", Optional.of("awesome"), nullValues, true);
43
- List<QueryConfig.Query> dest = config.expand();
45
+ QueryOption config = new QueryOption("test", Optional.of("awesome"), nullValues, true);
46
+ List<QueryOption.Query> dest = config.expand();
44
47
  assertEquals(dest.size(), 1);
45
48
  assertEquals(dest.get(0).getName(), "test");
46
49
  assertEquals(dest.get(0).getValues()[0], "awesome");
47
50
  }
48
51
 
49
52
  @Test
50
- public void testExpandMultiValue() throws Exception {
53
+ public void testExpandMultiValue() throws Exception
54
+ {
51
55
  Optional<String> nullValue = Optional.absent();
52
56
  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();
57
+ QueryOption config = new QueryOption("test", nullValue, Optional.of(values), true);
58
+ List<QueryOption.Query> dest = config.expand();
55
59
  assertEquals(dest.size(), 3);
56
60
  assertEquals(dest.get(0).getName(), "test");
57
61
  assertEquals(dest.get(0).getValues().length, 1);
@@ -67,18 +71,20 @@ public class TestQueryConfig {
67
71
  }
68
72
 
69
73
  @Test(expected = IllegalArgumentException.class)
70
- public void testExpandRaisesExceptionWhenBothValuesAreNull() throws Exception {
74
+ public void testExpandRaisesExceptionWhenBothValuesAreNull() throws Exception
75
+ {
71
76
  Optional<List<String>> nullValues = Optional.absent();
72
77
  Optional<String> nullValue = Optional.absent();
73
- QueryConfig config = new QueryConfig("test", nullValue, nullValues, false);
78
+ QueryOption config = new QueryOption("test", nullValue, nullValues, false);
74
79
  config.expand();
75
80
  }
76
81
 
77
82
  @Test
78
- public void testUnExpandBrace() throws Exception {
83
+ public void testUnExpandBrace() throws Exception
84
+ {
79
85
  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();
86
+ QueryOption config = new QueryOption("test", Optional.of("{awesome1,awesome2,awesome3}"), nullValues, false);
87
+ List<QueryOption.Query> dest = config.expand();
82
88
  assertEquals(dest.size(), 1);
83
89
  assertEquals(dest.get(0).getName(), "test");
84
90
  assertEquals(dest.get(0).getValues().length, 1);
@@ -86,10 +92,11 @@ public class TestQueryConfig {
86
92
  }
87
93
 
88
94
  @Test
89
- public void testExpandBrace() throws Exception {
95
+ public void testExpandBrace() throws Exception
96
+ {
90
97
  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();
98
+ QueryOption config = new QueryOption("test", Optional.of("{awesome1,awesome2,awesome3}"), nullValues, true);
99
+ List<QueryOption.Query> dest = config.expand();
93
100
  assertEquals(dest.size(), 3);
94
101
  assertEquals(dest.get(0).getName(), "test");
95
102
  assertEquals(dest.get(0).getValues().length, 1);
@@ -105,10 +112,11 @@ public class TestQueryConfig {
105
112
  }
106
113
 
107
114
  @Test
108
- public void testExpandEscapedBrace() throws Exception {
115
+ public void testExpandEscapedBrace() throws Exception
116
+ {
109
117
  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();
118
+ QueryOption config = new QueryOption("test", Optional.of("{awe\\,some1,awes\\{ome2,awes\\}ome3}"), nullValues, true);
119
+ List<QueryOption.Query> dest = config.expand();
112
120
  assertEquals(dest.get(0).getName(), "test");
113
121
  assertEquals(dest.get(0).getValues().length, 1);
114
122
  assertEquals(dest.get(0).getValues()[0], "awe,some1");
@@ -121,5 +129,4 @@ public class TestQueryConfig {
121
129
  assertEquals(dest.get(2).getValues().length, 1);
122
130
  assertEquals(dest.get(2).getValues()[0], "awes}ome3");
123
131
  }
124
-
125
- }
132
+ }
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.15
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takuma kanari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-07 00:00:00.000000000 Z
11
+ date: 2017-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -51,6 +51,7 @@ files:
51
51
  - build.gradle
52
52
  - config/checkstyle/checkstyle.xml
53
53
  - config/checkstyle/default.xml
54
+ - embulk-input-http.gemspec
54
55
  - example/json-example.yml
55
56
  - gradle/wrapper/gradle-wrapper.jar
56
57
  - gradle/wrapper/gradle-wrapper.properties
@@ -58,19 +59,20 @@ files:
58
59
  - gradlew.bat
59
60
  - lib/embulk/input/http.rb
60
61
  - settings.gradle
61
- - src/main/java/org/embulk/input/http/BasicAuthConfig.java
62
+ - src/main/java/org/embulk/input/http/BasicAuthOption.java
62
63
  - src/main/java/org/embulk/input/http/HttpFileInputPlugin.java
63
- - src/main/java/org/embulk/input/http/PagerConfig.java
64
- - src/main/java/org/embulk/input/http/ParamsConfig.java
65
- - src/main/java/org/embulk/input/http/QueryConfig.java
64
+ - src/main/java/org/embulk/input/http/PagerOption.java
65
+ - src/main/java/org/embulk/input/http/ParamsOption.java
66
+ - src/main/java/org/embulk/input/http/QueryOption.java
66
67
  - src/main/java/org/embulk/input/http/RetryableHandler.java
67
68
  - src/test/java/org/embulk/input/http/TestHttpInputPlugin.java
68
- - src/test/java/org/embulk/input/http/TestPagerConfig.java
69
- - src/test/java/org/embulk/input/http/TestParamsConfig.java
70
- - src/test/java/org/embulk/input/http/TestQueryConfig.java
69
+ - src/test/java/org/embulk/input/http/TestPagerOption.java
70
+ - src/test/java/org/embulk/input/http/TestParamsOption.java
71
+ - src/test/java/org/embulk/input/http/TestQueryOption.java
71
72
  - classpath/commons-codec-1.9.jar
73
+ - classpath/commons-io-2.5.jar
72
74
  - classpath/commons-logging-1.2.jar
73
- - classpath/embulk-input-http-0.0.15.jar
75
+ - classpath/embulk-input-http-0.0.17.jar
74
76
  - classpath/httpclient-4.5.jar
75
77
  - classpath/httpcore-4.4.1.jar
76
78
  homepage: https://github.com/takumakanari/embulk-input-http
Binary file