embulk-filter-column 0.6.0.pre1 → 0.6.0.pre2

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: 8ca161d763f10dc37da758c3bac6d0384a3b4edf
4
- data.tar.gz: dfe8251c7268898b6ba42c4aa0da2298b2242ba7
3
+ metadata.gz: 3b693b9f514309a94b2fea4e85714e6e0c9de0f1
4
+ data.tar.gz: ed56dc5b557605436985615eacdbc71b700a7640
5
5
  SHA512:
6
- metadata.gz: c03b1816ca0d300c3b9260dea666d3a361ce9413e685e4ac419923ad27ca925428031969888c7a9d8f25cd511ae127acb987194b761b608044319fee96653ea8
7
- data.tar.gz: 37d963fc19b1c78028ce043810b3c88badba92b8a72d116e2b30e208dcacdd85a88d2d55a6379cfd9fffff7d234fbd50b306c40d9a3adc74316e7cc522b295bb
6
+ metadata.gz: 5d1399f4e807811687c032a1738254bc2013d0a760a88343ec03d3bd3b36309cadb46f1c805859d68724a1bb40b0bc73e1908dbab939cb54e453f7a6db93b5b1
7
+ data.tar.gz: 7937b001df59b540c8a10fcbd4e3c707565d5e9f9ca4e919d96b7403252d74b654ee8ca0b476fe53d504192ef9302b678f209bed30071e873af48f0a74d8ae2e
data/build.gradle CHANGED
@@ -15,7 +15,7 @@ configurations {
15
15
  provided
16
16
  }
17
17
 
18
- version = "0.6.0.pre1"
18
+ version = "0.6.0.pre2"
19
19
  sourceCompatibility = 1.7
20
20
  targetCompatibility = 1.7
21
21
 
@@ -1,5 +1,6 @@
1
1
  package org.embulk.filter.column;
2
2
 
3
+ import com.dena.analytics.jsonpathcompiler.InvalidPathException;
3
4
  import com.dena.analytics.jsonpathcompiler.expressions.Path;
4
5
  import com.dena.analytics.jsonpathcompiler.expressions.path.PathCompiler;
5
6
  import com.dena.analytics.jsonpathcompiler.expressions.path.PathToken;
@@ -188,7 +189,12 @@ public class JsonVisitor
188
189
  if (!PathCompiler.isProbablyJsonPath(name)) {
189
190
  continue;
190
191
  }
191
- Path path = PathCompiler.compile(name);
192
+ Path path;
193
+ try {
194
+ path = PathCompiler.compile(name);
195
+ } catch (InvalidPathException e) {
196
+ throw new ConfigException(String.format("path %s, %s", name, e.getMessage()));
197
+ }
192
198
  PathToken parts = path.getRoot();
193
199
  int count = parts.getTokenCount();
194
200
  StringBuilder partialPath = new StringBuilder("$");
@@ -10,6 +10,7 @@ import org.embulk.spi.Schema;
10
10
  import org.junit.Before;
11
11
  import org.junit.Rule;
12
12
  import org.junit.Test;
13
+ import org.junit.rules.ExpectedException;
13
14
  import org.msgpack.value.MapValue;
14
15
  import org.msgpack.value.Value;
15
16
  import org.msgpack.value.ValueFactory;
@@ -685,7 +686,7 @@ public class TestJsonVisitor
685
686
  }
686
687
 
687
688
  // It is recognized multi properties if the square brackets does not close properly
688
- @Test(expected = InvalidPathException.class)
689
+ @Test(expected = ConfigException.class)
689
690
  public void constructor_mustBeRaisedInvalidPathExceptionWithPropertyIsNotSeparatedByCommas()
690
691
  {
691
692
  PluginTask task = taskFromYamlString(
@@ -788,4 +789,23 @@ public class TestJsonVisitor
788
789
  .build();
789
790
  jsonVisitor(task, inputSchema);
790
791
  }
792
+
793
+ @Rule
794
+ public ExpectedException thrown = ExpectedException.none();
795
+
796
+ @Test
797
+ public void constructor_mustBeRaisedConfigExceptionEffectively()
798
+ {
799
+ PluginTask task = taskFromYamlString(
800
+ "type: column",
801
+ "columns:",
802
+ "- name: \"$['json][''key1']\"");
803
+ Schema inputSchema = Schema.builder()
804
+ .add("json1", JSON)
805
+ .build();
806
+
807
+ thrown.expectMessage("path $['json][''key1'], Property must be separated by comma or Property must be terminated close square bracket at index 9");
808
+
809
+ jsonVisitor(task, inputSchema);
810
+ }
791
811
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-filter-column
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.pre1
4
+ version: 0.6.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-01 00:00:00.000000000 Z
11
+ date: 2016-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,7 +78,7 @@ files:
78
78
  - classpath/accessors-smart-1.1.jar
79
79
  - classpath/asm-5.0.3.jar
80
80
  - classpath/commons-lang3-3.4.jar
81
- - classpath/embulk-filter-column-0.6.0.pre1.jar
81
+ - classpath/embulk-filter-column-0.6.0.pre2.jar
82
82
  - classpath/json-smart-2.2.1.jar
83
83
  - classpath/JsonPathCompiler-0.0.6.jar
84
84
  - classpath/slf4j-api-1.7.21.jar