Browse Source

New JSON files

pull/1/head
David Baldwin 14 years ago
parent
commit
47a0e4b990
  1. 116
      json-path-assert/pom.xml
  2. 8
      json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java
  3. 19
      json-path-assert/src/test/java/com/jayway/jsonassert/JsonAssertTest.java
  4. 192
      json-path-assert/src/test/java/com/jayway/jsonassert/JsonAssertTest.java.orig
  5. 4
      json-path/pom.xml
  6. 173
      json-path/pom.xml.orig
  7. 100
      json-path/pom.xml.releaseBackup
  8. 8
      json-path/release.properties
  9. 4
      json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
  10. 163
      json-path/src/main/java/com/jayway/jsonpath/PathUtil.java.orig
  11. 5
      json-path/src/main/java/com/jayway/jsonpath/filter/FilterOutput.java
  12. 5
      json-path/src/main/java/com/jayway/jsonpath/filter/ListIndexFilter.java
  13. 60
      json-path/src/main/java/com/jayway/jsonpath/filter/t6508t2338.tmp
  14. 60
      json-path/src/main/java/com/jayway/jsonpath/filter/t7664t2129.tmp
  15. 6
      json-path/src/main/java/com/jayway/jsonpath/json/JsonNull.java
  16. 8
      json-path/src/main/java/com/jayway/jsonpath/json/gson/GsonJsonPrimitive.java
  17. 538
      json-path/src/test/java/com/jayway/jsonpath/JsonPathTest.java.orig
  18. 167
      json-path/src/test/java/com/jayway/jsonpath/SplitPathFragmentsTest.java.orig
  19. 5
      json-path/src/test/resources/log4j.properties
  20. 380
      pom.xml
  21. 191
      pom.xml.releaseBackup
  22. 21
      release.properties

116
json-path-assert/pom.xml

@ -1,58 +1,58 @@
<?xml version="1.0"?>
<!--
~ Copyright 2010 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>json-path-parent</artifactId>
<groupId>com.jayway.jsonpath</groupId>
<version>0.5.6</version>
</parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<version>0.5.6</version>
<name>json-path-assert</name>
<url>http://code.google.com/p/json-path/</url>
<dependencies>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
-->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
</dependency>
</dependencies>
</project>
<?xml version="1.0"?>
<!--
~ Copyright 2010 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>json-path-parent</artifactId>
<groupId>com.jayway.jsonpath</groupId>
<version>0.5.6-SNAPSHOT</version>
</parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<version>0.5.6-SNAPSHOT</version>
<name>json-path-assert</name>
<url>http://code.google.com/p/json-path/</url>
<dependencies>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
-->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
</dependency>
</dependencies>
</project>

8
json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java

@ -43,8 +43,10 @@ public class JsonAsserterImpl implements JsonAsserter {
String reason = "When processing json path: " + path;
JsonElement je = JsonPath.read(jsonObject, path);
if (! (matcher.matches(je)||matcher.matches(je.toObject()))){
if (!( (je == null && matcher.matches(je)) || (je.isContainer() && matcher.matches(je)) || matcher.matches(je.toObject()) ) ) {
System.out.println(JsonPath.read(jsonObject, path).toString());
throw new AssertionError(reason + matcher.toString());
}
@ -78,8 +80,8 @@ public class JsonAsserterImpl implements JsonAsserter {
*/
public JsonAsserter assertNotDefined(String path) throws JsonException {
JsonElement o = JsonPath.read(jsonObject, path);
if (o!=null && !o.isJsonNull()) {
if (!o.isJsonNull()) {
throw new AssertionError(format("Document contains the path <%s> but was expected not to.", path));
}
return this;

19
json-path-assert/src/test/java/com/jayway/jsonassert/JsonAssertTest.java

@ -85,7 +85,7 @@ public abstract class JsonAssertTest {
@Test
public void a_value_can_asserted_to_be_null() throws Exception {
with(JSON).assertEquals("$.store.bicycle.nullValue",factory.createJsonPrimitive(null));
with(JSON).assertNull("$.store.bicycle.nullValue");
}
@Test
@ -96,8 +96,8 @@ public abstract class JsonAssertTest {
@Test
public void a_path_can_be_asserted_with_matcher() throws Exception {
with(JSON).assertThat("$.store.bicycle.color", equalTo(w("red")))
.assertThat("$.store.bicycle.price", equalTo(w(19.95D)));
with(JSON).assertThat("$.store.bicycle.color", equalTo("red"))
.assertThat("$.store.bicycle.price", equalTo(19.95D));
}
@Test
@ -158,22 +158,21 @@ public abstract class JsonAssertTest {
@Test
public void a_path_can_be_asserted_equal_to() throws Exception {
with(JSON).assertEquals("$.store.book[0].title", w("Sayings of the Century"))
.assertThat("$.store.book[0].title", equalTo(w("Sayings of the Century")));
with(JSON).assertEquals("$.store.book[0].title", "Sayings of the Century")
.assertThat("$.store.book[0].title", equalTo("Sayings of the Century"));
with(JSON).assertEquals("$['store']['book'][0].['title']", w("Sayings of the Century"))
.assertThat("$['store'].book[0].title", equalTo(w("Sayings of the Century")));
with(JSON).assertEquals("$['store']['book'][0].['title']", "Shttp://www.theregister.co.uk/public_sector/government/ayings of the Century")
.assertThat("$['store'].book[0].title", equalTo("Sayings of the Century"));
}
@Test
public void no_hit_returns_null() throws Exception {
with(JSON).assertThat("$.store.book[1000]", equalTo(null));
with(JSON).assertThat("$.store.book[1000].title", Matchers.<Object>nullValue());
}
@Test
public void invalid_path() throws Exception {
with(JSON).assertThat("$.store.book[*].fooBar", Matchers.<Object>nullValue());
with(JSON).assertThat("$.store.book[*].fooBar.(value)", Matchers.<Object>nullValue());
}
@Test

192
json-path-assert/src/test/java/com/jayway/jsonassert/JsonAssertTest.java.orig

@ -1,192 +0,0 @@
package com.jayway.jsonassert;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.jayway.jsonpath.json.JsonElement;
import com.jayway.jsonpath.json.JsonException;
import com.jayway.jsonpath.json.JsonFactory;
import java.io.InputStream;
import static com.jayway.jsonassert.JsonAssert.*;
import static org.hamcrest.Matchers.*;
/**
* User: kalle stenflo
* Date: 1/21/11
* Time: 4:04 PM
*/
public abstract class JsonAssertTest {
public final static String JSON =
"{ \"store\": {\n" +
" \"book\": [ \n" +
" { \"category\": \"reference\",\n" +
" \"author\": \"Nigel Rees\",\n" +
" \"title\": \"Sayings of the Century\",\n" +
" \"price\": 8.95\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"Evelyn Waugh\",\n" +
" \"title\": \"Sword of Honour\",\n" +
" \"price\": 12.99\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"Herman Melville\",\n" +
" \"title\": \"Moby Dick\",\n" +
" \"isbn\": \"0-553-21311-3\",\n" +
" \"price\": 8.99\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"J. R. R. Tolkien\",\n" +
" \"title\": \"The Lord of the Rings\",\n" +
" \"isbn\": \"0-395-19395-8\",\n" +
" \"price\": 22.99\n" +
" }\n" +
" ],\n" +
" \"bicycle\": {\n" +
" \"color\": \"red\",\n" +
" \"price\": 19.95\n," +
" \"nullValue\": null\n" +
" }\n" +
" }\n" +
"}";
protected JsonFactory factory = null;
@Before
public void init(){
init_factory();
}
protected void init_factory(){
}
@Test
public void links_document() throws Exception {
with(getResourceAsStream("links.json")).assertEquals("count", 2)
.assertThat("links.gc:this.href", endsWith("?pageNumber=1&pageSize=2"))
.assertNotDefined("links.gc:prev")
.assertNotDefined("links.gc:next")
.assertThat("rows", collectionWithSize(equalTo(2)));
}
@Test
public void a_document_can_be_expected_not_to_contain_a_path() throws Exception {
with(JSON).assertNotDefined("$.store.bicycle.cool");
}
@Test
public void a_value_can_asserted_to_be_null() throws Exception {
with(JSON).assertNull("$.store.bicycle.nullValue");
}
@Test
public void ends_with_evalueates() throws Exception {
with(JSON).assertThat("$.store.book[0].category", endsWith("nce"));
}
@Test
public void a_path_can_be_asserted_with_matcher() throws Exception {
with(JSON).assertThat("$.store.bicycle.color", equalTo("red"))
.assertThat("$.store.bicycle.price", equalTo(19.95D));
}
@Test
public void list_content_can_be_asserted_with_matcher() throws Exception {
with(JSON).assertThat("$..book[*].author", hasItems( factory.createJsonPrimitive("Nigel Rees"), factory.createJsonPrimitive("Evelyn Waugh"), factory.createJsonPrimitive("Herman Melville"),factory.createJsonPrimitive( "J. R. R. Tolkien")));
with(JSON).assertThat("$..author.(value)", hasItems( factory.createJsonPrimitive("Nigel Rees"), factory.createJsonPrimitive("Evelyn Waugh"), factory.createJsonPrimitive("Herman Melville"),factory.createJsonPrimitive( "J. R. R. Tolkien")))
.assertThat("$..author.(value)", is(collectionWithSize(equalTo(4))));
}
@Test
public void list_content_can_be_asserted_with_nested_matcher() throws Exception {
with(JSON).assertThat("$..book[*]", hasItems(hasEntry("author", factory.createJsonPrimitive("Nigel Rees")), hasEntry("author", factory.createJsonPrimitive("Evelyn Waugh"))));
}
@Test
public void map_content_can_be_asserted_with_matcher() throws Exception {
with(JSON).assertThat("$.store.book[0]", hasEntry("category", w("reference")))
.assertThat("$.store.book[0]", hasEntry("title", w("Sayings of the Century")))
.and()
.assertThat("$..book[0]", hasEntry("category", w("reference")))
.and()
.assertThat("$.store.book[0]", mapContainingKey(equalTo("category")))
.and()
.assertThat("$.store.book[0]", mapContainingValue(equalTo( w("reference"))));
with(JSON).assertThat("$.['store'].['book'][0]", hasEntry(w("category"), w("reference")))
.assertThat("$.['store'].['book'][0]", hasEntry("title", w("Sayings of the Century")))
.and()
.assertThat("$..['book'][0]", hasEntry(w("category"), w("reference")))
.and()
.assertThat("$.['store'].['book'][0]", mapContainingKey(equalTo(("category"))))
.and()
.assertThat("$.['store'].['book'][0]", mapContainingValue(equalTo(w("reference"))));
}
private JsonElement w(Object obj) throws JsonException {
return factory.createJsonPrimitive(obj);
}
private JsonElement[] w(Object ... objs) throws JsonException {
JsonElement je[]= new JsonElement[objs.length];
for(int i=0;i<objs.length;i++){
je[i] = w(objs[i]);
}
return je;
}
@Test
public void an_empty_collection() throws Exception {
with(JSON).assertThat("$.store.book[?(@.category = 'x')]", isnull());
}
@Test
public void a_path_can_be_asserted_equal_to() throws Exception {
with(JSON).assertEquals("$.store.book[0].title", "Sayings of the Century")
.assertThat("$.store.book[0].title", equalTo("Sayings of the Century"));
<<<<<<< HEAD
with(JSON).assertEquals("$['store']['book'][0].['title']", "Shttp://www.theregister.co.uk/public_sector/government/ayings of the Century")
=======
with(JSON).assertEquals("$['store']['book'][0].['title']", "Sayings of the Century")
>>>>>>> 814bcc116cd67c4666a62ed8e2b9ff93aa46551d
.assertThat("$['store'].book[0].title", equalTo("Sayings of the Century"));
}
@Test
public void no_hit_returns_null() throws Exception {
with(JSON).assertThat("$.store.book[1000].title", Matchers.<Object>nullValue());
}
@Test
public void invalid_path() throws Exception {
with(JSON).assertThat("$.store.book[*].fooBar.(value)", Matchers.<Object>nullValue());
}
@Test
public void path_including_wildcard_path_followed_by_another_path_concatenates_results_to_list() throws Exception {
with(getResourceAsStream("lotto.json")).assertThat("lotto.winners[*].winnerId", hasItems( factory.createJsonPrimitive(23), factory.createJsonPrimitive(54)));
}
private InputStream getResourceAsStream(String resourceName) {
return getClass().getClassLoader().getResourceAsStream(resourceName);
}
}

4
json-path/pom.xml

@ -19,12 +19,12 @@
<parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-parent</artifactId>
<version>0.5.6</version>
<version>0.5.6-SNAPSHOT</version>
</parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<packaging>jar</packaging>
<version>0.5.6</version>
<version>0.5.6-SNAPSHOT</version>
<name>json-path</name>
<url>http://code.google.com/p/json-path/</url>
<dependencies>

173
json-path/pom.xml.orig

@ -1,173 +0,0 @@
<<<<<<< HEAD
<?xml version="1.0"?>
<!--
~ Copyright 2010 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-parent</artifactId>
<version>0.5.6-SNAPSHOT</version>
</parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<packaging>jar</packaging>
<version>0.5.6-SNAPSHOT</version>
<name>json-path</name>
<url>http://code.google.com/p/json-path/</url>
<dependencies>
<!--
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
-->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>1.0.6.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.11</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.11</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.11</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
</dependency>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- test dependencies -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
=======
<?xml version="1.0"?>
<!--
~ Copyright 2010 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-parent</artifactId>
<version>0.5.6-SNAPSHOT</version>
</parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<packaging>jar</packaging>
<version>0.5.6-SNAPSHOT</version>
<name>json-path</name>
<url>http://code.google.com/p/json-path/</url>
<dependencies>
<!--
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
-->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>1.0.6.3</version>
</dependency>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- test dependencies -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
>>>>>>> 814bcc116cd67c4666a62ed8e2b9ff93aa46551d

100
json-path/pom.xml.releaseBackup

@ -1,100 +0,0 @@
<?xml version="1.0"?>
<!--
~ Copyright 2010 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-parent</artifactId>
<version>0.5.6-SNAPSHOT</version>
</parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<packaging>jar</packaging>
<version>0.5.6-SNAPSHOT</version>
<name>json-path</name>
<url>http://code.google.com/p/json-path/</url>
<dependencies>
<!--
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
-->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>1.0.6.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.11</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.11</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.11</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
</dependency>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- test dependencies -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

8
json-path/release.properties

@ -1,8 +0,0 @@
#release configuration
#Fri Jul 29 12:36:19 PDT 2011
preparationGoals=clean verify
scm.commentPrefix=[maven-release-plugin]
remoteTagging=true
exec.additionalArguments=-Psonatype-oss-release -P wdig-dev
completedPhase=scm-check-modifications
scm.url=scm\:git\:ssh\://git@github.com/jayway/JsonPath.git/json-path

4
json-path/src/main/java/com/jayway/jsonpath/JsonPath.java

@ -135,11 +135,9 @@ public class JsonPath {
FilterOutput filterOutput = filters.filter(json);
if (filterOutput == null || filterOutput.getResult() == null) {
return null;
throw new JsonException("Element not found");
}
return filterOutput.getResult();
}

163
json-path/src/main/java/com/jayway/jsonpath/PathUtil.java.orig

@ -1,163 +0,0 @@
<<<<<<< HEAD
package com.jayway.jsonpath;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
/**
* User: kalle stenflo
* Date: 2/2/11
* Time: 2:08 PM
*/
public class PathUtil {
/**
* Checks if a path points to a single item or if it potentially returns multiple items
* <p/>
* a path is considered <strong>not</strong> definite if it contains a scan fragment ".."
* or an array position fragment that is not based on a single index
* <p/>
* <p/>
* absolute path examples:
* <p/>
* $store.book
* $store.book[1].value
* <p/>
* not absolute path examples
* <p/>
* $..book
* $.store.book[1,2]
* $.store.book[?(@.category = 'fiction')]
*
* @param jsonPath the path to check
* @return true if path is definite (points to single item)
*/
public static boolean isPathDefinite(String jsonPath) {
//return !jsonPath.replaceAll("\"[^\"\\\\\\n\r]*\"", "").matches(".*(\\.\\.|\\*|\\[[\\\\/]|\\?|,|:|>|\\(|<|=|\\+).*");
return !jsonPath.replaceAll("\"[^\"\\\\\\n\r]*\"", "").matches(".*(\\.\\.|\\*|\\[[\\\\/]|\\?|,|:\\s?\\]|\\[\\s?:|>|\\(|<|=|\\+).*");
}
/**
* Splits a path into fragments
* <p/>
* the path <code>$.store.book[1].category</code> returns ["$", "store", "book", "[1]", "category"]
*
* @param jsonPath path to split
* @return fragments
*/
public static List<String> splitPath(String jsonPath) {
LinkedList<String> fragments = new LinkedList<String>();
if (!jsonPath.startsWith("$.")) {
jsonPath = "$." + jsonPath;
}
jsonPath = jsonPath.replace("$['","$.['")
.replaceAll("\\['(\\w+)\\.(\\w+)']", "['$1~$2']")
.replace("']['","'].['" )
.replace("..", ".~~.")
.replace("[", ".[")
.replace("@.", "@")
.replace("['", "")
.replace("']", "");
String[] split = jsonPath.split("\\.");
for (int i = 0; i < split.length; i++) {
if (split[i].trim().isEmpty()) {
continue;
}
fragments.add(split[i].replace("@", "@.").replace("~", "."));
}
//for (String fragment : fragments) {
// System.out.println(fragment);
//}
return fragments;
}
}
=======
package com.jayway.jsonpath;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
/**
* User: kalle stenflo
* Date: 2/2/11
* Time: 2:08 PM
*/
public class PathUtil {
/**
* Checks if a path points to a single item or if it potentially returns multiple items
* <p/>
* a path is considered <strong>not</strong> definite if it contains a scan fragment ".."
* or an array position fragment that is not based on a single index
* <p/>
* <p/>
* absolute path examples:
* <p/>
* $store.book
* $store.book[1].value
* <p/>
* not absolute path examples
* <p/>
* $..book
* $.store.book[1,2]
* $.store.book[?(@.category = 'fiction')]
*
* @param jsonPath the path to check
* @return true if path is definite (points to single item)
*/
public static boolean isPathDefinite(String jsonPath) {
//return !jsonPath.replaceAll("\"[^\"\\\\\\n\r]*\"", "").matches(".*(\\.\\.|\\*|\\[[\\\\/]|\\?|,|:|>|\\(|<|=|\\+).*");
return !jsonPath.replaceAll("\"[^\"\\\\\\n\r]*\"", "").matches(".*(\\.\\.|\\*|\\[[\\\\/]|\\?|,|:\\s?\\]|\\[\\s?:|>|\\(|<|=|\\+).*");
}
/**
* Splits a path into fragments
* <p/>
* the path <code>$.store.book[1].category</code> returns ["$", "store", "book", "[1]", "category"]
*
* @param jsonPath path to split
* @return fragments
*/
public static List<String> splitPath(String jsonPath) {
LinkedList<String> fragments = new LinkedList<String>();
if (!jsonPath.startsWith("$.")) {
jsonPath = "$." + jsonPath;
}
jsonPath = jsonPath.replace("$['","$.['")
.replaceAll("\\['(\\w+)\\.(\\w+)']", "['$1~$2']")
.replace("']['","'].['" )
.replace("..", ".~~.")
.replace("[", ".[")
.replace("@.", "@")
.replace("['", "")
.replace("']", "");
String[] split = jsonPath.split("\\.");
for (int i = 0; i < split.length; i++) {
if (split[i].trim().isEmpty()) {
continue;
}
fragments.add(split[i].replace("@", "@.").replace("~", "."));
}
//for (String fragment : fragments) {
// System.out.println(fragment);
//}
return fragments;
}
}
>>>>>>> 814bcc116cd67c4666a62ed8e2b9ff93aa46551d

5
json-path/src/main/java/com/jayway/jsonpath/filter/FilterOutput.java

@ -36,11 +36,6 @@ public class FilterOutput {
public JsonElement getResult() throws JsonException {
for(int i=result.size()-1;i>=0;i--){
if(result.get(i).isJsonNull())
result.remove(i);
}
if(result.size()==0){
return null;
}

5
json-path/src/main/java/com/jayway/jsonpath/filter/ListIndexFilter.java

@ -43,13 +43,10 @@ public class ListIndexFilter extends JsonPathFilterBase {
if (indexIsInRange(element.toJsonArray(), i)) {
result.add(element.toJsonArray().get(i));
}
else{
result.add(factory.createJsonNull(i,element.toJsonArray()));
}
}
}
return result;
}

60
json-path/src/main/java/com/jayway/jsonpath/filter/t6508t2338.tmp

@ -1,60 +0,0 @@
package com.jayway.jsonpath.filter;
import com.jayway.jsonpath.json.JsonArray;
import com.jayway.jsonpath.json.JsonElement;
import com.jayway.jsonpath.json.JsonException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minidev.json.JSONValue;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 2/15/11
* Time: 8:23 PM
*/
public class TypeFilter extends JsonPathFilterBase {
//@Autowired
public com.jayway.jsonpath.json.JsonFactory factory = com.jayway.jsonpath.json.minidev.MiniJsonFactory.getInstance();
public static final Pattern PATTERN = Pattern.compile("\\((collection|object|value)\\)");
private final String pathFragment;
public TypeFilter(String pathFragment) {
this.pathFragment = pathFragment;
}
@Override
public String getPathSegment() throws JsonException {
return pathFragment;
}
@Override
public List<JsonElement> apply(JsonElement element) throws JsonException {
List<JsonElement> result = new ArrayList<JsonElement>();
String prop = getFilterProperty();
JsonType v = JsonType.fromString(pathFragment.substring(1,pathFragment.length()-1));
if(element.isJsonType(v))
result.add(element);
return result;
}
private String getFilterProperty() {
Matcher matcher = PATTERN.matcher(pathFragment);
if (matcher.matches()) {
return matcher.group(1);
}
throw new IllegalArgumentException("invalid list filter property");
}
}

60
json-path/src/main/java/com/jayway/jsonpath/filter/t7664t2129.tmp

@ -1,60 +0,0 @@
package com.jayway.jsonpath.filter;
import com.jayway.jsonpath.json.JsonArray;
import com.jayway.jsonpath.json.JsonElement;
import com.jayway.jsonpath.json.JsonException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minidev.json.JSONValue;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 2/15/11
* Time: 8:23 PM
*/
public class TypeFilter extends JsonPathFilterBase {
//@Autowired
public com.jayway.jsonpath.json.JsonFactory factory = com.jayway.jsonpath.json.minidev.MiniJsonFactory.getInstance();
public static final Pattern PATTERN = Pattern.compile("\\((collection|object|value)\\)");
private final String pathFragment;
public TypeFilter(String pathFragment) {
this.pathFragment = pathFragment;
}
@Override
public String getPathSegment() throws JsonException {
return pathFragment;
}
@Override
public List<JsonElement> apply(JsonElement element) throws JsonException {
List<JsonElement> result = new ArrayList<JsonElement>();
String prop = getFilterProperty();
JsonType v = JsonType.fromString(pathFragment.substring(1,pathFragment.length()-1));
if(element.isJsonType(v))
result.add(element);
return result;
}
private String getFilterProperty() {
Matcher matcher = PATTERN.matcher(pathFragment);
if (matcher.matches()) {
return matcher.group(1);
}
throw new IllegalArgumentException("invalid list filter property");
}
}

6
json-path/src/main/java/com/jayway/jsonpath/json/JsonNull.java

@ -60,9 +60,5 @@ public class JsonNull extends JsonElement {
}
@Override
public boolean equals(Object o1){
if(o1==null) return false;
return o1 instanceof JsonNull;
}
}

8
json-path/src/main/java/com/jayway/jsonpath/json/gson/GsonJsonPrimitive.java

@ -93,13 +93,6 @@ public class GsonJsonPrimitive extends com.jayway.jsonpath.json.JsonPrimitive{
@Override
public boolean equals(Object o1){
if (o1==null) return false;
if(o1 instanceof GsonJsonPrimitive){
if(value == null)
return ((GsonJsonPrimitive) o1).value == null;
else
return value.equals(((GsonJsonPrimitive) o1).value);
}
return (o1!=null) && o1.equals(wrappit(value));
}
@Override
@ -108,7 +101,6 @@ public class GsonJsonPrimitive extends com.jayway.jsonpath.json.JsonPrimitive{
}
@Override
public String toString(){
if(value == null) return "null";
return wrappit(value).toString();
}

538
json-path/src/test/java/com/jayway/jsonpath/JsonPathTest.java.orig

@ -1,538 +0,0 @@
<<<<<<< HEAD
package com.jayway.jsonpath;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import com.google.gson.JsonNull;
import com.jayway.jsonpath.json.JsonArray;
import com.jayway.jsonpath.json.JsonElement;
import com.jayway.jsonpath.json.JsonException;
import com.jayway.jsonpath.json.JsonFactory;
import com.jayway.jsonpath.json.JsonObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItems;
import static org.junit.Assert.*;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 2/2/11
* Time: 3:07 PM
*/
public abstract class JsonPathTest {
public final static String ARRAY = "[{\"value\": 1},{\"value\": 2}, {\"value\": 3},{\"value\": 4}]";
public final static String DOCUMENT =
"{ \"store\": {\n" +
" \"book\": [ \n" +
" { \"category\": \"reference\",\n" +
" \"author\": \"Nigel Rees\",\n" +
" \"title\": \"Sayings of the Century\",\n" +
" \"price\": 8.95\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"Evelyn Waugh\",\n" +
" \"title\": \"Sword of Honour\",\n" +
" \"price\": 12.99\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"Herman Melville\",\n" +
" \"title\": \"Moby Dick\",\n" +
" \"isbn\": \"0-553-21311-3\",\n" +
" \"price\": 8.99\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"J. R. R. Tolkien\",\n" +
" \"title\": \"The Lord of the Rings\",\n" +
" \"isbn\": \"0-395-19395-8\",\n" +
" \"price\": 22.99\n" +
" }\n" +
" ],\n" +
" \"bicycle\": {\n" +
" \"color\": \"red\",\n" +
" \"price\": 19.95,\n" +
" \"foo:bar\": \"fooBar\",\n" +
" \"dot.notation\": \"new\"\n" +
" }\n" +
" }\n" +
"}";
protected JsonFactory factory = null;
@Before
public void init_factory(){
}
@Test
public void bracket_notation_can_be_used_in_path() throws Exception {
assertEquals(w("new"), JsonPath.read(DOCUMENT, "$.['store'].bicycle.['dot.notation']"));
assertEquals(w("new"), JsonPath.read(DOCUMENT, "$['store']['bicycle']['dot.notation']"));
assertEquals(w("new"), JsonPath.read(DOCUMENT, "$.['store']['bicycle']['dot.notation']"));
assertEquals(w("new"), JsonPath.read(DOCUMENT, "$.['store'].['bicycle'].['dot.notation']"));
}
@Test
public void filter_an_array() throws Exception {
JsonElement matches = JsonPath.read(ARRAY, "$.[?(@.value = 1)]");
assertEquals(true, matches.isJsonObject());
System.out.println(matches);
}
@Test
public void read_path_with_colon() throws Exception {
assertEquals(JsonPath.read(DOCUMENT, "$.store.bicycle.foo:bar"), w("fooBar"));
assertEquals(JsonPath.read(DOCUMENT, "$.['store'].['bicycle'].['foo:bar']"), w("fooBar"));
}
private JsonElement w(Object obj) throws JsonException {
return factory.createJsonPrimitive(obj);
}
private JsonElement[] w(Object ... objs) throws JsonException {
JsonElement je[]= new JsonElement[objs.length];
for(int i=0;i<objs.length;i++){
je[i] = w(objs[i]);
}
return je;
}
@Test
public void parent_ref() throws Exception {
String doc = "{foo:{biz:{id:1}}}";
assertEquals(JsonPath.read(doc, "$.foo.biz").toString(), "{\"id\":1}");
JsonElement j = JsonPath.read(doc, "$.foo.biz");
assertEquals(j.getParentReference().getParent().toString() , "{\"biz\":{\"id\":1}}");;
assertEquals(j.getParentReference().getParent().getParentReference().getParent().toString(), "{\"foo\":{\"biz\":{\"id\":1}}}");
doc = "{foo:{biz:[{Id:1},{Id:2},{Id:4,foo:1234}]}}";
JsonElement root = JsonPath.parse(doc);
assertEquals(JsonPath.read(doc, "$.foo.biz.[2].foo").toString(), "1234");
assertEquals(JsonPath.read(doc, "$.foo.biz.[2].foo").getParentReference().getParent().toJsonObject().get("Id").toString(), "4");
JsonElement doc_json = JsonFactory.getInstance().parse( "{foo:[[[1],2,3,4],1,2,3]}");
JsonElement je = JsonPath.read(doc_json, "$.foo[0][0]");
je.getParentReference().setReference( JsonFactory.getInstance().createJsonPrimitive("foo"));
assertEquals(doc_json.toString(),"{\"foo\":[[\"foo\",2,3,4],1,2,3]}");
}
@Test
public void type_test() throws Exception {
String doc = "{foo:{biz:{id:1}}}";
assertEquals(JsonPath.read(doc, "$.foo.biz.(object)").toString(), "{\"id\":1}");
assertTrue(JsonPath.read(doc, "$.foo.biz.(collection)").isJsonNull());
doc = "{foo:{biz:[{Id:1},{Id:2},{Id:4,foo:1234}]}}";
JsonElement root = JsonPath.parse(doc);
assertEquals(JsonPath.read(doc, "$.foo.biz.(collection)[2].foo.(value)").toString(), "1234");
}
@Test
public void read_document_from_root() throws Exception {
com.jayway.jsonpath.json.JsonObject result = JsonPath.read(DOCUMENT, "$.store").toJsonObject();
assertEquals(2, result.getProperties().size());
}
@Test
public void read_store_book_1() throws Exception {
JsonPath path = JsonPath.compile("$.store.book[1]");
JsonElement map = path.read(DOCUMENT);
assertEquals("Evelyn Waugh", map.toJsonObject().get("author").toObject());
}
@Test
public void read_store_book_wildcard() throws Exception {
JsonPath path = JsonPath.compile("$.store.book[*]");
JsonElement list = path.read(DOCUMENT);
}
@Test
public void read_store_book_author() throws Exception {
Iterable<String> l1 = toList(JsonPath.read(DOCUMENT, "$.store.book[0,1].author"));
assertThat(l1, hasItems("Nigel Rees", "Evelyn Waugh"));
Iterable<String> l2 = toList(JsonPath.read(DOCUMENT, "$.store.book[*].author"));
assertThat(l2, hasItems("Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"));
Iterable<String> l3 = toList(JsonPath.read(DOCUMENT, "$.['store'].['book'][*].['author']"));
assertThat(l3, hasItems("Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"));
}
private <T> List<T> toList(JsonElement read) throws JsonException {
List l = new ArrayList<T>();
for(JsonElement e: read.toJsonArray()){
l.add((T) e.toObject());
}
return l ;
}
@Test
public void all_authors() throws Exception {
Iterable<String> l1 = toList(JsonPath.read(DOCUMENT, "$..author"));
assertThat(l1, hasItems("Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"));
}
@Test
public void all_store_properties() throws Exception {
JsonArray itemsInStore = JsonPath.read(DOCUMENT, "$.store.*").toJsonArray();
assertEquals(JsonPath.read(itemsInStore, "$.[0].[0].author").toObject(), "Nigel Rees");
assertEquals(JsonPath.read(itemsInStore, "$.[0][0].author").toObject(), "Nigel Rees");
}
@Test
public void all_prices_in_store() throws Exception {
assertThat(this.<Double>toList(JsonPath.read(DOCUMENT, "$.store..price")), hasItems(8.95D, 12.99D, 8.99D, 19.95D));
}
@Test
public void access_array_by_index_from_tail() throws Exception {
assertThat((String)JsonPath.read(DOCUMENT, "$..book[(@.length-1)].author").toObject(), equalTo("J. R. R. Tolkien"));
assertThat((String)JsonPath.read(DOCUMENT, "$..book[-1:].author").toObject(), equalTo("J. R. R. Tolkien"));
}
@Test
public void read_store_book_index_0_and_1() throws Exception {
assertThat(this.<String>toList(JsonPath.read(DOCUMENT, "$.store.book[0,1].author")), hasItems("Nigel Rees", "Evelyn Waugh"));
assertTrue(this.<String>toList(JsonPath.read(DOCUMENT, "$.store.book[0,1].author")).size() == 2);
}
@Test
public void read_store_book_pull_first_2() throws Exception {
assertThat(this.<String>toList(JsonPath.read(DOCUMENT, "$.store.book[:2].author")), hasItems("Nigel Rees", "Evelyn Waugh"));
assertTrue(this.<String>toList(JsonPath.read(DOCUMENT, "$.store.book[:2].author")).size() == 2);
}
@Test
public void read_store_book_filter_by_isbn() throws Exception {
assertThat(this.<String>toList(JsonPath.read(DOCUMENT, "$.store.book[?(@.isbn)].isbn")), hasItems("0-553-21311-3", "0-395-19395-8"));
assertTrue(this.<String>toList(JsonPath.read(DOCUMENT, "$.store.book[?(@.isbn)].isbn")).size() == 2);
}
@Test
public void all_books_cheaper_than_10() throws Exception {
Object o = JsonPath.read(DOCUMENT, "$.store.book[?(@.price < 10)].title");
assertThat(this.<String>toList(JsonPath.read(DOCUMENT, "$.store.book[?(@.price < 10)].title")), hasItems("Sayings of the Century", "Moby Dick"));
}
@Test
public void all_books_with_category_reference() throws Exception {
Object o = JsonPath.read(DOCUMENT, "$..book[?(@.category = 'reference')].title");
assertEquals(JsonPath.read(DOCUMENT, "$..book[?(@.category = 'reference')].title").toObject(), "Sayings of the Century");
}
@Test
public void all_members_of_all_documents() throws Exception {
JsonPath.read(DOCUMENT, "$..*");
}
@Test
public void access_index_out_of_bounds_does_not_throw_exception() throws Exception {
JsonElement res = JsonPath.read(DOCUMENT, "$.store.book[100].author");
assertTrue(res.isJsonNull());
JsonElement res2 = JsonPath.read(DOCUMENT, "$.store.book[1, 200].author");
JsonElement res3 = JsonPath.read(DOCUMENT, "$.store.book[1, 200]");
assertEquals(res2.toObject(), "Evelyn Waugh");
System.out.println(res3.toJsonArray().get(1));
//assertNull(();
}
/*
@Test(expected = InvalidPathException.class)
public void invalid_space_path_throws_exception() throws Exception {
JsonPath.read(DOCUMENT, "space is not good");
}
*/
@Test(expected = InvalidPathException.class)
public void invalid_new_path_throws_exception() throws Exception {
JsonPath.read(DOCUMENT, "new ");
}
}
=======
package com.jayway.jsonpath;
import org.junit.Test;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItems;
import static org.junit.Assert.*;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 2/2/11
* Time: 3:07 PM
*/
public class JsonPathTest {
public final static String ARRAY = "[{\"value\": 1},{\"value\": 2}, {\"value\": 3},{\"value\": 4}]";
public final static String DOCUMENT =
"{ \"store\": {\n" +
" \"book\": [ \n" +
" { \"category\": \"reference\",\n" +
" \"author\": \"Nigel Rees\",\n" +
" \"title\": \"Sayings of the Century\",\n" +
" \"price\": 8.95\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"Evelyn Waugh\",\n" +
" \"title\": \"Sword of Honour\",\n" +
" \"price\": 12.99\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"Herman Melville\",\n" +
" \"title\": \"Moby Dick\",\n" +
" \"isbn\": \"0-553-21311-3\",\n" +
" \"price\": 8.99\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"J. R. R. Tolkien\",\n" +
" \"title\": \"The Lord of the Rings\",\n" +
" \"isbn\": \"0-395-19395-8\",\n" +
" \"price\": 22.99\n" +
" }\n" +
" ],\n" +
" \"bicycle\": {\n" +
" \"color\": \"red\",\n" +
" \"price\": 19.95,\n" +
" \"foo:bar\": \"fooBar\",\n" +
" \"dot.notation\": \"new\"\n" +
" }\n" +
" }\n" +
"}";
@Test
public void bracket_notation_can_be_used_in_path() throws Exception {
assertEquals("new", JsonPath.read(DOCUMENT, "$.['store'].bicycle.['dot.notation']"));
assertEquals("new", JsonPath.read(DOCUMENT, "$['store']['bicycle']['dot.notation']"));
assertEquals("new", JsonPath.read(DOCUMENT, "$.['store']['bicycle']['dot.notation']"));
assertEquals("new", JsonPath.read(DOCUMENT, "$.['store'].['bicycle'].['dot.notation']"));
}
@Test
public void filter_an_array() throws Exception {
List<Object> matches = JsonPath.read(ARRAY, "$.[?(@.value = 1)]");
assertEquals(1, matches.size());
System.out.println(matches);
}
@Test
public void read_path_with_colon() throws Exception {
assertEquals(JsonPath.read(DOCUMENT, "$.store.bicycle.foo:bar"), "fooBar");
assertEquals(JsonPath.read(DOCUMENT, "$['store']['bicycle']['foo:bar']"), "fooBar");
}
@Test
public void read_document_from_root() throws Exception {
Map result = JsonPath.read(DOCUMENT, "$.store");
assertEquals(2, result.values().size());
}
@Test
public void read_store_book_1() throws Exception {
JsonPath path = JsonPath.compile("$.store.book[1]");
Map map = path.read(DOCUMENT);
assertEquals("Evelyn Waugh", map.get("author"));
}
@Test
public void read_store_book_wildcard() throws Exception {
JsonPath path = JsonPath.compile("$.store.book[*]");
List<Object> list = path.read(DOCUMENT);
}
@Test
public void read_store_book_author() throws Exception {
assertThat(JsonPath.<List<String>>read(DOCUMENT, "$.store.book[0,1].author"), hasItems("Nigel Rees", "Evelyn Waugh"));
assertThat(JsonPath.<List<String>>read(DOCUMENT, "$.store.book[*].author"), hasItems("Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"));
assertThat(JsonPath.<List<String>>read(DOCUMENT, "$.['store'].['book'][*].['author']"), hasItems("Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"));
assertThat(JsonPath.<List<String>>read(DOCUMENT, "$['store']['book'][*]['author']"), hasItems("Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"));
assertThat(JsonPath.<List<String>>read(DOCUMENT, "$['store'].book[*]['author']"), hasItems("Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"));
}
@Test
public void all_authors() throws Exception {
assertThat(JsonPath.<List<String>>read(DOCUMENT, "$..author"), hasItems("Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"));
}
@Test
public void all_store_properties() throws Exception {
List<Object> itemsInStore = JsonPath.read(DOCUMENT, "$.store.*");
assertEquals(JsonPath.read(itemsInStore, "$.[0].[0].author"), "Nigel Rees");
assertEquals(JsonPath.read(itemsInStore, "$.[0][0].author"), "Nigel Rees");
}
@Test
public void all_prices_in_store() throws Exception {
assertThat(JsonPath.<List<Double>>read(DOCUMENT, "$.store..price"), hasItems(8.95D, 12.99D, 8.99D, 19.95D));
}
@Test
public void access_array_by_index_from_tail() throws Exception {
assertThat(JsonPath.<String>read(DOCUMENT, "$..book[(@.length-1)].author"), equalTo("J. R. R. Tolkien"));
assertThat(JsonPath.<String>read(DOCUMENT, "$..book[-1:].author"), equalTo("J. R. R. Tolkien"));
}
@Test
public void read_store_book_index_0_and_1() throws Exception {
assertThat(JsonPath.<List<String>>read(DOCUMENT, "$.store.book[0,1].author"), hasItems("Nigel Rees", "Evelyn Waugh"));
assertTrue(JsonPath.<List>read(DOCUMENT, "$.store.book[0,1].author").size() == 2);
}
@Test
public void read_store_book_pull_first_2() throws Exception {
assertThat(JsonPath.<List<String>>read(DOCUMENT, "$.store.book[:2].author"), hasItems("Nigel Rees", "Evelyn Waugh"));
assertTrue(JsonPath.<List>read(DOCUMENT, "$.store.book[:2].author").size() == 2);
}
@Test
public void read_store_book_filter_by_isbn() throws Exception {
assertThat(JsonPath.<List<String>>read(DOCUMENT, "$.store.book[?(@.isbn)].isbn"), hasItems("0-553-21311-3", "0-395-19395-8"));
assertTrue(JsonPath.<List>read(DOCUMENT, "$.store.book[?(@.isbn)].isbn").size() == 2);
}
@Test
public void all_books_cheaper_than_10() throws Exception {
assertThat(JsonPath.<List<String>>read(DOCUMENT, "$.store.book[?(@.price < 10)].title"), hasItems("Sayings of the Century", "Moby Dick"));
}
@Test
public void all_books_with_category_reference() throws Exception {
assertThat(JsonPath.<List<String>>read(DOCUMENT, "$..book[?(@.category = 'reference')].title"), hasItems("Sayings of the Century"));
}
@Test
public void all_members_of_all_documents() throws Exception {
List<String> all = JsonPath.read(DOCUMENT, "$..*");
}
@Test
public void access_index_out_of_bounds_does_not_throw_exception() throws Exception {
Object res = JsonPath.read(DOCUMENT, "$.store.book[100].author");
assertNull(res);
res = JsonPath.read(DOCUMENT, "$.store.book[1, 200].author");
assertThat((List<String>) res, hasItems("Evelyn Waugh"));
//assertNull(();
}
/*
@Test(expected = InvalidPathException.class)
public void invalid_space_path_throws_exception() throws Exception {
JsonPath.read(DOCUMENT, "space is not good");
}
*/
@Test(expected = InvalidPathException.class)
public void invalid_new_path_throws_exception() throws Exception {
JsonPath.read(DOCUMENT, "new ");
}
}
>>>>>>> 814bcc116cd67c4666a62ed8e2b9ff93aa46551d

167
json-path/src/test/java/com/jayway/jsonpath/SplitPathFragmentsTest.java.orig

@ -1,167 +0,0 @@
<<<<<<< HEAD
package com.jayway.jsonpath;
import org.junit.Test;
import static org.hamcrest.Matchers.hasItemInArray;
import static org.hamcrest.Matchers.hasItems;
import static org.junit.Assert.assertThat;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 2/2/11
* Time: 1:22 PM
*/
public class SplitPathFragmentsTest {
/*
1. "$..book[-1:].foo.bar"
2. "$.store.book[*].author"
3. "$..author"
4. "$.store.*"
5. "$.store..price"
6. "$..book[(@.length-1)]"
7. "$..book[-1:]
8. "$..book[0,1]"
9. "$..book[:2]"
10. "$..book[?(@.isbn)]"
11. "$..book[?(@.price<10)]"
12. "$..*"
*/
@Test
public void bracket_notation_can_be_split() throws Exception {
assertThat(PathUtil.splitPath("$.['store'].['price']"), hasItems("$", "store", "price"));
assertThat(PathUtil.splitPath("$['store']['price']"), hasItems("$", "store", "price"));
assertThat(PathUtil.splitPath("['store']['price']"), hasItems("$", "store", "price"));
assertThat(PathUtil.splitPath("['store'].price"), hasItems("$", "store", "price"));
assertThat(PathUtil.splitPath("$.['store book'].['price list']"), hasItems("$", "store book", "price list"));
assertThat(PathUtil.splitPath("$.['store.book'].['price.list']"), hasItems("$", "store.book", "price.list"));
}
@Test
public void fragments_are_split_correctly() throws Exception {
assertThat(PathUtil.splitPath("$..book[-1:].foo.bar"), hasItems("$", "..", "[-1:]", "foo", "bar"));
assertThat(PathUtil.splitPath("$.store.book[*].author"), hasItems("$", "store", "book", "[*]", "author"));
assertThat(PathUtil.splitPath("$..author"), hasItems("$", "..", "author"));
assertThat(PathUtil.splitPath("$.store.*"), hasItems("$", "store", "*"));
assertThat(PathUtil.splitPath("$.store..price"), hasItems("$", "store", "..", "price"));
assertThat(PathUtil.splitPath("$..book[(@.length-1)]"), hasItems("$", "..", "book", "[(@.length-1)]"));
assertThat(PathUtil.splitPath("$..book[-1:]"), hasItems("$", "..", "book", "[-1:]"));
assertThat(PathUtil.splitPath("$..book[0,1]"), hasItems("$", "..", "book", "[0,1]"));
assertThat(PathUtil.splitPath("$..book[:2]"), hasItems("$", "..", "book", "[:2]"));
assertThat(PathUtil.splitPath("$..book[?(@.isbn)]"), hasItems("$", "..", "book", "[?(@.isbn)]"));
assertThat(PathUtil.splitPath("$..book[?(@.price<10)]"), hasItems("$", "..", "book", "[?(@.price<10)]"));
assertThat(PathUtil.splitPath("$..*"), hasItems("$", "..", "*"));
assertThat(PathUtil.splitPath("$.[0][1].author"), hasItems("$", "[0]", "[1]", "author"));
assertThat(PathUtil.splitPath("$.[0].[1].author"), hasItems("$", "[0]", "[1]", "author"));
assertThat(PathUtil.splitPath("$.foo:bar.author"), hasItems("$", "foo:bar", "author"));
}
}
=======
package com.jayway.jsonpath;
import org.junit.Test;
import static org.hamcrest.Matchers.hasItemInArray;
import static org.hamcrest.Matchers.hasItems;
import static org.junit.Assert.assertThat;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 2/2/11
* Time: 1:22 PM
*/
public class SplitPathFragmentsTest {
/*
1. "$..book[-1:].foo.bar"
2. "$.store.book[*].author"
3. "$..author"
4. "$.store.*"
5. "$.store..price"
6. "$..book[(@.length-1)]"
7. "$..book[-1:]
8. "$..book[0,1]"
9. "$..book[:2]"
10. "$..book[?(@.isbn)]"
11. "$..book[?(@.price<10)]"
12. "$..*"
*/
@Test
public void bracket_notation_can_be_split() throws Exception {
assertThat(PathUtil.splitPath("$.['store'].['price']"), hasItems("$", "store", "price"));
assertThat(PathUtil.splitPath("$['store']['price']"), hasItems("$", "store", "price"));
assertThat(PathUtil.splitPath("['store']['price']"), hasItems("$", "store", "price"));
assertThat(PathUtil.splitPath("['store'].price"), hasItems("$", "store", "price"));
assertThat(PathUtil.splitPath("$.['store book'].['price list']"), hasItems("$", "store book", "price list"));
assertThat(PathUtil.splitPath("$.['store.book'].['price.list']"), hasItems("$", "store.book", "price.list"));
}
@Test
public void fragments_are_split_correctly() throws Exception {
assertThat(PathUtil.splitPath("$..book[-1:].foo.bar"), hasItems("$", "..", "[-1:]", "foo", "bar"));
assertThat(PathUtil.splitPath("$.store.book[*].author"), hasItems("$", "store", "book", "[*]", "author"));
assertThat(PathUtil.splitPath("$..author"), hasItems("$", "..", "author"));
assertThat(PathUtil.splitPath("$.store.*"), hasItems("$", "store", "*"));
assertThat(PathUtil.splitPath("$.store..price"), hasItems("$", "store", "..", "price"));
assertThat(PathUtil.splitPath("$..book[(@.length-1)]"), hasItems("$", "..", "book", "[(@.length-1)]"));
assertThat(PathUtil.splitPath("$..book[-1:]"), hasItems("$", "..", "book", "[-1:]"));
assertThat(PathUtil.splitPath("$..book[0,1]"), hasItems("$", "..", "book", "[0,1]"));
assertThat(PathUtil.splitPath("$..book[:2]"), hasItems("$", "..", "book", "[:2]"));
assertThat(PathUtil.splitPath("$..book[?(@.isbn)]"), hasItems("$", "..", "book", "[?(@.isbn)]"));
assertThat(PathUtil.splitPath("$..book[?(@.price<10)]"), hasItems("$", "..", "book", "[?(@.price<10)]"));
assertThat(PathUtil.splitPath("$..*"), hasItems("$", "..", "*"));
assertThat(PathUtil.splitPath("$.[0][1].author"), hasItems("$", "[0]", "[1]", "author"));
assertThat(PathUtil.splitPath("$.[0].[1].author"), hasItems("$", "[0]", "[1]", "author"));
assertThat(PathUtil.splitPath("$.foo:bar.author"), hasItems("$", "foo:bar", "author"));
}
}
>>>>>>> 814bcc116cd67c4666a62ed8e2b9ff93aa46551d

5
json-path/src/test/resources/log4j.properties

@ -1,5 +0,0 @@
log4j.rootLogger=DEBUG, cons
log4j.appender.cons=org.apache.log4j.ConsoleAppender
log4j.appender.cons.layout=org.apache.log4j.SimpleLayout

380
pom.xml

@ -1,191 +1,191 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2010 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>5</version>
</parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-parent</artifactId>
<packaging>pom</packaging>
<version>0.5.6</version>
<url>http://code.google.com/p/json-path</url>
<name>json-path-parent-pom</name>
<description>Java JsonPath implementation</description>
<inceptionYear>2011</inceptionYear>
<issueManagement>
<system>GitHub Issue Tracking</system>
<url />
</issueManagement>
<licenses>
<license>
<name>Apache 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
</license>
</licenses>
<developers>
<developer>
<name>Kalle Stenflo</name>
<id>kalle.stenflo</id>
<organization>Jayway</organization>
<organizationUrl>http://www.jayway.com</organizationUrl>
<email>kale.stenflo at gmail.com</email>
<timezone>+1</timezone>
<roles>
<role>Developer</role>
</roles>
</developer>
</developers>
<properties>
<scm.branch>master</scm.branch>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<scm>
<url>http://github.com/daveb/JsonPath/tree/${scm.branch}</url>
<connection>scm:git:git://github.com/daveb/JsonPath.git</connection>
<developerConnection>scm:git:ssh://git@github.com/daveb/JsonPath.git</developerConnection>
</scm>
<mailingLists>
<mailingList>
<name>JsonPath mailing-list</name>
<archive>http://groups.google.com/group/json-path/topics</archive>
</mailingList>
</mailingLists>
<modules>
<module>json-path</module>
<module>json-path-assert</module>
</modules>
<build>
<pluginManagement>
<plugins>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependencies/${project.version}
</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
<!--
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
-->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>1.0.6.3</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2010 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>5</version>
</parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-parent</artifactId>
<packaging>pom</packaging>
<version>0.5.6-SNAPSHOT</version>
<url>http://code.google.com/p/json-path</url>
<name>json-path-parent-pom</name>
<description>Java JsonPath implementation</description>
<inceptionYear>2011</inceptionYear>
<issueManagement>
<system>GitHub Issue Tracking</system>
<url />
</issueManagement>
<licenses>
<license>
<name>Apache 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
</license>
</licenses>
<developers>
<developer>
<name>Kalle Stenflo</name>
<id>kalle.stenflo</id>
<organization>Jayway</organization>
<organizationUrl>http://www.jayway.com</organizationUrl>
<email>kale.stenflo at gmail.com</email>
<timezone>+1</timezone>
<roles>
<role>Developer</role>
</roles>
</developer>
</developers>
<properties>
<scm.branch>master</scm.branch>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<scm>
<url>http://github.com/daveb/JsonPath/tree/${scm.branch}</url>
<connection>scm:git:git://github.com/daveb/JsonPath.git</connection>
<developerConnection>scm:git:ssh://git@github.com/daveb/JsonPath.git</developerConnection>
</scm>
<mailingLists>
<mailingList>
<name>JsonPath mailing-list</name>
<archive>http://groups.google.com/group/json-path/topics</archive>
</mailingList>
</mailingLists>
<modules>
<module>json-path</module>
<module>json-path-assert</module>
</modules>
<build>
<pluginManagement>
<plugins>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependencies/${project.version}
</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
<!--
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
-->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>1.0.6.3</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>

191
pom.xml.releaseBackup

@ -1,191 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2010 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>5</version>
</parent>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-parent</artifactId>
<packaging>pom</packaging>
<version>0.5.6-SNAPSHOT</version>
<url>http://code.google.com/p/json-path</url>
<name>json-path-parent-pom</name>
<description>Java JsonPath implementation</description>
<inceptionYear>2011</inceptionYear>
<issueManagement>
<system>GitHub Issue Tracking</system>
<url />
</issueManagement>
<licenses>
<license>
<name>Apache 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
</license>
</licenses>
<developers>
<developer>
<name>Kalle Stenflo</name>
<id>kalle.stenflo</id>
<organization>Jayway</organization>
<organizationUrl>http://www.jayway.com</organizationUrl>
<email>kale.stenflo at gmail.com</email>
<timezone>+1</timezone>
<roles>
<role>Developer</role>
</roles>
</developer>
</developers>
<properties>
<scm.branch>master</scm.branch>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<scm>
<url>http://github.com/daveb/JsonPath/tree/${scm.branch}</url>
<connection>scm:git:git://github.com/daveb/JsonPath.git</connection>
<developerConnection>scm:git:ssh://git@github.com/daveb/JsonPath.git</developerConnection>
</scm>
<mailingLists>
<mailingList>
<name>JsonPath mailing-list</name>
<archive>http://groups.google.com/group/json-path/topics</archive>
</mailingList>
</mailingLists>
<modules>
<module>json-path</module>
<module>json-path-assert</module>
</modules>
<build>
<pluginManagement>
<plugins>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependencies/${project.version}
</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
<!--
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
-->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>1.0.6.3</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>

21
release.properties

@ -1,21 +0,0 @@
#release configuration
#Fri Jul 29 12:38:04 PDT 2011
project.scm.com.jayway.jsonpath\:json-path-assert.empty=true
scm.commentPrefix=[maven-release-plugin]
scm.tag=json-path-parent-0.5.6
remoteTagging=true
project.dev.com.jayway.jsonpath\:json-path-assert=0.5.7-SNAPSHOT
exec.additionalArguments=-Psonatype-oss-release -P wdig-dev
project.rel.com.jayway.jsonpath\:json-path-assert=0.5.6
project.scm.com.jayway.jsonpath\:json-path-parent.tag=HEAD
project.scm.com.jayway.jsonpath\:json-path-parent.developerConnection=scm\:git\:ssh\://git@github.com/daveb/JsonPath.git
project.scm.com.jayway.jsonpath\:json-path-parent.connection=scm\:git\:git\://github.com/daveb/JsonPath.git
project.dev.com.jayway.jsonpath\:json-path=0.5.7-SNAPSHOT
scm.url=scm\:git\:ssh\://git@github.com/daveb/JsonPath.git
preparationGoals=clean verify
project.dev.com.jayway.jsonpath\:json-path-parent=0.5.7-SNAPSHOT
project.scm.com.jayway.jsonpath\:json-path.empty=true
project.scm.com.jayway.jsonpath\:json-path-parent.url=http\://github.com/daveb/JsonPath/tree/master
project.rel.com.jayway.jsonpath\:json-path-parent=0.5.6
project.rel.com.jayway.jsonpath\:json-path=0.5.6
completedPhase=generate-release-poms
Loading…
Cancel
Save