Update jsonpath dependency (#5794)

* Update JSONPath Library

Re: #5792

- Add a unit test containing a JSONPath conditional
- Update the JSONPath library and no longer exclude the json-smart dependency.
- I believe the original reason for excluding this has been fixed: https://github.com/json-path/JsonPath/pull/315

* Add test

* Fix test
This commit is contained in:
Dylan Wylie 2018-06-15 21:50:48 +01:00 committed by Jonathan Wei
parent 1f700bb880
commit 8c6651022d
3 changed files with 29 additions and 7 deletions

View File

@ -30,6 +30,7 @@ import org.junit.Assert;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@ -79,6 +80,33 @@ public class JSONParseSpecTest
Assert.assertNull(parsedRow.get("path_omg2"));
}
@Test
public void testParseRowWithConditional()
{
final JSONParseSpec parseSpec = new JSONParseSpec(
new TimestampSpec("timestamp", "iso", null),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("foo")), null, null),
new JSONPathSpec(
true,
ImmutableList.of(
new JSONPathFieldSpec(JSONPathFieldType.PATH, "foo", "$.[?(@.maybe_object)].maybe_object.foo.test"),
new JSONPathFieldSpec(JSONPathFieldType.PATH, "bar", "$.[?(@.something_else)].something_else.foo")
)
),
null
);
final Map<String, Object> expected = new HashMap<>();
expected.put("foo", new ArrayList());
expected.put("bar", Arrays.asList("test"));
final Parser<String, Object> parser = parseSpec.makeParser();
final Map<String, Object> parsedRow = parser.parseToMap("{\"something_else\": {\"foo\": \"test\"}}");
Assert.assertNotNull(parsedRow);
Assert.assertEquals(expected, parsedRow);
}
@Test
public void testSerde() throws IOException
{

View File

@ -92,12 +92,6 @@
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<exclusions>
<exclusion>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.thisptr</groupId>

View File

@ -638,7 +638,7 @@
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.1.0</version>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>net.thisptr</groupId>