embulk-parser-poi_excel 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fc1f7535c2d5dd180ad60a729c0daccab15144c
4
- data.tar.gz: 2c09c8ffa12e314ff1af31dd0c2bab4c02d00057
3
+ metadata.gz: be106894c6b2167dd2f275cf8696003cc82195c3
4
+ data.tar.gz: c6f3718249f56278a0a29dd50521216765838c51
5
5
  SHA512:
6
- metadata.gz: 0236a3b74bee6392af244631640fd8fe317fa42728a690eecfe4ef11b149fa5c5f9237a334af0d757008aabfff7040c9787fef363b9a84a67c799eff5148e328
7
- data.tar.gz: df386175cd7cbc2be51d70682f21d62581f527c040dfeaeac86def0ddff0b62297d58fcd3920cbd5ae4be636e49ae7ecd3f08de15e28c2930d7b4313140af6bb
6
+ metadata.gz: 6c88d6b4604a07b40681a44290bdf75c7f8c10e6e857da5ed254fe7828fc796e54f84e0f37de1e5c9f0089c934dd91283783b95849180b620cf1180a70d8a419
7
+ data.tar.gz: 772b8d21d4e1587acd97886a79b284a1db42d8a12ac30660a0d2eba9db61292839ceeef39f65d8756e0ee4aea58c7a3c9e3785fcda31c51f01708b116497c6d7
data/README.md CHANGED
@@ -8,6 +8,29 @@ This plugin uses Apache POI.
8
8
  * **Plugin type**: parser
9
9
  * **Guess supported**: no
10
10
 
11
+
12
+ ## Example
13
+
14
+ ```yaml
15
+ in:
16
+ type: any file input plugin type
17
+ parser:
18
+ type: poi_excel
19
+ sheets: ["DQ10-orb"]
20
+ skip_header_lines: 1 # first row is header.
21
+ columns:
22
+ - {name: row, type: long, value: row_number}
23
+ - {name: get_date, type: timestamp, value: cell_value, column_number: A}
24
+ - {name: orb_type, type: string}
25
+ - {name: orb_name, type: string}
26
+ - {name: orb_shape, type: long}
27
+ - {name: drop_monster_name, type: string}
28
+ ```
29
+
30
+ if omit **value**, specified `cell_value`.
31
+ if omit **column_number** when **valus** is `cell_value`, specified next column.
32
+
33
+
11
34
  ## Configuration
12
35
 
13
36
  * **sheets**: sheet name. (list of string, required)
@@ -141,34 +164,11 @@ Options of indivisual sheet.
141
164
  bar: {value: constant.0}
142
165
  ```
143
166
 
144
- *sheet_options* is map of sheet name.
145
- Map values are *skip_header_lines*, *colums*.
146
-
147
- *columns* is map of column name.
148
- Map values are same *columns* in *parser*.
149
-
150
-
151
- ## Example
152
-
153
- ```yaml
154
- in:
155
- type: any file input plugin type
156
- parser:
157
- type: poi_excel
158
- sheets: ["DQ10-orb"]
159
- skip_header_lines: 1 # first row is header.
160
- columns:
161
- - {name: row, type: long, value: row_number}
162
- - {name: get_date, type: timestamp, value: cell_value, column_number: A}
163
- - {name: orb_type, type: string}
164
- - {name: orb_name, type: string}
165
- - {name: orb_shape, type: long}
166
- - {name: drop_monster_name, type: string}
167
- ```
167
+ **sheet_options** is map of sheet name.
168
+ Map values are **skip_header_lines**, **colums**.
168
169
 
169
- if omit `value`, specified `cell_value`.
170
- if omit `column_number` when valus is `cell_value`, specified next column.
171
- if omit `column_number` when valus is `cell_style`, specified same column.
170
+ **columns** is map of column name.
171
+ Map values are same **columns** in **parser** (excluding `name`, `type`).
172
172
 
173
173
 
174
174
  ## Install
data/build.gradle CHANGED
@@ -1,77 +1,80 @@
1
- plugins {
2
- id "com.jfrog.bintray" version "1.1"
3
- id "com.github.jruby-gradle.base" version "0.1.5"
4
- id "java"
5
- id "eclipse"
6
- }
7
- import com.github.jrubygradle.JRubyExec
8
- repositories {
9
- mavenCentral()
10
- jcenter()
11
- }
12
- configurations {
13
- provided
14
- }
15
-
16
- version = "0.1.3"
17
-
18
- dependencies {
19
- compile "org.embulk:embulk-core:0.7.5"
20
- provided "org.embulk:embulk-core:0.7.5"
21
- compile "org.embulk:embulk-standards:0.7.5"
22
- // compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION"
23
- compile group: 'org.apache.poi', name : 'poi', version: '3.13'
24
- compile group: 'org.apache.poi', name : 'poi-ooxml', version: '3.13'
25
- testCompile "junit:junit:4.+"
26
- }
27
-
28
- task classpath(type: Copy, dependsOn: ["jar"]) {
29
- doFirst { file("classpath").deleteDir() }
30
- from (configurations.runtime - configurations.provided + files(jar.archivePath))
31
- into "classpath"
32
- }
33
- clean { delete "classpath" }
34
-
35
- task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
36
- jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
37
- script "${project.name}.gemspec"
38
- doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
39
- }
40
-
41
- task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
42
- jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
43
- script "pkg/${project.name}-${project.version}.gem"
44
- }
45
-
46
- task "package"(dependsOn: ["gemspec", "classpath"]) << {
47
- println "> Build succeeded."
48
- println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
49
- }
50
-
51
- task gemspec {
52
- ext.gemspecFile = file("${project.name}.gemspec")
53
- inputs.file "build.gradle"
54
- outputs.file gemspecFile
55
- doLast { gemspecFile.write($/
56
- Gem::Specification.new do |spec|
57
- spec.name = "${project.name}"
58
- spec.version = "${project.version}"
59
- spec.authors = ["hishidama"]
60
- spec.summary = %[Apache POI Excel parser plugin for Embulk]
61
- spec.description = %[Parses Excel files(xls, xlsx) read by other file input plugins.]
62
- spec.email = ["hishi.dama@asahi.email.ne.jp"]
63
- spec.licenses = ["MIT"]
64
- spec.homepage = "https://github.com/hishidama/embulk-parser-poi_excel"
65
-
66
- spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
67
- spec.test_files = spec.files.grep(%r"^(test|spec)/")
68
- spec.require_paths = ["lib"]
69
-
70
- #spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION']
71
- spec.add_development_dependency 'bundler', ['~> 1.0']
72
- spec.add_development_dependency 'rake', ['>= 10.0']
73
- end
74
- /$)
75
- }
76
- }
77
- clean { delete "${project.name}.gemspec" }
1
+ plugins {
2
+ id "com.jfrog.bintray" version "1.1"
3
+ id "com.github.jruby-gradle.base" version "0.1.5"
4
+ id "java"
5
+ id "eclipse"
6
+ }
7
+ import com.github.jrubygradle.JRubyExec
8
+ repositories {
9
+ mavenCentral()
10
+ jcenter()
11
+ }
12
+ configurations {
13
+ provided
14
+ }
15
+
16
+ version = "0.1.4"
17
+
18
+ sourceCompatibility = 1.7
19
+ targetCompatibility = 1.7
20
+
21
+ dependencies {
22
+ compile "org.embulk:embulk-core:0.7.5"
23
+ provided "org.embulk:embulk-core:0.7.5"
24
+ compile "org.embulk:embulk-standards:0.7.5"
25
+ // compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION"
26
+ compile group: 'org.apache.poi', name : 'poi', version: '3.13'
27
+ compile group: 'org.apache.poi', name : 'poi-ooxml', version: '3.13'
28
+ testCompile "junit:junit:4.+"
29
+ }
30
+
31
+ task classpath(type: Copy, dependsOn: ["jar"]) {
32
+ doFirst { file("classpath").deleteDir() }
33
+ from (configurations.runtime - configurations.provided + files(jar.archivePath))
34
+ into "classpath"
35
+ }
36
+ clean { delete "classpath" }
37
+
38
+ task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
39
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
40
+ script "${project.name}.gemspec"
41
+ doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
42
+ }
43
+
44
+ task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
45
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
46
+ script "pkg/${project.name}-${project.version}.gem"
47
+ }
48
+
49
+ task "package"(dependsOn: ["gemspec", "classpath"]) << {
50
+ println "> Build succeeded."
51
+ println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
52
+ }
53
+
54
+ task gemspec {
55
+ ext.gemspecFile = file("${project.name}.gemspec")
56
+ inputs.file "build.gradle"
57
+ outputs.file gemspecFile
58
+ doLast { gemspecFile.write($/
59
+ Gem::Specification.new do |spec|
60
+ spec.name = "${project.name}"
61
+ spec.version = "${project.version}"
62
+ spec.authors = ["hishidama"]
63
+ spec.summary = %[Apache POI Excel parser plugin for Embulk]
64
+ spec.description = %[Parses Excel files(xls, xlsx) read by other file input plugins.]
65
+ spec.email = ["hishi.dama@asahi.email.ne.jp"]
66
+ spec.licenses = ["MIT"]
67
+ spec.homepage = "https://github.com/hishidama/embulk-parser-poi_excel"
68
+
69
+ spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
70
+ spec.test_files = spec.files.grep(%r"^(test|spec)/")
71
+ spec.require_paths = ["lib"]
72
+
73
+ #spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION']
74
+ spec.add_development_dependency 'bundler', ['~> 1.0']
75
+ spec.add_development_dependency 'rake', ['>= 10.0']
76
+ end
77
+ /$)
78
+ }
79
+ }
80
+ clean { delete "${project.name}.gemspec" }
@@ -124,6 +124,9 @@ public abstract class AbstractPoiExcelCellAttributeVisitor<A> {
124
124
 
125
125
  if (value instanceof Color) {
126
126
  int rgb = PoiExcelColorVisitor.getRGB((Color) value);
127
+ if (rgb < 0) {
128
+ return null;
129
+ }
127
130
  if (column.getType() instanceof StringType) {
128
131
  value = String.format("%06x", rgb);
129
132
  } else {
@@ -74,7 +74,7 @@ public class PoiExcelCellCommentVisitor extends AbstractPoiExcelCellAttributeVis
74
74
  return getClientAnchorValue(column, cell, comment, null);
75
75
  }
76
76
  });
77
- for (String key : PoiExcelClientAnchorVisitor.getKeys()) {
77
+ for (final String key : PoiExcelClientAnchorVisitor.getKeys()) {
78
78
  map.put("client_anchor." + key, new AttributeSupplier<Comment>() {
79
79
  @Override
80
80
  public Object get(Column column, Cell cell, Comment comment) {
@@ -69,6 +69,9 @@ public class PoiExcelColorVisitor {
69
69
  } else if (color instanceof XSSFColor) {
70
70
  XSSFColor xssf = (XSSFColor) color;
71
71
  byte[] b = xssf.getRGB();
72
+ if (b == null) {
73
+ return -1;
74
+ }
72
75
  rgb[0] = b[0] & 0xff;
73
76
  rgb[1] = b[1] & 0xff;
74
77
  rgb[2] = b[2] & 0xff;
@@ -15,12 +15,19 @@ import org.embulk.parser.EmbulkPluginTester;
15
15
  import org.embulk.parser.EmbulkTestOutputPlugin.OutputRecord;
16
16
  import org.embulk.parser.EmbulkTestParserConfig;
17
17
  import org.embulk.spi.time.Timestamp;
18
- import org.junit.Test;
18
+ import org.junit.experimental.theories.DataPoints;
19
+ import org.junit.experimental.theories.Theories;
20
+ import org.junit.experimental.theories.Theory;
21
+ import org.junit.runner.RunWith;
19
22
 
23
+ @RunWith(Theories.class)
20
24
  public class TestPoiExcelParserPlugin {
21
25
 
22
- @Test
23
- public void test1() throws ParseException {
26
+ @DataPoints
27
+ public static String[] FILES = { "test1.xls", "test2.xlsx" };
28
+
29
+ @Theory
30
+ public void test1(String excelFile) throws ParseException {
24
31
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
25
32
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
26
33
 
@@ -34,7 +41,7 @@ public class TestPoiExcelParserPlugin {
34
41
  parser.addColumn("string", "string");
35
42
  parser.addColumn("timestamp", "timestamp").set("format", "%Y/%m/%d");
36
43
 
37
- URL inFile = getClass().getResource("test1.xls");
44
+ URL inFile = getClass().getResource(excelFile);
38
45
  List<OutputRecord> result = tester.runParser(inFile, parser);
39
46
 
40
47
  assertThat(result.size(), is(7));
@@ -67,8 +74,8 @@ public class TestPoiExcelParserPlugin {
67
74
  assertThat(r.getAsTimestamp("timestamp"), is(timestamp));
68
75
  }
69
76
 
70
- @Test
71
- public void testRowNumber() throws ParseException {
77
+ @Theory
78
+ public void testRowNumber(String excelFile) throws ParseException {
72
79
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
73
80
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
74
81
 
@@ -82,7 +89,7 @@ public class TestPoiExcelParserPlugin {
82
89
  parser.addColumn("col-n", "long").set("value", "column_number");
83
90
  parser.addColumn("col-s", "string").set("value", "column_number");
84
91
 
85
- URL inFile = getClass().getResource("test1.xls");
92
+ URL inFile = getClass().getResource(excelFile);
86
93
  List<OutputRecord> result = tester.runParser(inFile, parser);
87
94
 
88
95
  assertThat(result.size(), is(7));
@@ -107,8 +114,8 @@ public class TestPoiExcelParserPlugin {
107
114
  assertThat(r.getAsString("col-s"), is("A"));
108
115
  }
109
116
 
110
- @Test
111
- public void testForumlaReplace() throws ParseException {
117
+ @Theory
118
+ public void testForumlaReplace(String excelFile) throws ParseException {
112
119
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
113
120
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
114
121
 
@@ -125,7 +132,7 @@ public class TestPoiExcelParserPlugin {
125
132
 
126
133
  parser.addColumn("text", "string");
127
134
 
128
- URL inFile = getClass().getResource("test1.xls");
135
+ URL inFile = getClass().getResource(excelFile);
129
136
  List<OutputRecord> result = tester.runParser(inFile, parser);
130
137
 
131
138
  assertThat(result.size(), is(2));
@@ -134,8 +141,8 @@ public class TestPoiExcelParserPlugin {
134
141
  }
135
142
  }
136
143
 
137
- @Test
138
- public void testSearchMergedCell_true() throws ParseException {
144
+ @Theory
145
+ public void testSearchMergedCell_true(String excelFile) throws ParseException {
139
146
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
140
147
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
141
148
 
@@ -144,7 +151,7 @@ public class TestPoiExcelParserPlugin {
144
151
  parser.addColumn("a", "string");
145
152
  parser.addColumn("b", "string");
146
153
 
147
- URL inFile = getClass().getResource("test1.xls");
154
+ URL inFile = getClass().getResource(excelFile);
148
155
  List<OutputRecord> result = tester.runParser(inFile, parser);
149
156
 
150
157
  assertThat(result.size(), is(4));
@@ -155,8 +162,8 @@ public class TestPoiExcelParserPlugin {
155
162
  }
156
163
  }
157
164
 
158
- @Test
159
- public void testSearchMergedCell_false() throws ParseException {
165
+ @Theory
166
+ public void testSearchMergedCell_false(String excelFile) throws ParseException {
160
167
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
161
168
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
162
169
 
@@ -166,7 +173,7 @@ public class TestPoiExcelParserPlugin {
166
173
  parser.addColumn("a", "string");
167
174
  parser.addColumn("b", "string");
168
175
 
169
- URL inFile = getClass().getResource("test1.xls");
176
+ URL inFile = getClass().getResource(excelFile);
170
177
  List<OutputRecord> result = tester.runParser(inFile, parser);
171
178
 
172
179
  assertThat(result.size(), is(4));
@@ -184,8 +191,8 @@ public class TestPoiExcelParserPlugin {
184
191
  assertThat(r.getAsString("b"), is(b));
185
192
  }
186
193
 
187
- @Test
188
- public void test_sheets() throws ParseException {
194
+ @Theory
195
+ public void test_sheets(String excelFile) throws ParseException {
189
196
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
190
197
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
191
198
 
@@ -193,7 +200,7 @@ public class TestPoiExcelParserPlugin {
193
200
  parser.set("sheets", Arrays.asList("formula_replace", "merged_cell"));
194
201
  parser.addColumn("a", "string");
195
202
 
196
- URL inFile = getClass().getResource("test1.xls");
203
+ URL inFile = getClass().getResource(excelFile);
197
204
  List<OutputRecord> result = tester.runParser(inFile, parser);
198
205
 
199
206
  assertThat(result.size(), is(2 + 4));
@@ -13,12 +13,19 @@ import java.util.List;
13
13
  import org.embulk.parser.EmbulkPluginTester;
14
14
  import org.embulk.parser.EmbulkTestOutputPlugin.OutputRecord;
15
15
  import org.embulk.parser.EmbulkTestParserConfig;
16
- import org.junit.Test;
16
+ import org.junit.experimental.theories.DataPoints;
17
+ import org.junit.experimental.theories.Theories;
18
+ import org.junit.experimental.theories.Theory;
19
+ import org.junit.runner.RunWith;
17
20
 
21
+ @RunWith(Theories.class)
18
22
  public class TestPoiExcelParserPlugin_cellComment {
19
23
 
20
- @Test
21
- public void testComment_key() throws ParseException {
24
+ @DataPoints
25
+ public static String[] FILES = { "test1.xls", "test2.xlsx" };
26
+
27
+ @Theory
28
+ public void testComment_key(String excelFile) throws ParseException {
22
29
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
23
30
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
24
31
 
@@ -27,7 +34,7 @@ public class TestPoiExcelParserPlugin_cellComment {
27
34
  parser.addColumn("author", "string").set("value", "cell_comment.author");
28
35
  parser.addColumn("comment", "string").set("value", "cell_comment.string");
29
36
 
30
- URL inFile = getClass().getResource("test1.xls");
37
+ URL inFile = getClass().getResource(excelFile);
31
38
  List<OutputRecord> result = tester.runParser(inFile, parser);
32
39
 
33
40
  assertThat(result.size(), is(2));
@@ -43,8 +50,8 @@ public class TestPoiExcelParserPlugin_cellComment {
43
50
  assertThat(record.getAsString("author"), is(author));
44
51
  }
45
52
 
46
- @Test
47
- public void testComment_all() throws ParseException {
53
+ @Theory
54
+ public void testComment_all(String excelFile) throws ParseException {
48
55
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
49
56
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
50
57
 
@@ -52,7 +59,7 @@ public class TestPoiExcelParserPlugin_cellComment {
52
59
  parser.set("sheet", "comment");
53
60
  parser.addColumn("comment", "string").set("value", "cell_comment");
54
61
 
55
- URL inFile = getClass().getResource("test1.xls");
62
+ URL inFile = getClass().getResource(excelFile);
56
63
  List<OutputRecord> result = tester.runParser(inFile, parser);
57
64
 
58
65
  assertThat(result.size(), is(2));
@@ -78,8 +85,8 @@ public class TestPoiExcelParserPlugin_cellComment {
78
85
  }
79
86
  }
80
87
 
81
- @Test
82
- public void testComment_keys() throws ParseException {
88
+ @Theory
89
+ public void testComment_keys(String excelFile) throws ParseException {
83
90
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
84
91
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
85
92
 
@@ -88,7 +95,7 @@ public class TestPoiExcelParserPlugin_cellComment {
88
95
  parser.addColumn("comment", "string").set("value", "cell_comment")
89
96
  .set("attribute_name", Arrays.asList("author", "string"));
90
97
 
91
- URL inFile = getClass().getResource("test1.xls");
98
+ URL inFile = getClass().getResource(excelFile);
92
99
  List<OutputRecord> result = tester.runParser(inFile, parser);
93
100
 
94
101
  assertThat(result.size(), is(2));
@@ -14,12 +14,19 @@ import org.embulk.parser.EmbulkPluginTester;
14
14
  import org.embulk.parser.EmbulkTestOutputPlugin.OutputRecord;
15
15
  import org.embulk.parser.EmbulkTestParserConfig;
16
16
  import org.embulk.spi.time.Timestamp;
17
- import org.junit.Test;
17
+ import org.junit.experimental.theories.DataPoints;
18
+ import org.junit.experimental.theories.Theories;
19
+ import org.junit.experimental.theories.Theory;
20
+ import org.junit.runner.RunWith;
18
21
 
22
+ @RunWith(Theories.class)
19
23
  public class TestPoiExcelParserPlugin_cellError {
20
24
 
21
- @Test
22
- public void testCellError_default() throws Exception {
25
+ @DataPoints
26
+ public static String[] FILES = { "test1.xls", "test2.xlsx" };
27
+
28
+ @Theory
29
+ public void testCellError_default(String excelFile) throws Exception {
23
30
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
24
31
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
25
32
 
@@ -32,7 +39,7 @@ public class TestPoiExcelParserPlugin_cellError {
32
39
  parser.addColumn("s", "string").set("column_number", "A");
33
40
  parser.addColumn("t", "timestamp").set("column_number", "A");
34
41
 
35
- URL inFile = getClass().getResource("test1.xls");
42
+ URL inFile = getClass().getResource(excelFile);
36
43
  List<OutputRecord> result = tester.runParser(inFile, parser);
37
44
 
38
45
  assertThat(result.size(), is(1));
@@ -45,8 +52,8 @@ public class TestPoiExcelParserPlugin_cellError {
45
52
  }
46
53
  }
47
54
 
48
- @Test
49
- public void testCellError_code() throws Exception {
55
+ @Theory
56
+ public void testCellError_code(String excelFile) throws Exception {
50
57
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
51
58
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
52
59
 
@@ -59,7 +66,7 @@ public class TestPoiExcelParserPlugin_cellError {
59
66
  parser.addColumn("d", "double").set("column_number", "A");
60
67
  parser.addColumn("s", "string").set("column_number", "A");
61
68
 
62
- URL inFile = getClass().getResource("test1.xls");
69
+ URL inFile = getClass().getResource(excelFile);
63
70
  List<OutputRecord> result = tester.runParser(inFile, parser);
64
71
 
65
72
  OutputRecord r = result.get(0);
@@ -70,8 +77,8 @@ public class TestPoiExcelParserPlugin_cellError {
70
77
  }
71
78
  }
72
79
 
73
- @Test
74
- public void testCellError_null() throws Exception {
80
+ @Theory
81
+ public void testCellError_null(String excelFile) throws Exception {
75
82
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
76
83
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
77
84
 
@@ -85,7 +92,7 @@ public class TestPoiExcelParserPlugin_cellError {
85
92
  parser.addColumn("s", "string").set("column_number", "A");
86
93
  parser.addColumn("t", "timestamp").set("column_number", "A");
87
94
 
88
- URL inFile = getClass().getResource("test1.xls");
95
+ URL inFile = getClass().getResource(excelFile);
89
96
  List<OutputRecord> result = tester.runParser(inFile, parser);
90
97
 
91
98
  assertThat(result.size(), is(1));
@@ -98,8 +105,8 @@ public class TestPoiExcelParserPlugin_cellError {
98
105
  }
99
106
  }
100
107
 
101
- @Test
102
- public void testCellError_empty() throws Exception {
108
+ @Theory
109
+ public void testCellError_empty(String excelFile) throws Exception {
103
110
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
104
111
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
105
112
 
@@ -112,7 +119,7 @@ public class TestPoiExcelParserPlugin_cellError {
112
119
  parser.addColumn("s3", "string").set("column_number", "A").set("on_cell_error", "constant.");
113
120
  parser.addColumn("s4", "string").set("column_number", "A").set("on_cell_error", "constant. ");
114
121
 
115
- URL inFile = getClass().getResource("test1.xls");
122
+ URL inFile = getClass().getResource(excelFile);
116
123
  List<OutputRecord> result = tester.runParser(inFile, parser);
117
124
 
118
125
  assertThat(result.size(), is(1));
@@ -124,8 +131,8 @@ public class TestPoiExcelParserPlugin_cellError {
124
131
  }
125
132
  }
126
133
 
127
- @Test
128
- public void testCellError_constant() throws Exception {
134
+ @Theory
135
+ public void testCellError_constant(String excelFile) throws Exception {
129
136
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
130
137
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
131
138
 
@@ -140,7 +147,7 @@ public class TestPoiExcelParserPlugin_cellError {
140
147
  parser.addColumn("t", "timestamp").set("column_number", "A").set("format", "%Y/%m/%d")
141
148
  .set("on_cell_error", "constant.2000/1/1");
142
149
 
143
- URL inFile = getClass().getResource("test1.xls");
150
+ URL inFile = getClass().getResource(excelFile);
144
151
  List<OutputRecord> result = tester.runParser(inFile, parser);
145
152
 
146
153
  OutputRecord r = result.get(0);
@@ -153,8 +160,8 @@ public class TestPoiExcelParserPlugin_cellError {
153
160
  }
154
161
  }
155
162
 
156
- @Test
157
- public void testCellError_exception() throws Exception {
163
+ @Theory
164
+ public void testCellError_exception(String excelFile) throws Exception {
158
165
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
159
166
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
160
167
 
@@ -168,7 +175,7 @@ public class TestPoiExcelParserPlugin_cellError {
168
175
  parser.addColumn("s", "string").set("column_number", "A");
169
176
  parser.addColumn("t", "timestamp").set("column_number", "A");
170
177
 
171
- URL inFile = getClass().getResource("test1.xls");
178
+ URL inFile = getClass().getResource(excelFile);
172
179
  try {
173
180
  tester.runParser(inFile, parser);
174
181
  } catch (Exception e) {
@@ -13,12 +13,19 @@ import java.util.List;
13
13
  import org.embulk.parser.EmbulkPluginTester;
14
14
  import org.embulk.parser.EmbulkTestOutputPlugin.OutputRecord;
15
15
  import org.embulk.parser.EmbulkTestParserConfig;
16
- import org.junit.Test;
16
+ import org.junit.experimental.theories.DataPoints;
17
+ import org.junit.experimental.theories.Theories;
18
+ import org.junit.experimental.theories.Theory;
19
+ import org.junit.runner.RunWith;
17
20
 
21
+ @RunWith(Theories.class)
18
22
  public class TestPoiExcelParserPlugin_cellFont {
19
23
 
20
- @Test
21
- public void testFont_key() throws ParseException {
24
+ @DataPoints
25
+ public static String[] FILES = { "test1.xls", "test2.xlsx" };
26
+
27
+ @Theory
28
+ public void testFont_key(String excelFile) throws ParseException {
22
29
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
23
30
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
24
31
 
@@ -28,7 +35,7 @@ public class TestPoiExcelParserPlugin_cellFont {
28
35
  parser.addColumn("font-color", "long").set("column_number", "C").set("value", "cell_font.color");
29
36
  parser.addColumn("font-bold", "boolean").set("value", "cell_font.bold");
30
37
 
31
- URL inFile = getClass().getResource("test1.xls");
38
+ URL inFile = getClass().getResource(excelFile);
32
39
  List<OutputRecord> result = tester.runParser(inFile, parser);
33
40
 
34
41
  assertThat(result.size(), is(5));
@@ -48,8 +55,8 @@ public class TestPoiExcelParserPlugin_cellFont {
48
55
  assertThat(record.getAsBoolean("font-bold"), is(fontBold));
49
56
  }
50
57
 
51
- @Test
52
- public void testFont_all() throws ParseException {
58
+ @Theory
59
+ public void testFont_all(String excelFile) throws ParseException {
53
60
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
54
61
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
55
62
 
@@ -58,7 +65,7 @@ public class TestPoiExcelParserPlugin_cellFont {
58
65
  parser.addColumn("color-text", "string");
59
66
  parser.addColumn("color-font", "string").set("column_number", "C").set("value", "cell_font");
60
67
 
61
- URL inFile = getClass().getResource("test1.xls");
68
+ URL inFile = getClass().getResource(excelFile);
62
69
  List<OutputRecord> result = tester.runParser(inFile, parser);
63
70
 
64
71
  assertThat(result.size(), is(5));
@@ -100,8 +107,8 @@ public class TestPoiExcelParserPlugin_cellFont {
100
107
  }
101
108
  }
102
109
 
103
- @Test
104
- public void testFont_keys() throws ParseException {
110
+ @Theory
111
+ public void testFont_keys(String excelFile) throws ParseException {
105
112
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
106
113
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
107
114
 
@@ -111,7 +118,7 @@ public class TestPoiExcelParserPlugin_cellFont {
111
118
  parser.addColumn("color-font", "string").set("column_number", "C").set("value", "cell_font")
112
119
  .set("attribute_name", Arrays.asList("color", "bold"));
113
120
 
114
- URL inFile = getClass().getResource("test1.xls");
121
+ URL inFile = getClass().getResource(excelFile);
115
122
  List<OutputRecord> result = tester.runParser(inFile, parser);
116
123
 
117
124
  assertThat(result.size(), is(5));
@@ -1,7 +1,8 @@
1
1
  package org.embulk.parser.poi_excel;
2
2
 
3
- import static org.hamcrest.CoreMatchers.*;
4
- import static org.junit.Assert.*;
3
+ import static org.hamcrest.CoreMatchers.is;
4
+ import static org.junit.Assert.assertThat;
5
+ import static org.junit.Assert.fail;
5
6
 
6
7
  import java.net.URL;
7
8
  import java.text.ParseException;
@@ -12,12 +13,19 @@ import org.apache.poi.ss.usermodel.CellStyle;
12
13
  import org.embulk.parser.EmbulkPluginTester;
13
14
  import org.embulk.parser.EmbulkTestOutputPlugin.OutputRecord;
14
15
  import org.embulk.parser.EmbulkTestParserConfig;
15
- import org.junit.Test;
16
+ import org.junit.experimental.theories.DataPoints;
17
+ import org.junit.experimental.theories.Theories;
18
+ import org.junit.experimental.theories.Theory;
19
+ import org.junit.runner.RunWith;
16
20
 
21
+ @RunWith(Theories.class)
17
22
  public class TestPoiExcelParserPlugin_cellStyle {
18
23
 
19
- @Test
20
- public void testStyle_key() throws ParseException {
24
+ @DataPoints
25
+ public static String[] FILES = { "test1.xls", "test2.xlsx" };
26
+
27
+ @Theory
28
+ public void testStyle_key(String excelFile) throws ParseException {
21
29
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
22
30
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
23
31
 
@@ -32,7 +40,7 @@ public class TestPoiExcelParserPlugin_cellStyle {
32
40
  parser.addColumn("border-right", "long").set("value", "cell_style.border_right");
33
41
  parser.addColumn("border-all", "long").set("value", "cell_style.border");
34
42
 
35
- URL inFile = getClass().getResource("test1.xls");
43
+ URL inFile = getClass().getResource(excelFile);
36
44
  List<OutputRecord> result = tester.runParser(inFile, parser);
37
45
 
38
46
  assertThat(result.size(), is(5));
@@ -58,8 +66,8 @@ public class TestPoiExcelParserPlugin_cellStyle {
58
66
  assertThat(record.getAsLong("border-all"), is(top << 24 | bottom << 16 | left << 8 | right));
59
67
  }
60
68
 
61
- @Test
62
- public void testStyle_all() throws ParseException {
69
+ @Theory
70
+ public void testStyle_all(String excelFile) throws ParseException {
63
71
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
64
72
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
65
73
 
@@ -69,7 +77,7 @@ public class TestPoiExcelParserPlugin_cellStyle {
69
77
  parser.addColumn("color-style", "string").set("column_number", "A").set("value", "cell_style");
70
78
  parser.addColumn("border-style", "string").set("column_number", "B").set("value", "cell_style");
71
79
 
72
- URL inFile = getClass().getResource("test1.xls");
80
+ URL inFile = getClass().getResource(excelFile);
73
81
  List<OutputRecord> result = tester.runParser(inFile, parser);
74
82
 
75
83
  assertThat(result.size(), is(5));
@@ -105,8 +113,8 @@ public class TestPoiExcelParserPlugin_cellStyle {
105
113
  }
106
114
  }
107
115
 
108
- @Test
109
- public void testStyle_keys() throws ParseException {
116
+ @Theory
117
+ public void testStyle_keys(String excelFile) throws ParseException {
110
118
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
111
119
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
112
120
 
@@ -118,7 +126,7 @@ public class TestPoiExcelParserPlugin_cellStyle {
118
126
  parser.addColumn("border-style", "string").set("column_number", "B").set("value", "cell_style")
119
127
  .set("attribute_name", Arrays.asList("border_top", "border_bottom", "border_left", "border_right"));
120
128
 
121
- URL inFile = getClass().getResource("test1.xls");
129
+ URL inFile = getClass().getResource(excelFile);
122
130
  List<OutputRecord> result = tester.runParser(inFile, parser);
123
131
 
124
132
  assertThat(result.size(), is(5));
@@ -11,12 +11,19 @@ import java.util.List;
11
11
  import org.embulk.parser.EmbulkPluginTester;
12
12
  import org.embulk.parser.EmbulkTestOutputPlugin.OutputRecord;
13
13
  import org.embulk.parser.EmbulkTestParserConfig;
14
- import org.junit.Test;
14
+ import org.junit.experimental.theories.DataPoints;
15
+ import org.junit.experimental.theories.Theories;
16
+ import org.junit.experimental.theories.Theory;
17
+ import org.junit.runner.RunWith;
15
18
 
19
+ @RunWith(Theories.class)
16
20
  public class TestPoiExcelParserPlugin_columnNumber {
17
21
 
18
- @Test
19
- public void testColumnNumber_string() throws Exception {
22
+ @DataPoints
23
+ public static String[] FILES = { "test1.xls", "test2.xlsx" };
24
+
25
+ @Theory
26
+ public void testColumnNumber_string(String excelFile) throws Exception {
20
27
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
21
28
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
22
29
 
@@ -25,7 +32,7 @@ public class TestPoiExcelParserPlugin_columnNumber {
25
32
  parser.set("skip_header_lines", 1);
26
33
  parser.addColumn("text", "string").set("column_number", "D");
27
34
 
28
- URL inFile = getClass().getResource("test1.xls");
35
+ URL inFile = getClass().getResource(excelFile);
29
36
  List<OutputRecord> result = tester.runParser(inFile, parser);
30
37
 
31
38
  assertThat(result.size(), is(7));
@@ -39,8 +46,8 @@ public class TestPoiExcelParserPlugin_columnNumber {
39
46
  }
40
47
  }
41
48
 
42
- @Test
43
- public void testColumnNumber_int() throws Exception {
49
+ @Theory
50
+ public void testColumnNumber_int(String excelFile) throws Exception {
44
51
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
45
52
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
46
53
 
@@ -50,7 +57,7 @@ public class TestPoiExcelParserPlugin_columnNumber {
50
57
  parser.addColumn("long", "long").set("column_number", 2);
51
58
  parser.addColumn("double", "double");
52
59
 
53
- URL inFile = getClass().getResource("test1.xls");
60
+ URL inFile = getClass().getResource(excelFile);
54
61
  List<OutputRecord> result = tester.runParser(inFile, parser);
55
62
 
56
63
  assertThat(result.size(), is(7));
@@ -71,8 +78,8 @@ public class TestPoiExcelParserPlugin_columnNumber {
71
78
  assertThat(r.getAsDouble("double"), is(d));
72
79
  }
73
80
 
74
- @Test
75
- public void testColumnNumber_move() throws Exception {
81
+ @Theory
82
+ public void testColumnNumber_move(String excelFile) throws Exception {
76
83
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
77
84
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
78
85
 
@@ -85,7 +92,7 @@ public class TestPoiExcelParserPlugin_columnNumber {
85
92
  parser.addColumn("double2", "double").set("column_number", "=");
86
93
  parser.addColumn("long3", "long").set("column_number", "-");
87
94
 
88
- URL inFile = getClass().getResource("test1.xls");
95
+ URL inFile = getClass().getResource(excelFile);
89
96
  List<OutputRecord> result = tester.runParser(inFile, parser);
90
97
 
91
98
  assertThat(result.size(), is(7));
@@ -109,8 +116,8 @@ public class TestPoiExcelParserPlugin_columnNumber {
109
116
  assertThat(r.getAsDouble("double2"), is(d));
110
117
  }
111
118
 
112
- @Test
113
- public void testColumnNumber_move2() throws Exception {
119
+ @Theory
120
+ public void testColumnNumber_move2(String excelFile) throws Exception {
114
121
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
115
122
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
116
123
 
@@ -123,7 +130,7 @@ public class TestPoiExcelParserPlugin_columnNumber {
123
130
  parser.addColumn("string2", "string").set("column_number", "=string1");
124
131
  parser.addColumn("long3", "long").set("column_number", "-2");
125
132
 
126
- URL inFile = getClass().getResource("test1.xls");
133
+ URL inFile = getClass().getResource(excelFile);
127
134
  List<OutputRecord> result = tester.runParser(inFile, parser);
128
135
 
129
136
  assertThat(result.size(), is(7));
@@ -147,8 +154,8 @@ public class TestPoiExcelParserPlugin_columnNumber {
147
154
  assertThat(r.getAsString("string2"), is(s));
148
155
  }
149
156
 
150
- @Test
151
- public void testColumnNumber_moveName() throws Exception {
157
+ @Theory
158
+ public void testColumnNumber_moveName(String excelFile) throws Exception {
152
159
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
153
160
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
154
161
 
@@ -160,7 +167,7 @@ public class TestPoiExcelParserPlugin_columnNumber {
160
167
  parser.addColumn("long2", "long").set("column_number", "=long1");
161
168
  parser.addColumn("boolean1", "boolean").set("column_number", "-long1");
162
169
 
163
- URL inFile = getClass().getResource("test1.xls");
170
+ URL inFile = getClass().getResource(excelFile);
164
171
  List<OutputRecord> result = tester.runParser(inFile, parser);
165
172
 
166
173
  assertThat(result.size(), is(7));
@@ -11,12 +11,19 @@ import java.util.List;
11
11
  import org.embulk.parser.EmbulkPluginTester;
12
12
  import org.embulk.parser.EmbulkTestOutputPlugin.OutputRecord;
13
13
  import org.embulk.parser.EmbulkTestParserConfig;
14
- import org.junit.Test;
14
+ import org.junit.experimental.theories.DataPoints;
15
+ import org.junit.experimental.theories.Theories;
16
+ import org.junit.experimental.theories.Theory;
17
+ import org.junit.runner.RunWith;
15
18
 
19
+ @RunWith(Theories.class)
16
20
  public class TestPoiExcelParserPlugin_constant {
17
21
 
18
- @Test
19
- public void testConstant() throws Exception {
22
+ @DataPoints
23
+ public static String[] FILES = { "test1.xls", "test2.xlsx" };
24
+
25
+ @Theory
26
+ public void testConstant(String excelFile) throws Exception {
20
27
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
21
28
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
22
29
 
@@ -29,7 +36,7 @@ public class TestPoiExcelParserPlugin_constant {
29
36
  parser.addColumn("null", "string").set("value", "constant");
30
37
  parser.addColumn("cell", "string");
31
38
 
32
- URL inFile = getClass().getResource("test1.xls");
39
+ URL inFile = getClass().getResource(excelFile);
33
40
  List<OutputRecord> result = tester.runParser(inFile, parser);
34
41
 
35
42
  assertThat(result.size(), is(5));
@@ -13,12 +13,19 @@ import org.embulk.parser.EmbulkPluginTester;
13
13
  import org.embulk.parser.EmbulkTestOutputPlugin.OutputRecord;
14
14
  import org.embulk.parser.EmbulkTestParserConfig;
15
15
  import org.embulk.spi.time.Timestamp;
16
- import org.junit.Test;
16
+ import org.junit.experimental.theories.DataPoints;
17
+ import org.junit.experimental.theories.Theories;
18
+ import org.junit.experimental.theories.Theory;
19
+ import org.junit.runner.RunWith;
17
20
 
21
+ @RunWith(Theories.class)
18
22
  public class TestPoiExcelParserPlugin_convertError {
19
23
 
20
- @Test
21
- public void testConvertError_default() throws Exception {
24
+ @DataPoints
25
+ public static String[] FILES = { "test1.xls", "test2.xlsx" };
26
+
27
+ @Theory
28
+ public void testConvertError_default(String excelFile) throws Exception {
22
29
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
23
30
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
24
31
 
@@ -26,7 +33,7 @@ public class TestPoiExcelParserPlugin_convertError {
26
33
  parser.set("sheet", "style");
27
34
  parser.addColumn("t", "timestamp").set("column_number", "A");
28
35
 
29
- URL inFile = getClass().getResource("test1.xls");
36
+ URL inFile = getClass().getResource(excelFile);
30
37
  try {
31
38
  tester.runParser(inFile, parser);
32
39
  } catch (Exception e) {
@@ -40,8 +47,8 @@ public class TestPoiExcelParserPlugin_convertError {
40
47
  }
41
48
  }
42
49
 
43
- @Test
44
- public void testConvertError_exception() throws Exception {
50
+ @Theory
51
+ public void testConvertError_exception(String excelFile) throws Exception {
45
52
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
46
53
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
47
54
 
@@ -50,7 +57,7 @@ public class TestPoiExcelParserPlugin_convertError {
50
57
  parser.set("on_convert_error", "exception");
51
58
  parser.addColumn("t", "timestamp").set("column_number", "A");
52
59
 
53
- URL inFile = getClass().getResource("test1.xls");
60
+ URL inFile = getClass().getResource(excelFile);
54
61
  try {
55
62
  tester.runParser(inFile, parser);
56
63
  } catch (Exception e) {
@@ -64,8 +71,8 @@ public class TestPoiExcelParserPlugin_convertError {
64
71
  }
65
72
  }
66
73
 
67
- @Test
68
- public void testConvertError_null() throws Exception {
74
+ @Theory
75
+ public void testConvertError_null(String excelFile) throws Exception {
69
76
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
70
77
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
71
78
 
@@ -74,7 +81,7 @@ public class TestPoiExcelParserPlugin_convertError {
74
81
  parser.set("on_convert_error", "constant");
75
82
  parser.addColumn("t", "timestamp").set("column_number", "A");
76
83
 
77
- URL inFile = getClass().getResource("test1.xls");
84
+ URL inFile = getClass().getResource(excelFile);
78
85
  List<OutputRecord> result = tester.runParser(inFile, parser);
79
86
 
80
87
  assertThat(result.size(), is(2));
@@ -83,8 +90,8 @@ public class TestPoiExcelParserPlugin_convertError {
83
90
  }
84
91
  }
85
92
 
86
- @Test
87
- public void testConvertError_constant() throws Exception {
93
+ @Theory
94
+ public void testConvertError_constant(String excelFile) throws Exception {
88
95
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
89
96
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
90
97
 
@@ -97,7 +104,7 @@ public class TestPoiExcelParserPlugin_convertError {
97
104
  parser.addColumn("t", "timestamp").set("column_number", "A").set("format", "%Y/%m/%d")
98
105
  .set("on_convert_error", "constant.2000/1/1");
99
106
 
100
- URL inFile = getClass().getResource("test1.xls");
107
+ URL inFile = getClass().getResource(excelFile);
101
108
  List<OutputRecord> result = tester.runParser(inFile, parser);
102
109
 
103
110
  assertThat(result.size(), is(2));
@@ -13,12 +13,19 @@ import java.util.Map;
13
13
  import org.embulk.parser.EmbulkPluginTester;
14
14
  import org.embulk.parser.EmbulkTestOutputPlugin.OutputRecord;
15
15
  import org.embulk.parser.EmbulkTestParserConfig;
16
- import org.junit.Test;
16
+ import org.junit.experimental.theories.DataPoints;
17
+ import org.junit.experimental.theories.Theories;
18
+ import org.junit.experimental.theories.Theory;
19
+ import org.junit.runner.RunWith;
17
20
 
21
+ @RunWith(Theories.class)
18
22
  public class TestPoiExcelParserPlugin_sheets {
19
23
 
20
- @Test
21
- public void testSheets() throws ParseException {
24
+ @DataPoints
25
+ public static String[] FILES = { "test1.xls", "test2.xlsx" };
26
+
27
+ @Theory
28
+ public void testSheets(String excelFile) throws ParseException {
22
29
  try (EmbulkPluginTester tester = new EmbulkPluginTester()) {
23
30
  tester.addParserPlugin(PoiExcelParserPlugin.TYPE, PoiExcelParserPlugin.class);
24
31
 
@@ -55,7 +62,7 @@ public class TestPoiExcelParserPlugin_sheets {
55
62
  }
56
63
  parser.set("sheet_options", sheetOptions);
57
64
 
58
- URL inFile = getClass().getResource("test1.xls");
65
+ URL inFile = getClass().getResource(excelFile);
59
66
  List<OutputRecord> result = tester.runParser(inFile, parser);
60
67
 
61
68
  assertThat(result.size(), is(8));
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-parser-poi_excel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - hishidama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-24 00:00:00.000000000 Z
11
+ date: 2015-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -90,8 +90,9 @@ files:
90
90
  - src/test/java/org/embulk/parser/poi_excel/TestPoiExcelParserPlugin_convertError.java
91
91
  - src/test/java/org/embulk/parser/poi_excel/TestPoiExcelParserPlugin_sheets.java
92
92
  - src/test/resources/org/embulk/parser/poi_excel/test1.xls
93
+ - src/test/resources/org/embulk/parser/poi_excel/test2.xlsx
93
94
  - classpath/commons-codec-1.9.jar
94
- - classpath/embulk-parser-poi_excel-0.1.3.jar
95
+ - classpath/embulk-parser-poi_excel-0.1.4.jar
95
96
  - classpath/embulk-standards-0.7.5.jar
96
97
  - classpath/poi-3.13.jar
97
98
  - classpath/poi-ooxml-3.13.jar