Repository: brooklyn-server Updated Branches: refs/heads/master 33d39242e -> 34b4c0df9
Upgrade json-path to 2.4.0 (from 2.0.0) This supports `.size()` Also fix the json-path dependency, to exclude conflicting versions Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/495d73a2 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/495d73a2 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/495d73a2 Branch: refs/heads/master Commit: 495d73a288d4619a35c9a1cffc6502524a809ee0 Parents: 092edf1 Author: Aled Sage <[email protected]> Authored: Wed Aug 2 12:35:18 2017 +0100 Committer: Aled Sage <[email protected]> Committed: Thu Aug 3 13:45:38 2017 +0100 ---------------------------------------------------------------------- .../brooklyn/feed/http/JsonFunctionsTest.java | 15 ++++++++ karaf/features/src/main/feature/feature.xml | 3 +- parent/pom.xml | 37 ++++++++++++++------ pom.xml | 7 ++-- 4 files changed, 48 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/495d73a2/core/src/test/java/org/apache/brooklyn/feed/http/JsonFunctionsTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/feed/http/JsonFunctionsTest.java b/core/src/test/java/org/apache/brooklyn/feed/http/JsonFunctionsTest.java index ba654a4..d1a5d0a 100644 --- a/core/src/test/java/org/apache/brooklyn/feed/http/JsonFunctionsTest.java +++ b/core/src/test/java/org/apache/brooklyn/feed/http/JsonFunctionsTest.java @@ -28,6 +28,7 @@ import org.apache.brooklyn.util.guava.Maybe; import org.testng.Assert; import org.testng.annotations.Test; +import com.google.common.collect.ImmutableList; import com.google.gson.JsonElement; import com.google.gson.JsonParser; import com.jayway.jsonpath.PathNotFoundException; @@ -121,6 +122,20 @@ public class JsonFunctionsTest { } @Test + public void testGetPathSizeOfMap(){ + JsonElement json = JsonFunctions.asJson().apply("{\"mymap\": {\"k1\": \"v1\", \"k2\": \"v2\"}}"); + Integer obj = (Integer) JsonFunctions.getPath("$.mymap.size()").apply(json); + Assert.assertEquals(obj, (Integer)2); + } + + @Test + public void testGetPathSizeOfList(){ + JsonElement json = JsonFunctions.asJson().apply("{\"mylist\": [\"a\", \"b\", \"c\"]}"); + Integer obj = (Integer) JsonFunctions.getPath("$.mylist.size()").apply(json); + Assert.assertEquals(obj, (Integer)3); + } + + @Test public void testGetMissingPathIsNullOrThrows(){ try { // TODO is there a way to force this to return null if not found? http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/495d73a2/karaf/features/src/main/feature/feature.xml ---------------------------------------------------------------------- diff --git a/karaf/features/src/main/feature/feature.xml b/karaf/features/src/main/feature/feature.xml index d6a5038..be16e90 100644 --- a/karaf/features/src/main/feature/feature.xml +++ b/karaf/features/src/main/feature/feature.xml @@ -142,7 +142,8 @@ <bundle dependency="true">mvn:com.fasterxml.jackson.core/jackson-databind/${fasterxml.jackson.version}</bundle> <bundle dependency="true">mvn:com.fasterxml.jackson.core/jackson-annotations/${fasterxml.jackson.version}</bundle> <bundle dependency="true">mvn:net.minidev/json-smart/${jsonSmart.version}</bundle> - <bundle dependency="true">mvn:net.minidev/asm/${minidev.asm.version}</bundle> + <bundle dependency="true">mvn:net.minidev/accessors-smart/${minidev.accessors-smart.version}</bundle> + <bundle dependency="true">mvn:org.ow2.asm/asm/${ow2.asm.version}</bundle> <bundle dependency="true">mvn:com.thoughtworks.xstream/xstream/${xstream.version}</bundle> <bundle dependency="true">mvn:org.freemarker/freemarker/${freemarker.version}</bundle> <bundle dependency="true">mvn:com.hierynomus/sshj/${sshj.version}</bundle> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/495d73a2/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index 10e5ea4..d559d1e 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -463,6 +463,33 @@ <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> <version>${jsonPath.version}</version> + <exclusions> + <exclusion> + <!-- Would otherwise pull in 1.7.25 (Brooklyn uses 1.6.6) --> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + <exclusion> + <!-- Would otherwise pull in 2.6.3 (Brooklyn uses 2.7.5) --> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>net.minidev</groupId> + <artifactId>json-smart</artifactId> + <version>${jsonSmart.version}</version> + </dependency> + <dependency> + <groupId>net.minidev</groupId> + <artifactId>accessors-smart</artifactId> + <version>${minidev.accessors-smart.version}</version> + </dependency> + <dependency> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> + <version>${ow2.asm.version}</version> </dependency> <dependency> <groupId>com.maxmind.geoip2</groupId> @@ -474,16 +501,6 @@ <artifactId>jline</artifactId> <version>${jline.version}</version> </dependency> - <dependency> - <groupId>net.minidev</groupId> - <artifactId>json-smart</artifactId> - <version>${jsonSmart.version}</version> - </dependency> - <dependency> - <groupId>net.minidev</groupId> - <artifactId>asm</artifactId> - <version>${minidev.asm.version}</version> - </dependency> <!-- JAX-RS dependencies--> <!-- JAX-RS 2.0 API --> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/495d73a2/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 919ff56..6bc718a 100644 --- a/pom.xml +++ b/pom.xml @@ -142,7 +142,7 @@ <mockwebserver.version>20121111</mockwebserver.version> <freemarker.version>2.3.25-incubating</freemarker.version> <commons-io.version>2.4</commons-io.version> - <jsonPath.version>2.0.0</jsonPath.version> + <jsonPath.version>2.4.0</jsonPath.version> <commons-compress.version>1.4</commons-compress.version> <validation-api.version>1.1.0.Final</validation-api.version> <geronimo-jms_1.1_spec.version>1.1.1</geronimo-jms_1.1_spec.version> @@ -183,8 +183,9 @@ <log4j.version>1.2.17</log4j.version> <commons-logging.version>1.2</commons-logging.version> <jline.version>2.12</jline.version> - <jsonSmart.version>2.1.1</jsonSmart.version> - <minidev.asm.version>1.0.2</minidev.asm.version> + <jsonSmart.version>2.3</jsonSmart.version> + <minidev.accessors-smart.version>1.2</minidev.accessors-smart.version> + <ow2.asm.version>5.0.4</ow2.asm.version> <commons-beanutils.version>1.9.1</commons-beanutils.version> <commons-collections.version>3.2.1</commons-collections.version> <javax.mail.version>1.4.4</javax.mail.version>
