embulk-output-sqlserver 0.6.4 → 0.6.5

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: e4e793c760c471271fa0388e2313a9d2d329eb6f
4
- data.tar.gz: 54633fc992bbe7f01faf4873ce22cb22bf738497
3
+ metadata.gz: 061683eb985abcdb6dfdeb2f8f69d959724699da
4
+ data.tar.gz: acf3b941ce60f1a7f3ff844893e5bbfe1d50eb59
5
5
  SHA512:
6
- metadata.gz: 963f63991e65b0b49899fd4c2c951374198191e6aaddd56bc8d33693f446de37468af7edd6b91d4c9c7d64d3688765c35ac0f6e3f5f3457de5142f2c28a4bf8d
7
- data.tar.gz: 92ee454069669fb5378b6d43bd564e931cc3e73885e2bdc4c39b01c11d4576a3b6ae44fb3dce9024fcc010d7b1c1e4f1b94facf76443aa87191a6fd8333025c0
6
+ metadata.gz: 32691b72800b548ede9ba7d9035c7fd948542f5c273e6a1deca18363966b0ccd55d5a35792c53cb1d98eb575082f3651c5b200abe73e41f1b97c8f1628817500
7
+ data.tar.gz: 4c43cda38c7c2f27650bb072efe6c02cccb3f7371b7c20274bb4f30b77b3c5af6e2c3bb2c9a51a7b6b98bf10e75c4432cd2a60b942903edae146ee8dabfde6ca
@@ -2,7 +2,6 @@ package org.embulk.output.sqlserver;
2
2
 
3
3
  import org.embulk.output.AbstractJdbcOutputPluginTest;
4
4
  import org.embulk.output.SQLServerOutputPlugin;
5
- import org.embulk.output.tester.EmbulkPluginTester;
6
5
  import org.embulk.spi.OutputPlugin;
7
6
  import org.junit.BeforeClass;
8
7
  import org.junit.Test;
@@ -26,8 +25,6 @@ import static org.junit.Assert.assertEquals;
26
25
  public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
27
26
  {
28
27
  private static boolean useJtdsDriver = false;
29
- private static boolean canTest;
30
- private static EmbulkPluginTester tester = new EmbulkPluginTester();
31
28
  static {
32
29
  tester.addPlugin(OutputPlugin.class, "sqlserver", SQLServerOutputPlugin.class);
33
30
  }
@@ -44,11 +41,11 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
44
41
 
45
42
  try {
46
43
  new SQLServerOutputPluginTest().connect();
47
- canTest = true;
44
+ enabled = true;
48
45
  } catch (Throwable t) {
49
46
  System.out.println(t);
50
47
  } finally {
51
- if (!canTest) {
48
+ if (!enabled) {
52
49
  System.out.println("Warning: you should prepare database in order to test (server = localhost, port = 1433, instance = SQLEXPRESS, database = TESTDB, user = TEST_USER, password = TEST_PW).");
53
50
  }
54
51
  }
@@ -57,17 +54,13 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
57
54
  @Test
58
55
  public void testInsertDirect() throws Exception
59
56
  {
60
- if (!canTest) {
61
- return;
62
- }
63
-
64
57
  String table = "TEST1";
65
58
 
66
59
  dropTable(table);
67
60
  createTable(table);
68
61
  insertRecord(table);
69
62
 
70
- tester.run(convertYml("/sqlserver/yml/test-insert-direct.yml"));
63
+ test("/sqlserver/yml/test-insert-direct.yml");
71
64
 
72
65
  assertTable(1, table);
73
66
  }
@@ -75,15 +68,11 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
75
68
  @Test
76
69
  public void testInsertDirectCreate() throws Exception
77
70
  {
78
- if (!canTest) {
79
- return;
80
- }
81
-
82
71
  String table = "TEST1";
83
72
 
84
73
  dropTable(table);
85
74
 
86
- tester.run(convertYml("/sqlserver/yml/test-insert-direct.yml"));
75
+ test("/sqlserver/yml/test-insert-direct.yml");
87
76
 
88
77
  assertGeneratedTable(table);
89
78
  }
@@ -91,17 +80,13 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
91
80
  @Test
92
81
  public void testInsert() throws Exception
93
82
  {
94
- if (!canTest) {
95
- return;
96
- }
97
-
98
83
  String table = "TEST1";
99
84
 
100
85
  dropTable(table);
101
86
  createTable(table);
102
87
  insertRecord(table);
103
88
 
104
- tester.run(convertYml("/sqlserver/yml/test-insert.yml"));
89
+ test("/sqlserver/yml/test-insert.yml");
105
90
 
106
91
  assertTable(1, table);
107
92
  }
@@ -109,15 +94,11 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
109
94
  @Test
110
95
  public void testInsertCreate() throws Exception
111
96
  {
112
- if (!canTest) {
113
- return;
114
- }
115
-
116
97
  String table = "TEST1";
117
98
 
118
99
  dropTable(table);
119
100
 
120
- tester.run(convertYml("/sqlserver/yml/test-insert.yml"));
101
+ test("/sqlserver/yml/test-insert.yml");
121
102
 
122
103
  assertGeneratedTable(table);
123
104
  }
@@ -125,17 +106,13 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
125
106
  @Test
126
107
  public void testTruncateInsert() throws Exception
127
108
  {
128
- if (!canTest) {
129
- return;
130
- }
131
-
132
109
  String table = "TEST1";
133
110
 
134
111
  dropTable(table);
135
112
  createTable(table);
136
113
  insertRecord(table);
137
114
 
138
- tester.run(convertYml("/sqlserver/yml/test-truncate-insert.yml"));
115
+ test("/sqlserver/yml/test-truncate-insert.yml");
139
116
 
140
117
  assertTable(0, table);
141
118
  }
@@ -143,17 +120,13 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
143
120
  @Test
144
121
  public void testReplace() throws Exception
145
122
  {
146
- if (!canTest) {
147
- return;
148
- }
149
-
150
123
  String table = "TEST1";
151
124
 
152
125
  dropTable(table);
153
126
  createTable(table);
154
127
  insertRecord(table);
155
128
 
156
- tester.run(convertYml("/sqlserver/yml/test-replace.yml"));
129
+ test("/sqlserver/yml/test-replace.yml");
157
130
 
158
131
  assertGeneratedTable(table);
159
132
  }
@@ -161,10 +134,6 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
161
134
  @Test
162
135
  public void testReplaceLongName() throws Exception
163
136
  {
164
- if (!canTest) {
165
- return;
166
- }
167
-
168
137
  String table = "TEST___A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789";
169
138
  assertEquals(127, table.length());
170
139
 
@@ -172,7 +141,7 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
172
141
  createTable(table);
173
142
  insertRecord(table);
174
143
 
175
- tester.run(convertYml("/sqlserver/yml/test-replace-long-name.yml"));
144
+ test("/sqlserver/yml/test-replace-long-name.yml");
176
145
 
177
146
  assertGeneratedTable(table);
178
147
  }
@@ -180,15 +149,11 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
180
149
  @Test
181
150
  public void testReplaceCreate() throws Exception
182
151
  {
183
- if (!canTest) {
184
- return;
185
- }
186
-
187
152
  String table = "TEST1";
188
153
 
189
154
  dropTable(table);
190
155
 
191
- tester.run(convertYml("/sqlserver/yml/test-replace.yml"));
156
+ test("/sqlserver/yml/test-replace.yml");
192
157
 
193
158
  assertGeneratedTable(table);
194
159
  }
@@ -196,17 +161,13 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
196
161
  @Test
197
162
  public void testStringToTimestamp() throws Exception
198
163
  {
199
- if (!canTest) {
200
- return;
201
- }
202
-
203
164
  String table = "TEST1";
204
165
 
205
166
  dropTable(table);
206
167
  createTable(table);
207
168
  insertRecord(table);
208
169
 
209
- tester.run(convertYml("/sqlserver/yml/test-string-timestamp.yml"));
170
+ test("/sqlserver/yml/test-string-timestamp.yml");
210
171
 
211
172
  assertTable(1, table, true);
212
173
  }
@@ -214,7 +175,7 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
214
175
  @Test
215
176
  public void testNativeString() throws Exception
216
177
  {
217
- if (!canTest) {
178
+ if (!enabled) {
218
179
  return;
219
180
  }
220
181
 
@@ -223,7 +184,7 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
223
184
  dropTable(table);
224
185
  executeSQL(String.format("CREATE TABLE %S (ITEM1 CHAR(4), ITEM2 VARCHAR(8), ITEM3 TEXT, ITEM4 NCHAR(4), ITEM5 NVARCHAR(8), ITEM6 NTEXT)", table));
225
186
 
226
- tester.run(convertYml("/sqlserver/yml/test-native-string.yml"));
187
+ test("/sqlserver/yml/test-native-string.yml");
227
188
 
228
189
  List<List<Object>> rows = select(table);
229
190
  assertEquals(2, rows.size());
@@ -250,7 +211,7 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
250
211
  @Test
251
212
  public void testNativeInteger() throws Exception
252
213
  {
253
- if (!canTest) {
214
+ if (!enabled) {
254
215
  return;
255
216
  }
256
217
 
@@ -259,7 +220,7 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
259
220
  dropTable(table);
260
221
  executeSQL(String.format("CREATE TABLE %S (ITEM1 TINYINT, ITEM2 SMALLINT, ITEM3 INT, ITEM4 BIGINT, ITEM5 BIT)", table));
261
222
 
262
- tester.run(convertYml("/sqlserver/yml/test-native-integer.yml"));
223
+ test("/sqlserver/yml/test-native-integer.yml");
263
224
 
264
225
  List<List<Object>> rows = select(table);
265
226
  assertEquals(2, rows.size());
@@ -284,7 +245,7 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
284
245
  @Test
285
246
  public void testNativeDecimal() throws Exception
286
247
  {
287
- if (!canTest) {
248
+ if (!enabled) {
288
249
  return;
289
250
  }
290
251
 
@@ -293,7 +254,7 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
293
254
  dropTable(table);
294
255
  executeSQL(String.format("CREATE TABLE %S (ITEM1 DECIMAL(20,2), ITEM2 NUMERIC(20,2), ITEM3 SMALLMONEY, ITEM4 MONEY, ITEM5 REAL, ITEM6 FLOAT)", table));
295
256
 
296
- tester.run(convertYml("/sqlserver/yml/test-native-decimal.yml"));
257
+ test("/sqlserver/yml/test-native-decimal.yml");
297
258
 
298
259
  List<List<Object>> rows = select(table);
299
260
  assertEquals(2, rows.size());
@@ -320,7 +281,7 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
320
281
  @Test
321
282
  public void testNativeDate() throws Exception
322
283
  {
323
- if (!canTest) {
284
+ if (!enabled) {
324
285
  return;
325
286
  }
326
287
 
@@ -329,7 +290,7 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
329
290
  dropTable(table);
330
291
  executeSQL(String.format("CREATE TABLE %S (ITEM1 DATE, ITEM2 SMALLDATETIME, ITEM3 DATETIME, ITEM4 DATETIME2, ITEM5 DATETIME2(2), ITEM6 TIME, ITEM7 TIME(2))", table));
331
292
 
332
- tester.run(convertYml("/sqlserver/yml/test-native-date.yml"));
293
+ test("/sqlserver/yml/test-native-date.yml");
333
294
 
334
295
  List<List<Object>> rows = select(table);
335
296
  assertEquals(2, rows.size());
@@ -360,17 +321,13 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
360
321
  @Test
361
322
  public void testNative() throws Exception
362
323
  {
363
- if (!canTest) {
364
- return;
365
- }
366
-
367
324
  String table = "TEST1";
368
325
 
369
326
  dropTable(table);
370
327
  createTable(table);
371
328
  insertRecord(table);
372
329
 
373
- tester.run(convertYml("/sqlserver/yml/test-native.yml"));
330
+ test("/sqlserver/yml/test-native.yml");
374
331
 
375
332
  assertTable(1, table);
376
333
  }
@@ -378,19 +335,14 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
378
335
  @Test
379
336
  public void testJtds() throws Exception
380
337
  {
381
- boolean canTestJtds = false;
382
338
  useJtdsDriver = true;
383
339
  try {
384
- new SQLServerOutputPluginTest().connect();
385
- canTestJtds = true;
340
+ connect();
386
341
  } catch (Throwable t) {
387
342
  System.out.println(t);
388
- } finally {
389
- if (!canTestJtds) {
390
- System.out.println("Warning: jTDS driver can't connect to database.");
391
- System.out.println("(server = localhost, port = 1433, instance = SQLEXPRESS, database = TESTDB, user = TEST_USER, password = TEST_PW)");
392
- return;
393
- }
343
+ System.out.println("Warning: jTDS driver can't connect to database.");
344
+ System.out.println("(server = localhost, port = 1433, instance = SQLEXPRESS, database = TESTDB, user = TEST_USER, password = TEST_PW)");
345
+ return;
394
346
  }
395
347
 
396
348
  try {
@@ -398,7 +350,7 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
398
350
  dropTable(table);
399
351
  createTable(table);
400
352
  insertRecord(table);
401
- tester.run(convertYml("/sqlserver/yml/test-jtds.yml"));
353
+ test("/sqlserver/yml/test-jtds.yml");
402
354
  assertTableJtds(1, table);
403
355
  } finally {
404
356
  useJtdsDriver = false;
@@ -518,6 +470,10 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
518
470
 
519
471
  private void assertTable(int skip, String table, boolean precise) throws Exception
520
472
  {
473
+ if (!enabled) {
474
+ return;
475
+ }
476
+
521
477
  List<List<Object>> rows = select(table);
522
478
  assertEquals(skip + 3, rows.size());
523
479
  rows = rows.subList(skip, skip + 3);
@@ -614,6 +570,10 @@ public class SQLServerOutputPluginTest extends AbstractJdbcOutputPluginTest
614
570
 
615
571
  private void assertGeneratedTable(String table) throws Exception
616
572
  {
573
+ if (!enabled) {
574
+ return;
575
+ }
576
+
617
577
  List<List<Object>> rows = select(table);
618
578
  assertEquals(3, rows.size());
619
579
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-sqlserver
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-sqlserver-0.6.4.jar
22
+ - classpath/embulk-output-jdbc-0.6.5.jar
23
+ - classpath/embulk-output-sqlserver-0.6.5.jar
24
24
  - classpath/jtds-1.3.1.jar
25
25
  - lib/embulk/output/sqlserver.rb
26
26
  - src/main/java/org/embulk/output/SQLServerOutputPlugin.java