embulk-output-azure_blob_storage 0.1.7 → 0.1.8

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: 91f151194182d73b78ec9b2b82ab9647b10678d0
4
- data.tar.gz: cb78773244114d953c9f5b377fe3cc58ef1d4972
3
+ metadata.gz: 8871fd8a62b364fdfedbf7c6002012e2883dcaf1
4
+ data.tar.gz: 3e16f5d3af521d09332d525db0b9840abc20d424
5
5
  SHA512:
6
- metadata.gz: 5e14c9a755cb3ad1c5fae3ffe0e13cd74a3f926ef97218ab05cc41a990f6de1090c97ed309030615dcd3c6a08788aa90694d427ae37ea50ca0563737af8e62a4
7
- data.tar.gz: 79f11b084a54773c1ebb56916f7977fb7714bd8a6dd9166ada5fa12a69e4c9bc0b4ccd13636869057fc985f88dfa66f3f246c00bf8444455bf6f1b76c19d054d
6
+ metadata.gz: 6e774a201f2a403917acf2a3c4b26e570dcf6033a05d31bec70b25450d7cbc49c6d7908db7d8ea21ee74004fc776bca0a5f55384136b32b124d52fc113f51ced
7
+ data.tar.gz: dc2c7bf3ad64e781281bf189df5a1e664217e032760230710c875b35ad129a0c9140dd8ac6203b430d5cc90ef4af47b5e76ce4d72adc5cf61b783eea090c4faf
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
+ dist: trusty
2
+
1
3
  language: java
2
4
 
3
5
  jdk:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.8 - 2018-12-04
2
+ * [maintenance] Always delete temporary file [#15](https://github.com/embulk/embulk-output-azure_blob_storage/pull/15)
3
+
1
4
  ## 0.1.7 - 2018-10-19
2
5
  * [maintenance] Close BufferedInputStream before delete temporary file [#14](https://github.com/sakama/embulk-output-azure_blob_storage/pull/14)
3
6
 
data/build.gradle CHANGED
@@ -17,7 +17,7 @@ configurations {
17
17
  sourceCompatibility = 1.8
18
18
  targetCompatibility = 1.8
19
19
 
20
- version = "0.1.7"
20
+ version = "0.1.8"
21
21
 
22
22
  dependencies {
23
23
  compile "org.embulk:embulk-core:0.9.8"
@@ -1,5 +1,6 @@
1
1
  package org.embulk.output.azure_blob_storage;
2
2
 
3
+ import com.google.common.annotations.VisibleForTesting;
3
4
  import com.google.common.base.Throwables;
4
5
  import com.microsoft.azure.storage.CloudStorageAccount;
5
6
  import com.microsoft.azure.storage.StorageException;
@@ -224,11 +225,6 @@ public class AzureBlobStorageFileOutputPlugin
224
225
  blob.upload(in, file.length());
225
226
  log.info("Upload completed {} to {}", file.getAbsolutePath(), filePath);
226
227
  }
227
- if (file.exists()) {
228
- if (!file.delete()) {
229
- log.warn("Couldn't delete local file " + file.getAbsolutePath());
230
- }
231
- }
232
228
  return null;
233
229
  }
234
230
 
@@ -268,6 +264,13 @@ public class AzureBlobStorageFileOutputPlugin
268
264
  catch (InterruptedException ex) {
269
265
  throw Throwables.propagate(ex);
270
266
  }
267
+ finally {
268
+ if (file.exists()) {
269
+ if (!file.delete()) {
270
+ log.warn("Couldn't delete local file " + file.getAbsolutePath());
271
+ }
272
+ }
273
+ }
271
274
  }
272
275
  return null;
273
276
  }
@@ -286,5 +289,11 @@ public class AzureBlobStorageFileOutputPlugin
286
289
  {
287
290
  return Exec.newTaskReport();
288
291
  }
292
+
293
+ @VisibleForTesting
294
+ public boolean isTempFileExist()
295
+ {
296
+ return file.exists();
297
+ }
289
298
  }
290
299
  }
@@ -19,7 +19,6 @@ import org.embulk.spi.FileOutputPlugin;
19
19
  import org.embulk.spi.FileOutputRunner;
20
20
  import org.embulk.spi.OutputPlugin;
21
21
  import org.embulk.spi.Schema;
22
- import org.embulk.spi.TransactionalFileOutput;
23
22
  import org.embulk.standards.CsvParserPlugin;
24
23
 
25
24
  import org.junit.Before;
@@ -27,6 +26,7 @@ import org.junit.BeforeClass;
27
26
  import org.junit.Rule;
28
27
  import org.junit.Test;
29
28
  import static org.junit.Assert.assertEquals;
29
+ import static org.junit.Assert.assertTrue;
30
30
  import static org.junit.Assume.assumeNotNull;
31
31
 
32
32
  import java.io.BufferedReader;
@@ -203,7 +203,7 @@ public class TestAzureBlobStorageFileOutputPlugin
203
203
  Schema schema = configSource.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();
204
204
  runner.transaction(configSource, schema, 0, new Control());
205
205
 
206
- TransactionalFileOutput output = plugin.open(task.dump(), 0);
206
+ AzureBlobStorageFileOutputPlugin.AzureFileOutput output = (AzureBlobStorageFileOutputPlugin.AzureFileOutput) plugin.open(task.dump(), 0);
207
207
 
208
208
  output.nextFile();
209
209
 
@@ -217,6 +217,7 @@ public class TestAzureBlobStorageFileOutputPlugin
217
217
 
218
218
  String remotePath = AZURE_PATH_PREFIX + String.format(task.getSequenceFormat(), 0, 0) + task.getFileNameExtension();
219
219
  assertRecords(remotePath);
220
+ assertTrue(!output.isTempFileExist());
220
221
  }
221
222
 
222
223
  @Test
@@ -227,7 +228,7 @@ public class TestAzureBlobStorageFileOutputPlugin
227
228
  Schema schema = configSource.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();
228
229
  runner.transaction(configSource, schema, 0, new Control());
229
230
 
230
- TransactionalFileOutput output = plugin.open(task.dump(), 0);
231
+ AzureBlobStorageFileOutputPlugin.AzureFileOutput output = (AzureBlobStorageFileOutputPlugin.AzureFileOutput) plugin.open(task.dump(), 0);
231
232
 
232
233
  output.nextFile();
233
234
 
@@ -246,10 +247,11 @@ public class TestAzureBlobStorageFileOutputPlugin
246
247
  }
247
248
  catch (Exception ex) {
248
249
  assertEquals(FileNotFoundException.class, ex.getCause().getClass());
250
+ assertTrue(!output.isTempFileExist());
249
251
  }
250
252
  }
251
253
 
252
- @Test(expected = RuntimeException.class)
254
+ @Test
253
255
  public void testAzureFileOutputByOpenWithRetry() throws Exception
254
256
  {
255
257
  ConfigSource configSource = config();
@@ -257,7 +259,7 @@ public class TestAzureBlobStorageFileOutputPlugin
257
259
  Schema schema = configSource.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();
258
260
  runner.transaction(configSource, schema, 0, new Control());
259
261
 
260
- TransactionalFileOutput output = plugin.open(task.dump(), 0);
262
+ AzureBlobStorageFileOutputPlugin.AzureFileOutput output = (AzureBlobStorageFileOutputPlugin.AzureFileOutput) plugin.open(task.dump(), 0);
261
263
 
262
264
  output.nextFile();
263
265
 
@@ -274,7 +276,12 @@ public class TestAzureBlobStorageFileOutputPlugin
274
276
  Field container = AzureBlobStorageFileOutputPlugin.AzureFileOutput.class.getDeclaredField("containerName");
275
277
  container.setAccessible(true);
276
278
  container.set(output, "non-existing-container");
277
- output.finish();
279
+ try {
280
+ output.finish();
281
+ }
282
+ catch (RuntimeException e) {
283
+ assertTrue(!output.isTempFileExist());
284
+ }
278
285
  }
279
286
 
280
287
  public ConfigSource config()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-azure_blob_storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Akama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-19 00:00:00.000000000 Z
11
+ date: 2019-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -62,10 +62,10 @@ files:
62
62
  - src/test/java/org/embulk/output/azure_blob_storage/TestAzureBlobStorageFileOutputPlugin.java
63
63
  - src/test/resources/sample_01.csv
64
64
  - src/test/resources/sample_02.csv
65
+ - classpath/embulk-output-azure_blob_storage-0.1.8.jar
65
66
  - classpath/azure-storage-8.0.0.jar
66
67
  - classpath/guava-20.0.jar
67
68
  - classpath/azure-keyvault-core-1.0.0.jar
68
- - classpath/embulk-output-azure_blob_storage-0.1.7.jar
69
69
  - classpath/jackson-core-2.9.4.jar
70
70
  homepage: https://github.com/embulk/embulk-output-azure_blob_storage
71
71
  licenses: