embulk-input-gcs 0.3.1 → 0.3.2

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
  SHA256:
3
- metadata.gz: 1c252ffc4a609f7e29fffc86eb665c1032e2580b04277671157d44450becf3c0
4
- data.tar.gz: a5c8ce1851371760195c3f51329fd3eb20f3e6d34e643d8ff833d18d77205b8c
3
+ metadata.gz: 1464dc7e445f4ed06ee28336fb0eb53534fbb78b7ee6272c25d9b8a7faece5f2
4
+ data.tar.gz: b7f87e75f2bc970e9e4aa890299528b6a930f3e621444495f5563561c07a81c6
5
5
  SHA512:
6
- metadata.gz: e46064fe213ac097602e355f8d2e456ad16d070ada11ed7fc0e5f50c571f20514b2a97eb59cb9ce2c31d9a2d6f39cb05ef76edd5c65c2e27de60d2e39491decc
7
- data.tar.gz: 468afcb058f36ab42e40f8267450156f5fd09b3f54ee5ee17e7f7b23ac976a5dd19322cb624b6d25bf4de606f37d1738d6cceeb927ebd42983519295af7f53f2
6
+ metadata.gz: dbff12cfba5f647596023f6185f4177a533b0e90b738ce9861d437fc3304a971da471e8c06bd4564174cfd16f709488de76a65aba2a75ead3a78932663d1a3c3
7
+ data.tar.gz: da85294930e6cf321164d750f228ee3bafa91a352ed0fbfd44673509ef58acf70f629b98523eea7a38a8dd110b58cca2ba6542fc30ad0704c97264573bf42692
@@ -1,5 +1,7 @@
1
1
  language: java
2
2
 
3
+ dist: trusty
4
+
3
5
  jdk:
4
6
  - oraclejdk8
5
7
 
@@ -1,3 +1,6 @@
1
+ ## 0.3.2 - 2020-01-13
2
+ * [maintenance] Improve base64encode method for last_path [#47](https://github.com/embulk/embulk-input-gcs/pull/47)
3
+
1
4
  ## 0.3.1 - 2019-01-07
2
5
  * [maintenance] Updated Google Cloud Storage API Client Library from v1-rev59-1.21.0 to 1.56.0 [#40](https://github.com/embulk/embulk-input-gcs/pull/40)
3
6
  * [new feature] Refactor to use InputStream (to replace local file download)
@@ -20,7 +20,7 @@ configurations {
20
20
  sourceCompatibility = 1.8
21
21
  targetCompatibility = 1.8
22
22
 
23
- version = "0.3.1"
23
+ version = "0.3.2"
24
24
 
25
25
  // Relocate Guava packages since it's incompatible with Guava's version from Embulk
26
26
  shadowJar {
@@ -81,7 +81,7 @@ task checkstyle(type: Checkstyle) {
81
81
  source = sourceSets.main.allJava + sourceSets.test.allJava
82
82
  }
83
83
 
84
- task gem(type: JRubyExec, dependsOn: ["build", "gemspec", "classpath"]) {
84
+ task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
85
85
  script "gem"
86
86
  scriptArgs "build", "build/gemspec"
87
87
  doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
@@ -80,7 +80,7 @@ public class GcsFileInput
80
80
  return builder.build();
81
81
  }
82
82
 
83
- // String nextToken = base64Encode(0x0a + 0x01~0x27 + filePath);
83
+ // String nextToken = base64Encode(0x0a + ASCII character according to utf8EncodeLength position+ filePath);
84
84
  @VisibleForTesting
85
85
  static String base64Encode(String path)
86
86
  {
@@ -88,9 +88,17 @@ public class GcsFileInput
88
88
  byte[] utf8 = path.getBytes(Charsets.UTF_8);
89
89
  LOG.debug("path string: {} ,path length:{} \" + ", path, utf8.length);
90
90
 
91
+ int utf8EncodeLength = utf8.length;
92
+ if (utf8EncodeLength >= 128) {
93
+ throw new ConfigException(String.format("last_path '%s' is too long to encode. Please try to reduce its length", path));
94
+ }
95
+
91
96
  encoding = new byte[utf8.length + 2];
92
97
  encoding[0] = 0x0a;
93
- encoding[1] = Byte.valueOf(String.valueOf(path.length()));
98
+
99
+ // for example: 60 -> '<'
100
+ char temp = (char) utf8EncodeLength;
101
+ encoding[1] = (byte) temp;
94
102
  System.arraycopy(utf8, 0, encoding, 2, utf8.length);
95
103
 
96
104
  String s = BaseEncoding.base64().encode(encoding);
@@ -346,6 +346,23 @@ public class TestGcsFileInputPlugin
346
346
  runner.transaction(config, new Control());
347
347
  }
348
348
 
349
+ @Test(expected = ConfigException.class)
350
+ public void testLastPathTooLong() throws Exception
351
+ {
352
+ ConfigSource config = Exec.newConfigSource()
353
+ .set("bucket", GCP_BUCKET)
354
+ .set("paths", Arrays.asList())
355
+ .set("auth_method", "private_key")
356
+ .set("service_account_email", GCP_EMAIL)
357
+ .set("p12_keyfile", GCP_P12_KEYFILE)
358
+ .set("json_keyfile", GCP_JSON_KEYFILE)
359
+ .set("application_name", GCP_APPLICATION_NAME)
360
+ .set("last_path", "テストダミー/テストダミーテストダミーテストダミーテストダミーテストダミーテストダミーテストダミー.csv")
361
+ .set("parser", parserConfig(schemaConfig()));
362
+
363
+ runner.transaction(config, new Control());
364
+ }
365
+
349
366
  @Test
350
367
  public void testGcsFileInputByOpen()
351
368
  {
@@ -375,6 +392,10 @@ public class TestGcsFileInputPlugin
375
392
  String params = "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc127";
376
393
  String expected = "Cn9jY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjMTI3";
377
394
  assertEquals(expected, GcsFileInput.base64Encode(params));
395
+
396
+ params = "テストダミー/テス123/テストダミー/テストダミ.csv";
397
+ expected = "CkPjg4bjgrnjg4jjg4Djg5/jg7wv44OG44K5MTIzL+ODhuOCueODiOODgOODn+ODvC/jg4bjgrnjg4jjg4Djg58uY3N2";
398
+ assertEquals(expected, GcsFileInput.base64Encode(params));
378
399
  }
379
400
 
380
401
  private ConfigSource config()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-gcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Akama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-07 00:00:00.000000000 Z
11
+ date: 2020-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -56,7 +56,7 @@ files:
56
56
  - classpath/checker-compat-qual-2.5.2.jar
57
57
  - classpath/commons-codec-1.10.jar
58
58
  - classpath/commons-logging-1.2.jar
59
- - classpath/embulk-input-gcs-0.3.1-shadow.jar
59
+ - classpath/embulk-input-gcs-0.3.2-shadow.jar
60
60
  - classpath/error_prone_annotations-2.1.3.jar
61
61
  - classpath/gax-1.35.1.jar
62
62
  - classpath/gax-httpjson-0.52.1.jar