Browse Source

bump dependency versions and fix build issues

pull/534/head
Kalle Stenflo 6 years ago
parent
commit
4bdf9b7bdc
  1. 29
      build.gradle
  2. 10
      json-path-assert/src/main/java/com/jayway/jsonassert/JsonAsserter.java
  3. 2
      json-path-assert/src/main/java/com/jayway/jsonpath/matchers/WithJsonPath.java
  4. 11
      json-path/src/main/java/com/jayway/jsonpath/Configuration.java
  5. 2
      json-path/src/main/java/com/jayway/jsonpath/Filter.java
  6. 10
      json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
  7. 1
      json-path/src/main/java/com/jayway/jsonpath/internal/ParseContextImpl.java
  8. 2
      json-path/src/main/java/com/jayway/jsonpath/internal/function/PathFunction.java
  9. 2
      json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/JsonLateBindingValue.java
  10. 3
      json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/PathLateBindingValue.java
  11. 2
      json-path/src/main/java/com/jayway/jsonpath/internal/path/FunctionPathToken.java
  12. 5
      json-path/src/main/java/com/jayway/jsonpath/spi/cache/Cache.java
  13. 1
      json-path/src/main/java/com/jayway/jsonpath/spi/json/AbstractJsonProvider.java
  14. 2
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonNodeJsonProvider.java
  15. 4
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonProvider.java
  16. 18
      json-path/src/test/java/com/jayway/jsonpath/FilterTest.java
  17. 3
      json-path/src/test/java/com/jayway/jsonpath/internal/filter/RegexpEvaluatorTest.java
  18. 4
      json-path/src/test/java/com/jayway/jsonpath/internal/function/Issue234.java
  19. 2
      json-path/src/test/java/com/jayway/jsonpath/old/ArraySlicingTest.java
  20. 6
      json-path/src/test/java/com/jayway/jsonpath/old/FilterTest.java
  21. 4
      json-path/src/test/java/com/jayway/jsonpath/old/IssuesTest.java
  22. 4
      json-path/src/test/java/com/jayway/jsonpath/old/NullHandlingTest.java
  23. 2
      json-path/src/test/java/com/jayway/jsonpath/old/internal/PropertyPathTokenTest.java
  24. 2
      system.properties

29
build.gradle

@ -4,24 +4,31 @@ buildscript {
}
dependencies {
classpath 'me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.1.0'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
}
}
ext {
libs = [
slf4jApi: 'org.slf4j:slf4j-api:1.7.25',
jsonSmart: 'net.minidev:json-smart:2.3',
jacksonDatabind: 'com.fasterxml.jackson.core:jackson-databind:2.6.3',
gson: 'com.google.code.gson:gson:2.3.1',
jettison: 'org.codehaus.jettison:jettison:1.3.7',
jsonOrg: 'org.json:json:20140107',
tapestryJson: 'org.apache.tapestry:tapestry-json:5.4.3',
gson: 'com.google.code.gson:gson:2.8.5',
hamcrestCore: 'org.hamcrest:hamcrest-core:1.3',
hamcrestLibrary: 'org.hamcrest:hamcrest-library:1.3',
jacksonDatabind: 'com.fasterxml.jackson.core:jackson-databind:2.9.8',
jettison: 'org.codehaus.jettison:jettison:1.3.7',
jsonOrg: 'org.json:json:20140107',
jsonSmart: 'net.minidev:json-smart:2.3',
slf4jApi: 'org.slf4j:slf4j-api:1.7.26',
tapestryJson: 'org.apache.tapestry:tapestry-json:5.4.4',
test: ['org.slf4j:slf4j-simple:1.7.16', 'org.assertj:assertj-core:2.1.0', 'commons-io:commons-io:2.4','org.hamcrest:hamcrest-core:1.3', 'org.hamcrest:hamcrest-library:1.3', 'junit:junit:4.12']
test: [
'commons-io:commons-io:2.4',
'junit:junit:4.12',
'org.assertj:assertj-core:3.11.1',
'org.hamcrest:hamcrest-core:1.3',
'org.hamcrest:hamcrest-library:1.3',
'org.slf4j:slf4j-simple:1.7.26'
]
]
snapshotVersion = false
}
@ -45,8 +52,8 @@ subprojects {
apply plugin: 'signing'
apply plugin: 'osgi'
sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()

10
json-path-assert/src/main/java/com/jayway/jsonassert/JsonAsserter.java

@ -22,11 +22,11 @@ public interface JsonAsserter {
<T> JsonAsserter assertThat(String path, Matcher<T> matcher);
/**
* @param path
* @param matcher
* @param message
* @param <T>
* @return
* @param path the json path specifying the value being compared
* @param matcher an expression, built of Matchers, specifying allowed values
* @param message the explanation message
* @param <T> the static type that should be returned by the path
* @return this to allow fluent assertion chains
*/
<T> JsonAsserter assertThat(String path, Matcher<T> matcher, String message);

2
json-path-assert/src/main/java/com/jayway/jsonpath/matchers/WithJsonPath.java

@ -38,7 +38,7 @@ public class WithJsonPath<T> extends TypeSafeMatcher<ReadContext> {
@Override
protected void describeMismatchSafely(ReadContext context, Description mismatchDescription) {
try {
T value = jsonPath.read(context.json());
T value = jsonPath.read(context.jsonString());
mismatchDescription
.appendText("json path ")
.appendValue(jsonPath.getPath())

11
json-path/src/main/java/com/jayway/jsonpath/Configuration.java

@ -18,12 +18,7 @@ import com.jayway.jsonpath.internal.DefaultsImpl;
import com.jayway.jsonpath.spi.json.JsonProvider;
import com.jayway.jsonpath.spi.mapper.MappingProvider;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;
import java.util.*;
import static com.jayway.jsonpath.internal.Utils.notNull;
import static java.util.Arrays.asList;
@ -142,7 +137,7 @@ public class Configuration {
/**
* Creates a new configuration with the provided options. Options in this configuration are discarded.
* @param options
* @return
* @return the new configuration instance
*/
public Configuration setOptions(Option... options) {
return Configuration.builder().jsonProvider(jsonProvider).mappingProvider(mappingProvider).options(options).evaluationListener(evaluationListeners).build();
@ -150,7 +145,7 @@ public class Configuration {
/**
* Returns the options used by this configuration
* @return
* @return the new configuration instance
*/
public Set<Option> getOptions() {
return options;

2
json-path/src/main/java/com/jayway/jsonpath/Filter.java

@ -39,7 +39,7 @@ public abstract class Filter implements Predicate {
/**
* Create a new Filter based on given list of criteria.
* @param predicates list of criteria all needs to evaluate to true
* @return
* @return the filter
*/
public static Filter filter(Collection<Predicate> predicates) {
return new AndFilter(predicates);

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

@ -15,11 +15,7 @@
package com.jayway.jsonpath;
import com.jayway.jsonpath.internal.EvaluationContext;
import com.jayway.jsonpath.internal.ParseContextImpl;
import com.jayway.jsonpath.internal.Path;
import com.jayway.jsonpath.internal.PathRef;
import com.jayway.jsonpath.internal.Utils;
import com.jayway.jsonpath.internal.*;
import com.jayway.jsonpath.internal.path.PathCompiler;
import com.jayway.jsonpath.spi.json.JsonProvider;
@ -289,7 +285,7 @@ public class JsonPath {
* Adds or updates the Object this path points to in the provided jsonObject with a key with a value
*
* @param jsonObject a json object
* @param value the key to add or update
* @param key the key to add or update
* @param value the new value
* @param configuration configuration to use
* @param <T> expected return type
@ -628,6 +624,7 @@ public class JsonPath {
* @param json url
* @return a read context
*/
@Deprecated
public static DocumentContext parse(URL json) throws IOException {
return new ParseContextImpl().parse(json);
}
@ -683,6 +680,7 @@ public class JsonPath {
* @param json input
* @return a read context
*/
@Deprecated
public static DocumentContext parse(URL json, Configuration configuration) throws IOException {
return new ParseContextImpl(configuration).parse(json);
}

1
json-path/src/main/java/com/jayway/jsonpath/internal/ParseContextImpl.java

@ -68,6 +68,7 @@ public class ParseContextImpl implements ParseContext {
}
@Override
@Deprecated
public DocumentContext parse(URL url) throws IOException {
notNull(url, "url can not be null");
InputStream fis = null;

2
json-path/src/main/java/com/jayway/jsonpath/internal/function/PathFunction.java

@ -30,7 +30,7 @@ public interface PathFunction {
* Eval context, state bag used as the path is traversed, maintains the result of executing
*
* @param parameters
* @return
* @return result
*/
Object invoke(String currentPath, PathRef parent, Object model, EvaluationContext ctx, List<Parameter> parameters);
}

2
json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/JsonLateBindingValue.java

@ -34,7 +34,7 @@ public class JsonLateBindingValue implements ILateBindingValue {
* Evaluate the JSON document at the point of need using the JSON parameter and associated document model which may
* itself originate from yet another function thus recursively invoking late binding methods.
*
* @return
* @return the late value
*/
@Override
public Object get() {

3
json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/PathLateBindingValue.java

@ -16,7 +16,6 @@ package com.jayway.jsonpath.internal.function.latebinding;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.internal.Path;
import com.jayway.jsonpath.internal.function.ParamType;
/**
* Defines the contract for late bindings, provides document state and enough context to perform the evaluation at a later
@ -39,7 +38,7 @@ public class PathLateBindingValue implements ILateBindingValue {
/**
* Evaluate the expression at the point of need for Path type expressions
*
* @return
* @return the late value
*/
public Object get() {
return path.evaluate(rootDocument, rootDocument, configuration).getValue();

2
json-path/src/main/java/com/jayway/jsonpath/internal/path/FunctionPathToken.java

@ -68,7 +68,7 @@ public class FunctionPathToken extends PathToken {
* Return the actual value by indicating true. If this return was false then we'd return the value in an array which
* isn't what is desired - true indicates the raw value is returned.
*
* @return
* @return true if token is definite
*/
@Override
public boolean isTokenDefinite() {

5
json-path/src/main/java/com/jayway/jsonpath/spi/cache/Cache.java vendored

@ -10,14 +10,13 @@ public interface Cache {
* @param key cache key to lookup the JsonPath
* @return JsonPath
*/
public JsonPath get(String key);
JsonPath get(String key);
/**
* Add JsonPath to the cache
* @param key cache key to store the JsonPath
* @param value JsonPath to be cached
* @return void
* @throws InvalidJsonException
*/
public void put(String key, JsonPath value);
void put(String key, JsonPath value);
}

1
json-path/src/main/java/com/jayway/jsonpath/spi/json/AbstractJsonProvider.java

@ -43,6 +43,7 @@ public abstract class AbstractJsonProvider implements JsonProvider {
return ((List) obj).get(idx);
}
@Deprecated
public final Object getArrayIndex(Object obj, int idx, boolean unwrap){
return getArrayIndex(obj, idx);
}

2
json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonNodeJsonProvider.java

@ -270,7 +270,7 @@ public class JacksonJsonNodeJsonProvider extends AbstractJsonProvider {
} else if (value == null) {
objectNode.set(key.toString(), null); // this will create a null-node
} else {
objectNode.put(key.toString(), createJsonElement(value));
objectNode.set(key.toString(), createJsonElement(value));
}
}

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

@ -30,7 +30,7 @@ import java.util.List;
public class JacksonJsonProvider extends AbstractJsonProvider {
private static final ObjectMapper defaultObjectMapper = new ObjectMapper();
private static final ObjectReader defaultObjectReader = defaultObjectMapper.reader().withType(Object.class);
private static final ObjectReader defaultObjectReader = defaultObjectMapper.reader().forType(Object.class);
protected ObjectMapper objectMapper;
protected ObjectReader objectReader;
@ -51,7 +51,7 @@ public class JacksonJsonProvider extends AbstractJsonProvider {
* @param objectMapper the ObjectMapper to use
*/
public JacksonJsonProvider(ObjectMapper objectMapper) {
this(objectMapper, objectMapper.reader().withType(Object.class));
this(objectMapper, objectMapper.reader().forType(Object.class));
}
/**

18
json-path/src/test/java/com/jayway/jsonpath/FilterTest.java

@ -418,13 +418,13 @@ public class FilterTest extends BaseTest {
//----------------------------------------------------------------------------
@Test
public void not_empty_evals() {
assertThat(filter(where("string-key").notEmpty()).apply(createPredicateContext(json))).isEqualTo(true);
assertThat(filter(where("string-key-empty").notEmpty()).apply(createPredicateContext(json))).isEqualTo(false);
assertThat(filter(where("string-key").empty(false)).apply(createPredicateContext(json))).isEqualTo(true);
assertThat(filter(where("string-key-empty").empty(false)).apply(createPredicateContext(json))).isEqualTo(false);
assertThat(filter(where("int-arr").notEmpty()).apply(createPredicateContext(json))).isEqualTo(true);
assertThat(filter(where("arr-empty").notEmpty()).apply(createPredicateContext(json))).isEqualTo(false);
assertThat(filter(where("int-arr").empty(false)).apply(createPredicateContext(json))).isEqualTo(true);
assertThat(filter(where("arr-empty").empty(false)).apply(createPredicateContext(json))).isEqualTo(false);
assertThat(filter(where("null-key").notEmpty()).apply(createPredicateContext(json))).isEqualTo(false);
assertThat(filter(where("null-key").empty(false)).apply(createPredicateContext(json))).isEqualTo(false);
}
//----------------------------------------------------------------------------
@ -516,11 +516,11 @@ public class FilterTest extends BaseTest {
@Test
public void criteria_can_be_parsed() {
Criteria criteria = Criteria.parse("@.foo == 'baar'");
assertThat(criteria.toString()).isEqualTo("@['foo'] == 'baar'");
Filter criteria = Filter.parse("[?(@.foo == 'baar')]");
assertThat(criteria.toString()).isEqualTo("[?(@['foo'] == 'baar')]");
criteria = Criteria.parse("@.foo");
assertThat(criteria.toString()).isEqualTo("@['foo']");
criteria = Filter.parse("[?(@.foo)]");
assertThat(criteria.toString()).isEqualTo("[?(@['foo'])]");
}

3
json-path/src/test/java/com/jayway/jsonpath/internal/filter/RegexpEvaluatorTest.java

@ -11,6 +11,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.Arrays;
import java.util.HashMap;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
@ -84,7 +85,7 @@ public class RegexpEvaluatorTest extends BaseTest {
}
private Predicate.PredicateContext createPredicateContext() {
return createPredicateContext(Maps.newHashMap());
return createPredicateContext(new HashMap<>());
}
}

4
json-path/src/test/java/com/jayway/jsonpath/internal/function/Issue234.java

@ -1,9 +1,9 @@
package com.jayway.jsonpath.internal.function;
import com.jayway.jsonpath.JsonPath;
import org.assertj.core.util.Maps;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
@ -27,7 +27,7 @@ public class Issue234 {
@Test
public void testIssue234() {
Map<String, String> context = Maps.newHashMap();
Map<String, String> context = new HashMap<>();
context.put("key", "first");
Object value = JsonPath.read(context, "concat(\"/\", $.key)");
assertThat(value).isEqualTo("/first");

2
json-path/src/test/java/com/jayway/jsonpath/old/ArraySlicingTest.java

@ -6,7 +6,7 @@ import org.junit.Test;
import java.util.List;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
/**

6
json-path/src/test/java/com/jayway/jsonpath/old/FilterTest.java

@ -18,7 +18,7 @@ import java.util.regex.Pattern;
import static com.jayway.jsonpath.Criteria.where;
import static com.jayway.jsonpath.Filter.filter;
import static java.util.Arrays.asList;
import static junit.framework.Assert.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@ -409,10 +409,10 @@ public class FilterTest extends BaseTest {
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(json);
List<Map<String, Object>> result = JsonPath.read(doc, "$.fields[?]", filter(where("errors").notEmpty()));
List<Map<String, Object>> result = JsonPath.read(doc, "$.fields[?]", filter(where("errors").empty(false)));
assertEquals(1, result.size());
List<Map<String, Object>> result2 = JsonPath.read(doc, "$.fields[?]", filter(where("name").notEmpty()));
List<Map<String, Object>> result2 = JsonPath.read(doc, "$.fields[?]", filter(where("name").empty(false)));
assertEquals(2, result2.size());
}

4
json-path/src/test/java/com/jayway/jsonpath/old/IssuesTest.java

@ -35,8 +35,8 @@ import static com.jayway.jsonpath.Criteria.where;
import static com.jayway.jsonpath.Filter.filter;
import static com.jayway.jsonpath.JsonPath.read;
import static com.jayway.jsonpath.JsonPath.using;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;
import static org.hamcrest.Matchers.is;

4
json-path/src/test/java/com/jayway/jsonpath/old/NullHandlingTest.java

@ -9,8 +9,8 @@ import org.junit.Test;
import java.util.List;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class NullHandlingTest {

2
json-path/src/test/java/com/jayway/jsonpath/old/internal/PropertyPathTokenTest.java

@ -10,7 +10,7 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import static junit.framework.Assert.assertNull;
import static org.junit.Assert.assertNull;
import static org.assertj.core.api.Assertions.assertThat;
public class PropertyPathTokenTest {

2
system.properties

@ -1 +1 @@
java.runtime.version=1.7
java.runtime.version=1.8
Loading…
Cancel
Save