embulk-input-oracle 0.8.0 → 0.8.1

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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/build.gradle +1 -2
  4. data/classpath/embulk-input-jdbc-0.8.1.jar +0 -0
  5. data/classpath/embulk-input-oracle-0.8.1.jar +0 -0
  6. data/src/main/java/org/embulk/input/OracleInputPlugin.java +22 -0
  7. data/src/test/java/org/embulk/input/oracle/BasicTest.java +102 -0
  8. data/src/test/java/org/embulk/input/oracle/OracleTests.java +55 -0
  9. data/src/test/resources/org/embulk/input/oracle/test/expect/basic/setup.sql +34 -0
  10. data/src/test/resources/org/embulk/input/oracle/test/expect/basic/test_column_options_config.yml +7 -0
  11. data/src/test/resources/org/embulk/input/oracle/test/expect/basic/test_column_options_expected.csv +2 -0
  12. data/src/test/resources/org/embulk/input/oracle/test/expect/basic/test_column_options_expected.diff +2 -0
  13. data/src/test/resources/org/embulk/input/oracle/test/expect/basic/test_column_options_lower_config.yml +7 -0
  14. data/src/test/resources/org/embulk/input/oracle/test/expect/basic/test_config.yml +3 -0
  15. data/src/test/resources/org/embulk/input/oracle/test/expect/basic/test_expected.csv +2 -0
  16. data/src/test/resources/org/embulk/input/oracle/test/expect/basic/test_expected.diff +2 -0
  17. data/src/test/resources/org/embulk/input/oracle/test/expect/basic/test_lower_config.yml +3 -0
  18. data/src/test/resources/org/embulk/input/oracle/test/expect/basic/test_query_config.yml +1 -0
  19. data/src/test/resources/org/embulk/input/oracle/test/expect/basic/test_query_lower_config.yml +1 -0
  20. metadata +17 -11
  21. data/classpath/embulk-input-jdbc-0.8.0.jar +0 -0
  22. data/classpath/embulk-input-oracle-0.8.0.jar +0 -0
  23. data/src/test/java/org/embulk/input/oracle/OracleInputPluginTest.java +0 -169
  24. data/src/test/resources/oracle/yml/input-column-options-lower.yml +0 -20
  25. data/src/test/resources/oracle/yml/input-column-options.yml +0 -20
  26. data/src/test/resources/oracle/yml/input-lower.yml +0 -20
  27. data/src/test/resources/oracle/yml/input-query-lower.yml +0 -18
  28. data/src/test/resources/oracle/yml/input-query.yml +0 -18
  29. data/src/test/resources/oracle/yml/input.yml +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab1f91c076cf91ec74900b6a463ad07abd8647b2
4
- data.tar.gz: 2dc1d750ad0cd880de15893f3bf1222b4859521a
3
+ metadata.gz: bb579d4c4b917ec71f194fd39da7ae4c911a71dc
4
+ data.tar.gz: d8d6e7702de52adfb29f6371ea51dede761aab6d
5
5
  SHA512:
6
- metadata.gz: 7f65aff4ca8d4f34bbfac2b33a81dd315f68f4db9f01bb00147abad57df7f373d7c3807cb05391be979095356f82fef89710eaf087a1539553ea73ac2ea96404
7
- data.tar.gz: 59e3ab2f6ee38e5eb7b72c96bb73b056246bcdcfc628e52031de3fb213cdcb7e8626edd01d867aa6ce10b7a4cabd826c014d257a0cb5793312fbf89855c68a6f
6
+ metadata.gz: ad035e09b62d1a399a3821fc1471b3e429e16f4a9cf683eb32f043021cb81783daa651dd06af56afbe4896573b8f136d195e6af578cb0a7519176a0549a19481
7
+ data.tar.gz: ead95a3bcd4fa7e250f2dda59d34223fe1172e6ec82a3ea59aa3a98c174728d9470173834370e1478f13964a24ece7f919c04ff9cf7cb8bd2073d2a70b1556dc
data/README.md CHANGED
@@ -17,6 +17,8 @@ Oracle input plugin for Embulk loads records from Oracle.
17
17
  - **database**: destination database name (string, required if url is not set)
18
18
  - **schema**: destination schema name (string, default: use the default schema). old Oracle JDBC driver (ojdbc6.jar) doesn't support.
19
19
  - **url**: URL of the JDBC connection (string, optional)
20
+ - **tns_admin_path**: Directory which contains tnsname.ora (string, optional, must be present if **net_service_name** is defined)
21
+ - **net_service_name**: Oracle Net Service Name (string, optional)
20
22
  - If you write SQL directly,
21
23
  - **query**: SQL to run (string)
22
24
  - If **query** is not set,
data/build.gradle CHANGED
@@ -1,7 +1,6 @@
1
1
  dependencies {
2
2
  compile project(':embulk-input-jdbc')
3
3
 
4
- testCompile project(':embulk-input-jdbc').sourceSets.test.output
5
- testCompile 'org.embulk:embulk-standards:0.8.8'
4
+ testCompile 'org.embulk:embulk-standards:0.8.15'
6
5
  testCompile files('driver/ojdbc7.jar')
7
6
  }
@@ -49,6 +49,14 @@ public class OracleInputPlugin
49
49
  @Config("password")
50
50
  @ConfigDefault("\"\"")
51
51
  public String getPassword();
52
+
53
+ @Config("tns_admin_path")
54
+ @ConfigDefault("null")
55
+ public Optional<String> getTnsAdminPath();
56
+
57
+ @Config("net_service_name")
58
+ @ConfigDefault("null")
59
+ public Optional<String> getNetServiceName();
52
60
  }
53
61
 
54
62
  @Override
@@ -67,7 +75,21 @@ public class OracleInputPlugin
67
75
  if (oracleTask.getHost().isPresent() || oracleTask.getDatabase().isPresent()) {
68
76
  throw new IllegalArgumentException("'host', 'port' and 'database' parameters are invalid if 'url' parameter is set.");
69
77
  }
78
+ if (oracleTask.getNetServiceName().isPresent() || oracleTask.getTnsAdminPath().isPresent()) {
79
+ throw new IllegalArgumentException("'net_service_name', 'tns_admin_path' parameters are invalid if 'url' parameter is set.");
80
+ }
70
81
  url = oracleTask.getUrl().get();
82
+ } else if (oracleTask.getNetServiceName().isPresent()) {
83
+ if (!oracleTask.getTnsAdminPath().isPresent()) {
84
+ throw new IllegalArgumentException("'tns_admin_path' parameter is required if 'net_service_name' parameter is set.");
85
+ }
86
+ if (oracleTask.getHost().isPresent() || oracleTask.getDatabase().isPresent()) {
87
+ throw new IllegalArgumentException("'host' and 'database' parameters are invalid if 'net_service_name' and 'tns_admin_path' parameters are set.");
88
+ }
89
+ System.setProperty("oracle.net.tns_admin", oracleTask.getTnsAdminPath().get());
90
+ url = String.format("jdbc:oracle:thin:@%s", oracleTask.getNetServiceName().get());
91
+ } else if (oracleTask.getTnsAdminPath().isPresent() && !oracleTask.getNetServiceName().isPresent()) {
92
+ throw new IllegalArgumentException("'net_service_name' parameter is required if 'tns_admin_path' parameter is set.");
71
93
  } else {
72
94
  if (!oracleTask.getHost().isPresent()) {
73
95
  throw new IllegalArgumentException("Field 'host' is not set.");
@@ -0,0 +1,102 @@
1
+ package org.embulk.input.oracle;
2
+
3
+ import static org.embulk.input.oracle.OracleTests.execute;
4
+ import static org.embulk.test.EmbulkTests.readSortedFile;
5
+ import static org.hamcrest.Matchers.is;
6
+ import static org.junit.Assert.assertThat;
7
+
8
+ import java.nio.file.Path;
9
+
10
+ import org.embulk.config.ConfigDiff;
11
+ import org.embulk.config.ConfigSource;
12
+ import org.embulk.input.OracleInputPlugin;
13
+ import org.embulk.spi.InputPlugin;
14
+ import org.embulk.test.EmbulkTests;
15
+ import org.embulk.test.TestingEmbulk;
16
+ import org.junit.Before;
17
+ import org.junit.Rule;
18
+ import org.junit.Test;
19
+
20
+ public class BasicTest
21
+ {
22
+ private static final String BASIC_RESOURCE_PATH = "org/embulk/input/oracle/test/expect/basic/";
23
+
24
+ private static ConfigSource loadYamlResource(TestingEmbulk embulk, String fileName)
25
+ {
26
+ return embulk.loadYamlResource(BASIC_RESOURCE_PATH + fileName);
27
+ }
28
+
29
+ private static String readResource(String fileName)
30
+ {
31
+ return EmbulkTests.readResource(BASIC_RESOURCE_PATH + fileName);
32
+ }
33
+
34
+ @Rule
35
+ public TestingEmbulk embulk = TestingEmbulk.builder()
36
+ .registerPlugin(InputPlugin.class, "oracle", OracleInputPlugin.class)
37
+ .build();
38
+
39
+ private ConfigSource baseConfig;
40
+
41
+ @Before
42
+ public void setup() throws Exception
43
+ {
44
+ baseConfig = OracleTests.baseConfig();
45
+ execute(embulk, readResource("setup.sql")); // setup rows
46
+ }
47
+
48
+ @Test
49
+ public void test() throws Exception
50
+ {
51
+ Path out1 = embulk.createTempFile("csv");
52
+ TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "test_config.yml")), out1);
53
+ assertThat(readSortedFile(out1), is(readResource("test_expected.csv")));
54
+ assertThat(result1.getConfigDiff(), is((ConfigDiff) loadYamlResource(embulk, "test_expected.diff")));
55
+ }
56
+
57
+ @Test
58
+ public void testLower() throws Exception
59
+ {
60
+ Path out1 = embulk.createTempFile("csv");
61
+ TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "test_lower_config.yml")), out1);
62
+ assertThat(readSortedFile(out1), is(readResource("test_expected.csv")));
63
+ assertThat(result1.getConfigDiff(), is((ConfigDiff) loadYamlResource(embulk, "test_expected.diff")));
64
+ }
65
+
66
+ @Test
67
+ public void testQuery() throws Exception
68
+ {
69
+ Path out1 = embulk.createTempFile("csv");
70
+ TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "test_query_config.yml")), out1);
71
+ assertThat(readSortedFile(out1), is(readResource("test_expected.csv")));
72
+ assertThat(result1.getConfigDiff(), is((ConfigDiff) loadYamlResource(embulk, "test_expected.diff")));
73
+ }
74
+
75
+ @Test
76
+ public void testQueryLower() throws Exception
77
+ {
78
+ Path out1 = embulk.createTempFile("csv");
79
+ TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "test_query_lower_config.yml")), out1);
80
+ assertThat(readSortedFile(out1), is(readResource("test_expected.csv")));
81
+ assertThat(result1.getConfigDiff(), is((ConfigDiff) loadYamlResource(embulk, "test_expected.diff")));
82
+ }
83
+
84
+ @Test
85
+ public void testColumnOptions() throws Exception
86
+ {
87
+ Path out1 = embulk.createTempFile("csv");
88
+ TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "test_column_options_config.yml")), out1);
89
+ assertThat(readSortedFile(out1), is(readResource("test_column_options_expected.csv")));
90
+ assertThat(result1.getConfigDiff(), is((ConfigDiff) loadYamlResource(embulk, "test_column_options_expected.diff")));
91
+ }
92
+
93
+ @Test
94
+ public void testColumnOptionsLower() throws Exception
95
+ {
96
+ Path out1 = embulk.createTempFile("csv");
97
+ TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "test_column_options_lower_config.yml")), out1);
98
+ assertThat(readSortedFile(out1), is(readResource("test_column_options_expected.csv")));
99
+ assertThat(result1.getConfigDiff(), is((ConfigDiff) loadYamlResource(embulk, "test_column_options_expected.diff")));
100
+ }
101
+
102
+ }
@@ -0,0 +1,55 @@
1
+ package org.embulk.input.oracle;
2
+
3
+ import static java.util.Locale.ENGLISH;
4
+
5
+ import java.io.IOException;
6
+ import java.nio.charset.Charset;
7
+ import java.nio.file.Files;
8
+ import java.nio.file.Path;
9
+ import java.util.Arrays;
10
+
11
+ import org.embulk.config.ConfigSource;
12
+ import org.embulk.test.EmbulkTests;
13
+ import org.embulk.test.TestingEmbulk;
14
+
15
+ import com.google.common.base.Throwables;
16
+ import com.google.common.io.ByteStreams;
17
+
18
+ public class OracleTests
19
+ {
20
+ public static ConfigSource baseConfig()
21
+ {
22
+ return EmbulkTests.config("EMBULK_INPUT_ORACLE_TEST_CONFIG");
23
+ }
24
+
25
+ public static void execute(TestingEmbulk embulk, String sql) throws IOException
26
+ {
27
+ Path sqlFile = embulk.createTempFile("sql");
28
+ Files.write(sqlFile, Arrays.asList(sql), Charset.forName("UTF8"));
29
+
30
+ ConfigSource config = baseConfig();
31
+ String host = config.get(String.class, "host");
32
+ String port = config.get(String.class, "port", "1521");
33
+ String user = config.get(String.class, "user");
34
+ String password = config.get(String.class, "password");
35
+ String database = config.get(String.class, "database");
36
+ ProcessBuilder pb = new ProcessBuilder(
37
+ "SQLPLUS",
38
+ user + "/" + password + "@" + host + ":" + port + "/" + database,
39
+ "@" + sqlFile.toFile().getAbsolutePath());
40
+ pb.environment().put("NLS_LANG", "American_America.UTF8");
41
+ pb.redirectErrorStream(true);
42
+ int code;
43
+ try {
44
+ Process process = pb.start();
45
+ ByteStreams.copy(process.getInputStream(), System.out);
46
+ code = process.waitFor();
47
+ } catch (IOException | InterruptedException ex) {
48
+ throw Throwables.propagate(ex);
49
+ }
50
+ if (code != 0) {
51
+ throw new RuntimeException(String.format(ENGLISH,
52
+ "Command finished with non-zero exit code. Exit code is %d.", code));
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,34 @@
1
+ DROP TABLE TEST1;
2
+
3
+ CREATE TABLE TEST1 (
4
+ ID CHAR(2),
5
+ C1 DECIMAL(12,2),
6
+ C2 CHAR(8),
7
+ C3 VARCHAR2(8),
8
+ C4 NVARCHAR2(8),
9
+ C5 DATE,
10
+ C6 TIMESTAMP,
11
+ C7 TIMESTAMP(3),
12
+ PRIMARY KEY(ID));
13
+
14
+ INSERT INTO TEST1 VALUES(
15
+ '10',
16
+ NULL,
17
+ NULL,
18
+ NULL,
19
+ NULL,
20
+ NULL,
21
+ NULL,
22
+ NULL);
23
+
24
+ INSERT INTO TEST1 VALUES(
25
+ '11',
26
+ -1234567890.12,
27
+ 'ABCDEF',
28
+ 'XYZ',
29
+ 'ABCDEFGH',
30
+ TO_DATE('2015-06-04', 'YYYY-MM-DD'),
31
+ TO_TIMESTAMP('2015-06-05 23:45:06', 'YYYY-MM-DD HH24:MI:SS'),
32
+ TO_TIMESTAMP('2015-06-06 23:45:06.789', 'YYYY-MM-DD HH24:MI:SS.FF3'));
33
+
34
+ EXIT;
@@ -0,0 +1,7 @@
1
+ table: TEST1
2
+ select: "*"
3
+ order_by: "ID"
4
+ column_options:
5
+ C5: {type: string, timestamp_format: '%Y/%m/%d', timezone: "+0900"}
6
+ C6: {type: string, timestamp_format: '%Y/%m/%d %H:%M:%S', timezone: "+0900"}
7
+ C7: {type: string, timestamp_format: '%Y/%m/%d %H:%M:%S.%3N', timezone: "+0900"}
@@ -0,0 +1,2 @@
1
+ 10,,,,,,,
2
+ 11,-1.23456789012E9,ABCDEF ,XYZ,ABCDEFGH,2015/06/04,2015/06/06 05:45:06,2015/06/07 05:45:06.789
@@ -0,0 +1,7 @@
1
+ table: TEST1
2
+ select: "*"
3
+ order_by: "ID"
4
+ column_options:
5
+ c5: {type: string, timestamp_format: '%Y/%m/%d', timezone: "+0900"}
6
+ c6: {type: string, timestamp_format: '%Y/%m/%d %H:%M:%S', timezone: "+0900"}
7
+ c7: {type: string, timestamp_format: '%Y/%m/%d %H:%M:%S.%3N', timezone: "+0900"}
@@ -0,0 +1,3 @@
1
+ table: TEST1
2
+ select: "C1, C2, C3, C4, C5, C6, C7"
3
+ order_by: C1
@@ -0,0 +1,2 @@
1
+ ,,,,,,
2
+ -1.23456789012E9,ABCDEF ,XYZ,ABCDEFGH,2015-06-03 21:00:00.000000 +0000,2015-06-05 20:45:06.000000 +0000,2015-06-06 20:45:06.789000 +0000
@@ -0,0 +1,3 @@
1
+ table: test1
2
+ select: "c1, c2, c3, c4, c5, c6, c7"
3
+ order_by: c1
@@ -0,0 +1 @@
1
+ query: "SELECT C1, C2, C3, C4, C5, C6, C7 FROM TEST1 ORDER BY C1"
@@ -0,0 +1 @@
1
+ query: "select c1, c2, c3, c4, c5, c6, c7 from test1 order by c1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-oracle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-13 00:00:00.000000000 Z
11
+ date: 2017-02-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Selects records from a table.
14
14
  email:
@@ -19,18 +19,24 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - README.md
21
21
  - build.gradle
22
- - classpath/embulk-input-jdbc-0.8.0.jar
23
- - classpath/embulk-input-oracle-0.8.0.jar
22
+ - classpath/embulk-input-jdbc-0.8.1.jar
23
+ - classpath/embulk-input-oracle-0.8.1.jar
24
24
  - lib/embulk/input/oracle.rb
25
25
  - src/main/java/org/embulk/input/OracleInputPlugin.java
26
26
  - src/main/java/org/embulk/input/oracle/OracleInputConnection.java
27
- - src/test/java/org/embulk/input/oracle/OracleInputPluginTest.java
28
- - src/test/resources/oracle/yml/input-column-options-lower.yml
29
- - src/test/resources/oracle/yml/input-column-options.yml
30
- - src/test/resources/oracle/yml/input-lower.yml
31
- - src/test/resources/oracle/yml/input-query-lower.yml
32
- - src/test/resources/oracle/yml/input-query.yml
33
- - src/test/resources/oracle/yml/input.yml
27
+ - src/test/java/org/embulk/input/oracle/BasicTest.java
28
+ - src/test/java/org/embulk/input/oracle/OracleTests.java
29
+ - src/test/resources/org/embulk/input/oracle/test/expect/basic/setup.sql
30
+ - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_column_options_config.yml
31
+ - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_column_options_expected.csv
32
+ - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_column_options_expected.diff
33
+ - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_column_options_lower_config.yml
34
+ - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_config.yml
35
+ - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_expected.csv
36
+ - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_expected.diff
37
+ - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_lower_config.yml
38
+ - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_query_config.yml
39
+ - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_query_lower_config.yml
34
40
  homepage: https://github.com/embulk/embulk-input-jdbc
35
41
  licenses:
36
42
  - Apache 2.0
Binary file
@@ -1,169 +0,0 @@
1
- package org.embulk.input.oracle;
2
-
3
- import static java.util.Locale.ENGLISH;
4
- import static org.junit.Assert.assertEquals;
5
-
6
- import java.sql.Connection;
7
- import java.sql.DriverManager;
8
- import java.sql.SQLException;
9
- import java.util.Arrays;
10
-
11
- import org.embulk.input.AbstractJdbcInputPluginTest;
12
- import org.embulk.input.OracleInputPlugin;
13
- import org.embulk.spi.InputPlugin;
14
- import org.junit.Test;
15
-
16
- public class OracleInputPluginTest extends AbstractJdbcInputPluginTest
17
- {
18
- @Override
19
- protected void prepare() throws SQLException
20
- {
21
- tester.addPlugin(InputPlugin.class, "oracle", OracleInputPlugin.class);
22
-
23
- try {
24
- Class.forName("oracle.jdbc.OracleDriver");
25
- } catch (ClassNotFoundException e) {
26
- System.err.println("Warning: you should put 'ojdbc7.jar' in 'embulk-input-oracle/driver' directory in order to test.");
27
- return;
28
- }
29
-
30
- try {
31
- connect();
32
- } catch (SQLException e) {
33
- System.err.println(e);
34
- System.err.println(String.format(ENGLISH, "Warning: prepare a schema on Oracle 12c (server = %s, port = %d, database = %s, user = %s, password = %s, charset = UTF-8).",
35
- getHost(), getPort(), getDatabase(), getUser(), getPassword()));
36
- // for example
37
- // CREATE USER TEST_USER IDENTIFIED BY "test_pw";
38
- // GRANT DBA TO TEST_USER;
39
- return;
40
- }
41
-
42
- enabled = true;
43
-
44
- String drop1 = "DROP TABLE TEST1";
45
- executeSQL(drop1, true);
46
-
47
- String create1 =
48
- "CREATE TABLE TEST1 ("
49
- + "ID CHAR(2),"
50
- + "C1 DECIMAL(12,2),"
51
- + "C2 CHAR(8),"
52
- + "C3 VARCHAR2(8),"
53
- + "C4 NVARCHAR2(8),"
54
- + "C5 DATE,"
55
- + "C6 TIMESTAMP,"
56
- + "C7 TIMESTAMP(3),"
57
- + "PRIMARY KEY(ID))";
58
- executeSQL(create1);
59
-
60
- String insert1 =
61
- "INSERT INTO TEST1 VALUES("
62
- + "'10',"
63
- + "NULL,"
64
- + "NULL,"
65
- + "NULL,"
66
- + "NULL,"
67
- + "NULL,"
68
- + "NULL,"
69
- + "NULL)";
70
- executeSQL(insert1);
71
-
72
- String insert2 =
73
- "INSERT INTO TEST1 VALUES("
74
- + "'11',"
75
- + "-1234567890.12,"
76
- + "'ABCDEF',"
77
- + "'XYZ',"
78
- + "'ABCDEFGH',"
79
- + "'2015-06-04',"
80
- + "'2015-06-05 23:45:06',"
81
- + "'2015-06-06 23:45:06.789')";
82
- executeSQL(insert2);
83
- }
84
-
85
- @Test
86
- public void test() throws Exception
87
- {
88
- if (enabled) {
89
- test("/oracle/yml/input.yml");
90
- assertEquals(Arrays.asList(
91
- "C1,C2,C3,C4,C5,C6,C7",
92
- "-1.23456789012E9,ABCDEF ,XYZ,ABCDEFGH,2015-06-04,2015-06-05 23:45:06,2015-06-06 23:45:06.789",
93
- ",,,,,,"),
94
- read("oracle-input000.00.csv"));
95
- }
96
- }
97
-
98
- @Test
99
- public void testLower() throws Exception
100
- {
101
- if (enabled) {
102
- test("/oracle/yml/input-lower.yml");
103
- assertEquals(Arrays.asList(
104
- "C1,C2,C3,C4,C5,C6,C7",
105
- "-1.23456789012E9,ABCDEF ,XYZ,ABCDEFGH,2015-06-04,2015-06-05 23:45:06,2015-06-06 23:45:06.789",
106
- ",,,,,,"),
107
- read("oracle-input000.00.csv"));
108
- }
109
- }
110
-
111
- @Test
112
- public void testQuery() throws Exception
113
- {
114
- if (enabled) {
115
- test("/oracle/yml/input-query.yml");
116
- assertEquals(Arrays.asList(
117
- "C1,C2,C3,C4,C5,C6,C7",
118
- "-1.23456789012E9,ABCDEF ,XYZ,ABCDEFGH,2015-06-04,2015-06-05 23:45:06,2015-06-06 23:45:06.789",
119
- ",,,,,,"),
120
- read("oracle-input000.00.csv"));
121
- }
122
- }
123
-
124
- @Test
125
- public void testQueryLower() throws Exception
126
- {
127
- if (enabled) {
128
- test("/oracle/yml/input-query-lower.yml");
129
- assertEquals(Arrays.asList(
130
- "C1,C2,C3,C4,C5,C6,C7",
131
- "-1.23456789012E9,ABCDEF ,XYZ,ABCDEFGH,2015-06-04,2015-06-05 23:45:06,2015-06-06 23:45:06.789",
132
- ",,,,,,"),
133
- read("oracle-input000.00.csv"));
134
- }
135
- }
136
-
137
- @Test
138
- public void testColumnOptions() throws Exception
139
- {
140
- if (enabled) {
141
- test("/oracle/yml/input-column-options.yml");
142
- assertEquals(Arrays.asList(
143
- "ID,C1,C2,C3,C4,C5,C6,C7",
144
- "10,,,,,,,",
145
- "11,-1.23456789012E9,ABCDEF ,XYZ,ABCDEFGH,2015/06/04,2015/06/05 23:45:06,2015/06/06 23:45:06.789"),
146
- read("oracle-input000.00.csv"));
147
- }
148
- }
149
-
150
- @Test
151
- public void testColumnOptionsLower() throws Exception
152
- {
153
- if (enabled) {
154
- test("/oracle/yml/input-column-options-lower.yml");
155
- assertEquals(Arrays.asList(
156
- "ID,C1,C2,C3,C4,C5,C6,C7",
157
- "10,,,,,,,",
158
- "11,-1.23456789012E9,ABCDEF ,XYZ,ABCDEFGH,2015/06/04,2015/06/05 23:45:06,2015/06/06 23:45:06.789"),
159
- read("oracle-input000.00.csv"));
160
- }
161
- }
162
-
163
- @Override
164
- protected Connection connect() throws SQLException
165
- {
166
- return DriverManager.getConnection(String.format(ENGLISH, "jdbc:oracle:thin:@%s:%d:%s", getHost(), getPort(), getDatabase()),
167
- getUser(), getPassword());
168
- }
169
- }
@@ -1,20 +0,0 @@
1
- in:
2
- type: oracle
3
- host: #host#
4
- database: #database#
5
- user: #user#
6
- password: #password#
7
- table: TEST1
8
- select: "*"
9
- order_by: "ID"
10
- column_options:
11
- c5: {type: string, timestamp_format: '%Y/%m/%d', timezone: "+0900"}
12
- c6: {type: string, timestamp_format: '%Y/%m/%d %H:%M:%S', timezone: "+0900"}
13
- c7: {type: string, timestamp_format: '%Y/%m/%d %H:%M:%S.%3N', timezone: "+0900"}
14
-
15
- out:
16
- type: file
17
- path_prefix: oracle-input
18
- file_ext: csv
19
- formatter:
20
- type: csv
@@ -1,20 +0,0 @@
1
- in:
2
- type: oracle
3
- host: #host#
4
- database: #database#
5
- user: #user#
6
- password: #password#
7
- table: TEST1
8
- select: "*"
9
- order_by: "ID"
10
- column_options:
11
- C5: {type: string, timestamp_format: '%Y/%m/%d', timezone: "+0900"}
12
- C6: {type: string, timestamp_format: '%Y/%m/%d %H:%M:%S', timezone: "+0900"}
13
- C7: {type: string, timestamp_format: '%Y/%m/%d %H:%M:%S.%3N', timezone: "+0900"}
14
-
15
- out:
16
- type: file
17
- path_prefix: oracle-input
18
- file_ext: csv
19
- formatter:
20
- type: csv
@@ -1,20 +0,0 @@
1
- in:
2
- type: oracle
3
- host: #host#
4
- database: #database#
5
- user: #user#
6
- password: #password#
7
- table: test1
8
- select: "c1, c2, c3, c4, c5, c6, c7"
9
- order_by: c1
10
-
11
- out:
12
- type: file
13
- path_prefix: oracle-input
14
- file_ext: csv
15
- formatter:
16
- type: csv
17
- column_options:
18
- C5: {format: '%Y-%m-%d', timezone: '+0900'}
19
- C6: {format: '%Y-%m-%d %H:%M:%S', timezone: '+0900'}
20
- C7: {format: '%Y-%m-%d %H:%M:%S.%3N', timezone: '+0900'}
@@ -1,18 +0,0 @@
1
- in:
2
- type: oracle
3
- host: #host#
4
- database: #database#
5
- user: #user#
6
- password: #password#
7
- query: "select c1, c2, c3, c4, c5, c6, c7 from test1 order by c1"
8
-
9
- out:
10
- type: file
11
- path_prefix: oracle-input
12
- file_ext: csv
13
- formatter:
14
- type: csv
15
- column_options:
16
- C5: {format: '%Y-%m-%d', timezone: '+0900'}
17
- C6: {format: '%Y-%m-%d %H:%M:%S', timezone: '+0900'}
18
- C7: {format: '%Y-%m-%d %H:%M:%S.%3N', timezone: '+0900'}
@@ -1,18 +0,0 @@
1
- in:
2
- type: oracle
3
- host: #host#
4
- database: #database#
5
- user: #user#
6
- password: #password#
7
- query: "SELECT C1, C2, C3, C4, C5, C6, C7 FROM TEST1 ORDER BY C1"
8
-
9
- out:
10
- type: file
11
- path_prefix: oracle-input
12
- file_ext: csv
13
- formatter:
14
- type: csv
15
- column_options:
16
- C5: {format: '%Y-%m-%d', timezone: '+0900'}
17
- C6: {format: '%Y-%m-%d %H:%M:%S', timezone: '+0900'}
18
- C7: {format: '%Y-%m-%d %H:%M:%S.%3N', timezone: '+0900'}
@@ -1,20 +0,0 @@
1
- in:
2
- type: oracle
3
- host: #host#
4
- database: #database#
5
- user: #user#
6
- password: #password#
7
- table: TEST1
8
- select: "C1, C2, C3, C4, C5, C6, C7"
9
- order_by: C1
10
-
11
- out:
12
- type: file
13
- path_prefix: oracle-input
14
- file_ext: csv
15
- formatter:
16
- type: csv
17
- column_options:
18
- C5: {format: '%Y-%m-%d', timezone: '+0900'}
19
- C6: {format: '%Y-%m-%d %H:%M:%S', timezone: '+0900'}
20
- C7: {format: '%Y-%m-%d %H:%M:%S.%3N', timezone: '+0900'}