embulk-output-oracle 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1074dcbca44c9b5e6cc3d80da2eea5b40538bb28
4
- data.tar.gz: e560931b3c0dcb3851b4b330d06ed0a01103b34a
3
+ metadata.gz: ba951a3e467154c25d59dd8e37d0ea7ed345b2c1
4
+ data.tar.gz: 2460425a8bac3b445d80f9644680a21b84c5e972
5
5
  SHA512:
6
- metadata.gz: 919fc3fc46e0ded5c4e0983459659bde509898506f546932b4b5029fe45ef617279ed0895b24e7352936574090f2097ba1cc2d9dc2dbc4a05d6a98a58b1d65a4
7
- data.tar.gz: 1ab155c13bf488e439f3951b31d257f75ee226d1f4b1352212147107d835cf270a8f2859fd8cd09269f88e16798929898d26a4a0af1eb5a87df3191a9a45a31f
6
+ metadata.gz: edd79e76f7fa2631f556f6de2d838b2a205431eb89c262076b10c0bd48d808ee760b38f6550041829546e285fbc3dea6e59a6d59537755ec3416a639fea1fe95
7
+ data.tar.gz: a05efdd0d48d60f098affb33ceb8639f8246c780f405f1c513b126f10afd4fa274921ae294fed5e5de5980d42e3de485e82b4aecd62c7cd85a652555a8d17b44
@@ -23,7 +23,6 @@ import org.embulk.exec.PartialExecutionException;
23
23
  import org.embulk.input.filesplit.LocalFileSplitInputPlugin;
24
24
  import org.embulk.output.AbstractJdbcOutputPluginTest;
25
25
  import org.embulk.output.OracleOutputPlugin;
26
- import org.embulk.output.tester.EmbulkPluginTester;
27
26
  import org.embulk.spi.InputPlugin;
28
27
  import org.embulk.spi.OutputPlugin;
29
28
  import org.junit.BeforeClass;
@@ -32,8 +31,6 @@ import org.junit.Test;
32
31
 
33
32
  public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
34
33
  {
35
- private static boolean canTest;
36
- private static EmbulkPluginTester tester = new EmbulkPluginTester();
37
34
  static {
38
35
  tester.addPlugin(OutputPlugin.class, "oracle", OracleOutputPlugin.class);
39
36
  tester.addPlugin(InputPlugin.class, "filesplit", LocalFileSplitInputPlugin.class);
@@ -57,7 +54,7 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
57
54
  try (Connection connection = new OracleOutputPluginTest().connect()) {
58
55
  String version = connection.getMetaData().getDriverVersion();
59
56
  System.out.println("Driver version = " + version);
60
- canTest = true;
57
+ enabled = true;
61
58
 
62
59
  } catch (SQLException e) {
63
60
  System.err.println(e);
@@ -71,16 +68,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
71
68
  @Test
72
69
  public void testInsert() throws Exception
73
70
  {
74
- if (!canTest) {
75
- return;
76
- }
77
-
78
71
  String table = "TEST1";
79
72
 
80
73
  dropTable(table);
81
74
  createTable(table);
82
75
 
83
- run("/oracle/yml/test-insert.yml");
76
+ test("/oracle/yml/test-insert.yml");
84
77
 
85
78
  assertTable(table);
86
79
  }
@@ -88,15 +81,11 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
88
81
  @Test
89
82
  public void testInsertCreate() throws Exception
90
83
  {
91
- if (!canTest) {
92
- return;
93
- }
94
-
95
84
  String table = "TEST1";
96
85
 
97
86
  dropTable(table);
98
87
 
99
- run("/oracle/yml/test-insert.yml");
88
+ test("/oracle/yml/test-insert.yml");
100
89
 
101
90
  assertGeneratedTable1(table);
102
91
  }
@@ -104,17 +93,13 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
104
93
  @Test
105
94
  public void testInsertEmpty() throws Exception
106
95
  {
107
- if (!canTest) {
108
- return;
109
- }
110
-
111
96
  String table = "TEST1";
112
97
 
113
98
  dropTable(table);
114
99
  createTable(table);
115
100
 
116
101
  new File(convertPath("/oracle/data/"), "test2").mkdir();
117
- run("/oracle/yml/test-insert-empty.yml");
102
+ test("/oracle/yml/test-insert-empty.yml");
118
103
 
119
104
  assertTableEmpty(table);
120
105
  }
@@ -122,17 +107,13 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
122
107
  @Test
123
108
  public void testTruncateInsert() throws Exception
124
109
  {
125
- if (!canTest) {
126
- return;
127
- }
128
-
129
110
  String table = "TEST1";
130
111
 
131
112
  dropTable(table);
132
113
  createTable(table);
133
114
  insertRecord(table);
134
115
 
135
- run("/oracle/yml/test-truncate-insert.yml");
116
+ test("/oracle/yml/test-truncate-insert.yml");
136
117
 
137
118
  assertTable(table);
138
119
  }
@@ -140,17 +121,13 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
140
121
  @Test
141
122
  public void testTruncateInsertOCIMethod() throws Exception
142
123
  {
143
- if (!canTest) {
144
- return;
145
- }
146
-
147
124
  String table = "TEST1";
148
125
 
149
126
  dropTable(table);
150
127
  createTable(table);
151
128
  insertRecord(table);
152
129
 
153
- run("/oracle/yml/test-truncate-insert-oci-method.yml");
130
+ test("/oracle/yml/test-truncate-insert-oci-method.yml");
154
131
 
155
132
  assertTable(table);
156
133
  }
@@ -158,15 +135,11 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
158
135
  @Test
159
136
  public void testTruncateInsertCreate() throws Exception
160
137
  {
161
- if (!canTest) {
162
- return;
163
- }
164
-
165
138
  String table = "TEST1";
166
139
 
167
140
  dropTable(table);
168
141
 
169
- run("/oracle/yml/test-truncate-insert.yml");
142
+ test("/oracle/yml/test-truncate-insert.yml");
170
143
 
171
144
  assertGeneratedTable1(table);
172
145
  }
@@ -174,16 +147,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
174
147
  @Test
175
148
  public void testInsertDirect() throws Exception
176
149
  {
177
- if (!canTest) {
178
- return;
179
- }
180
-
181
150
  String table = "TEST1";
182
151
 
183
152
  dropTable(table);
184
153
  createTable(table);
185
154
 
186
- run("/oracle/yml/test-insert-direct.yml");
155
+ test("/oracle/yml/test-insert-direct.yml");
187
156
 
188
157
  assertTable(table);
189
158
  }
@@ -191,7 +160,7 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
191
160
  @Test
192
161
  public void testInsertDirectDuplicate() throws Exception
193
162
  {
194
- if (!canTest) {
163
+ if (!enabled) {
195
164
  return;
196
165
  }
197
166
 
@@ -202,7 +171,7 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
202
171
  insertRecord(table, "A002");
203
172
 
204
173
  try {
205
- run("/oracle/yml/test-insert-direct.yml");
174
+ test("/oracle/yml/test-insert-direct.yml");
206
175
  fail("Exception expected.");
207
176
  } catch (Exception e) {
208
177
  System.out.println(e);
@@ -212,17 +181,13 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
212
181
  @Test
213
182
  public void testInsertDirectEmpty() throws Exception
214
183
  {
215
- if (!canTest) {
216
- return;
217
- }
218
-
219
184
  String table = "TEST1";
220
185
 
221
186
  dropTable(table);
222
187
  createTable(table);
223
188
 
224
189
  new File(convertPath("/oracle/data/"), "test2").mkdir();
225
- run("/oracle/yml/test-insert-direct-empty.yml");
190
+ test("/oracle/yml/test-insert-direct-empty.yml");
226
191
 
227
192
  assertTableEmpty(table);
228
193
  }
@@ -230,15 +195,11 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
230
195
  @Test
231
196
  public void testInsertDirectCreate() throws Exception
232
197
  {
233
- if (!canTest) {
234
- return;
235
- }
236
-
237
198
  String table = "TEST1";
238
199
 
239
200
  dropTable(table);
240
201
 
241
- run("/oracle/yml/test-insert-direct.yml");
202
+ test("/oracle/yml/test-insert-direct.yml");
242
203
 
243
204
  assertGeneratedTable1(table);
244
205
  }
@@ -246,17 +207,13 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
246
207
  @Test
247
208
  public void testInsertDirectDirectMethod() throws Exception
248
209
  {
249
- if (!canTest) {
250
- return;
251
- }
252
-
253
210
  String table = "TEST1";
254
211
 
255
212
  dropTable(table);
256
213
  createTable(table);
257
214
 
258
215
  try {
259
- run("/oracle/yml/test-insert-direct-direct-method.yml");
216
+ test("/oracle/yml/test-insert-direct-direct-method.yml");
260
217
  } catch (PartialExecutionException e) {
261
218
  if (e.getCause() != null && e.getCause().getClass().equals(RuntimeException.class)
262
219
  && e.getCause().getCause() != null && e.getCause().getCause().getClass().equals(AssertionError.class)) {
@@ -274,16 +231,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
274
231
  @Test
275
232
  public void testInsertDirectOCIMethod() throws Exception
276
233
  {
277
- if (!canTest) {
278
- return;
279
- }
280
-
281
234
  String table = "TEST1";
282
235
 
283
236
  dropTable(table);
284
237
  createTable(table);
285
238
 
286
- run("/oracle/yml/test-insert-direct-oci-method.yml");
239
+ test("/oracle/yml/test-insert-direct-oci-method.yml");
287
240
 
288
241
  assertTable(table);
289
242
  }
@@ -291,7 +244,7 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
291
244
  @Test
292
245
  public void testInsertDirectOCIMethodLarge() throws Exception
293
246
  {
294
- if (!canTest) {
247
+ if (!enabled) {
295
248
  return;
296
249
  }
297
250
 
@@ -300,7 +253,7 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
300
253
  dropTable(table);
301
254
  createTable(table);
302
255
 
303
- run("/oracle/yml/test-insert-direct-oci-method-large.yml");
256
+ test("/oracle/yml/test-insert-direct-oci-method-large.yml");
304
257
 
305
258
  List<List<Object>> rows = select(table);
306
259
  assertEquals(9999, rows.size());
@@ -312,7 +265,7 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
312
265
  @Test
313
266
  public void testInsertDirectOCIMethodDuplicate() throws Exception
314
267
  {
315
- if (!canTest) {
268
+ if (!enabled) {
316
269
  return;
317
270
  }
318
271
 
@@ -323,7 +276,7 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
323
276
  insertRecord(table, "A002");
324
277
 
325
278
  try {
326
- run("/oracle/yml/test-insert-direct-oci-method.yml");
279
+ test("/oracle/yml/test-insert-direct-oci-method.yml");
327
280
  fail("Exception expected.");
328
281
  } catch (Exception e) {
329
282
  System.out.println(e);
@@ -333,16 +286,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
333
286
  @Test
334
287
  public void testInsertDirectOCIMethodMultibyte() throws Exception
335
288
  {
336
- if (!canTest) {
337
- return;
338
- }
339
-
340
289
  String table = "TEST1";
341
290
 
342
291
  dropTable(table);
343
292
  createTable(table);
344
293
 
345
- run("/oracle/yml/test-insert-direct-oci-method-multibyte.yml");
294
+ test("/oracle/yml/test-insert-direct-oci-method-multibyte.yml");
346
295
 
347
296
  assertTable(table);
348
297
  }
@@ -350,7 +299,7 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
350
299
  @Test
351
300
  public void testInsertDirectOCIMethodMultibyteDuplicate() throws Exception
352
301
  {
353
- if (!canTest) {
302
+ if (!enabled) {
354
303
  return;
355
304
  }
356
305
 
@@ -361,7 +310,7 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
361
310
  insertRecord(table, "A002");
362
311
 
363
312
  try {
364
- run("/oracle/yml/test-insert-direct-oci-method-multibyte.yml");
313
+ test("/oracle/yml/test-insert-direct-oci-method-multibyte.yml");
365
314
  fail("Exception expected.");
366
315
  } catch (Exception e) {
367
316
  System.out.println(e);
@@ -371,16 +320,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
371
320
  @Test
372
321
  public void testInsertDirectOCIMethodSplit() throws Exception
373
322
  {
374
- if (!canTest) {
375
- return;
376
- }
377
-
378
323
  String table = "TEST1";
379
324
 
380
325
  dropTable(table);
381
326
  createTable(table);
382
327
 
383
- run("/oracle/yml/test-insert-direct-oci-method-split.yml");
328
+ test("/oracle/yml/test-insert-direct-oci-method-split.yml");
384
329
 
385
330
  assertTable(table);
386
331
  }
@@ -388,16 +333,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
388
333
  @Test
389
334
  public void testUrl() throws Exception
390
335
  {
391
- if (!canTest) {
392
- return;
393
- }
394
-
395
336
  String table = "TEST1";
396
337
 
397
338
  dropTable(table);
398
339
  createTable(table);
399
340
 
400
- run("/oracle/yml/test-url.yml");
341
+ test("/oracle/yml/test-url.yml");
401
342
 
402
343
  assertTable(table);
403
344
  }
@@ -405,16 +346,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
405
346
  @Test
406
347
  public void testLowerTable() throws Exception
407
348
  {
408
- if (!canTest) {
409
- return;
410
- }
411
-
412
349
  String table = "TEST1";
413
350
 
414
351
  dropTable(table);
415
352
  createTable(table);
416
353
 
417
- run("/oracle/yml/test-lower-table.yml");
354
+ test("/oracle/yml/test-lower-table.yml");
418
355
 
419
356
  assertTable(table);
420
357
  }
@@ -422,16 +359,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
422
359
  @Test
423
360
  public void testLowerColumn() throws Exception
424
361
  {
425
- if (!canTest) {
426
- return;
427
- }
428
-
429
362
  String table = "TEST1";
430
363
 
431
364
  dropTable(table);
432
365
  createTable(table);
433
366
 
434
- run("/oracle/yml/test-lower-column.yml");
367
+ test("/oracle/yml/test-lower-column.yml");
435
368
 
436
369
  assertTable(table);
437
370
  }
@@ -439,16 +372,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
439
372
  @Test
440
373
  public void testLowerColumnOptions() throws Exception
441
374
  {
442
- if (!canTest) {
443
- return;
444
- }
445
-
446
375
  String table = "TEST1";
447
376
 
448
377
  dropTable(table);
449
378
  createTable(table);
450
379
 
451
- run("/oracle/yml/test-lower-column-options.yml");
380
+ test("/oracle/yml/test-lower-column-options.yml");
452
381
 
453
382
  assertTable(table);
454
383
  }
@@ -456,16 +385,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
456
385
  @Test
457
386
  public void testReplace() throws Exception
458
387
  {
459
- if (!canTest) {
460
- return;
461
- }
462
-
463
388
  String table = "TEST1";
464
389
 
465
390
  dropTable(table);
466
391
  createTable(table);
467
392
 
468
- run("/oracle/yml/test-replace.yml");
393
+ test("/oracle/yml/test-replace.yml");
469
394
 
470
395
  assertGeneratedTable2(table);
471
396
  }
@@ -473,16 +398,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
473
398
  @Test
474
399
  public void testReplaceOCIMethod() throws Exception
475
400
  {
476
- if (!canTest) {
477
- return;
478
- }
479
-
480
401
  String table = "TEST1";
481
402
 
482
403
  dropTable(table);
483
404
  createTable(table);
484
405
 
485
- run("/oracle/yml/test-replace-oci-method.yml");
406
+ test("/oracle/yml/test-replace-oci-method.yml");
486
407
 
487
408
  assertGeneratedTable2(table);
488
409
  }
@@ -490,16 +411,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
490
411
  @Test
491
412
  public void testReplaceEmpty() throws Exception
492
413
  {
493
- if (!canTest) {
494
- return;
495
- }
496
-
497
414
  String table = "TEST1";
498
415
 
499
416
  dropTable(table);
500
417
  createTable(table);
501
418
 
502
- run("/oracle/yml/test-replace-empty.yml");
419
+ test("/oracle/yml/test-replace-empty.yml");
503
420
 
504
421
  assertTableEmpty(table);
505
422
  }
@@ -507,15 +424,11 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
507
424
  @Test
508
425
  public void testReplaceCreate() throws Exception
509
426
  {
510
- if (!canTest) {
511
- return;
512
- }
513
-
514
427
  String table = "TEST1";
515
428
 
516
429
  dropTable(table);
517
430
 
518
- run("/oracle/yml/test-replace.yml");
431
+ test("/oracle/yml/test-replace.yml");
519
432
 
520
433
  assertGeneratedTable2(table);
521
434
  }
@@ -524,16 +437,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
524
437
  @Test
525
438
  public void testReplaceLongName() throws Exception
526
439
  {
527
- if (!canTest) {
528
- return;
529
- }
530
-
531
440
  String table = "TEST12345678901234567890123456";
532
441
 
533
442
  dropTable(table);
534
443
  createTable(table);
535
444
 
536
- run("/oracle/yml/test-replace-long-name.yml");
445
+ test("/oracle/yml/test-replace-long-name.yml");
537
446
 
538
447
  assertGeneratedTable2(table);
539
448
  }
@@ -541,13 +450,9 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
541
450
  @Test
542
451
  public void testReplaceLongNameMultibyte() throws Exception
543
452
  {
544
- if (!canTest) {
545
- return;
546
- }
547
-
548
453
  String table = "TEST123456789012345678";
549
454
 
550
- run("/oracle/yml/test-replace-long-name-multibyte.yml");
455
+ test("/oracle/yml/test-replace-long-name-multibyte.yml");
551
456
 
552
457
  assertGeneratedTable2(table);
553
458
  }
@@ -555,16 +460,12 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
555
460
  @Test
556
461
  public void testStringTimestamp() throws Exception
557
462
  {
558
- if (!canTest) {
559
- return;
560
- }
561
-
562
463
  String table = "TEST1";
563
464
 
564
465
  dropTable(table);
565
466
  createTable(table);
566
467
 
567
- run("/oracle/yml/test-string-timestamp.yml");
468
+ test("/oracle/yml/test-string-timestamp.yml");
568
469
 
569
470
  assertTable(table);
570
471
  }
@@ -595,6 +496,10 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
595
496
 
596
497
  private void assertTable(String table) throws Exception
597
498
  {
499
+ if (!enabled) {
500
+ return;
501
+ }
502
+
598
503
  // datetime of UTC will be inserted by embulk.
599
504
  // datetime of default timezone will be selected by JDBC.
600
505
  TimeZone timeZone = TimeZone.getDefault();
@@ -642,12 +547,20 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
642
547
 
643
548
  private void assertTableEmpty(String table) throws Exception
644
549
  {
550
+ if (!enabled) {
551
+ return;
552
+ }
553
+
645
554
  List<List<Object>> rows = select(table);
646
555
  assertEquals(0, rows.size());
647
556
  }
648
557
 
649
558
  private void assertGeneratedTable1(String table) throws Exception
650
559
  {
560
+ if (!enabled) {
561
+ return;
562
+ }
563
+
651
564
  // datetime of UTC will be inserted by embulk.
652
565
  // datetime of default timezone will be selected by JDBC.
653
566
  TimeZone timeZone = TimeZone.getDefault();
@@ -695,6 +608,10 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
695
608
 
696
609
  private void assertGeneratedTable2(String table) throws Exception
697
610
  {
611
+ if (!enabled) {
612
+ return;
613
+ }
614
+
698
615
  // datetime of UTC will be inserted by embulk.
699
616
  // datetime of default timezone will be selected by JDBC.
700
617
  TimeZone timeZone = TimeZone.getDefault();
@@ -778,9 +695,4 @@ public class OracleOutputPluginTest extends AbstractJdbcOutputPluginTest
778
695
  return DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:TESTDB", "TEST_USER", "test_pw");
779
696
  }
780
697
 
781
- private void run(String ymlName) throws Exception
782
- {
783
- tester.run(convertYml(ymlName));
784
- }
785
-
786
698
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-oracle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
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-09-30 00:00:00.000000000 Z
11
+ date: 2016-10-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Inserts or updates records to a table.
14
14
  email:
@@ -19,8 +19,8 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - README.md
21
21
  - build.gradle
22
- - classpath/embulk-output-jdbc-0.6.4.jar
23
- - classpath/embulk-output-oracle-0.6.4.jar
22
+ - classpath/embulk-output-jdbc-0.6.5.jar
23
+ - classpath/embulk-output-oracle-0.6.5.jar
24
24
  - lib/embulk/native/x86_64-linux/libembulk-output-oracle-oci.so
25
25
  - lib/embulk/native/x86_64-windows/embulk-output-oracle-oci.dll
26
26
  - lib/embulk/output/oracle.rb