Browse Source

Optimized imports and removed file headers.

pull/41/head
Kalle Stenflo 11 years ago
parent
commit
20511b5cfc
  1. 18
      json-path-assert/src/main/java/com/jayway/jsonassert/JsonAssert.java
  2. 5
      json-path-assert/src/main/java/com/jayway/jsonassert/JsonAsserter.java
  3. 6
      json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java
  4. 5
      json-path-assert/src/test/java/com/jayway/jsonassert/JsonAssertTest.java
  5. 19
      json-path-web-test/pom.xml
  6. 3
      json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Bench.java
  7. 2
      json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Result.java
  8. 8
      json-path-web-test/src/main/java/com/jayway/jsonpath/web/boot/Main.java
  9. 5
      json-path/src/main/java/com/jayway/jsonpath/Configuration.java
  10. 6
      json-path/src/main/java/com/jayway/jsonpath/InvalidConversionException.java
  11. 5
      json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
  12. 5
      json-path/src/main/java/com/jayway/jsonpath/Option.java
  13. 5
      json-path/src/main/java/com/jayway/jsonpath/ParseContext.java
  14. 5
      json-path/src/main/java/com/jayway/jsonpath/PathNotFoundException.java
  15. 5
      json-path/src/main/java/com/jayway/jsonpath/ReadContext.java
  16. 11
      json-path/src/main/java/com/jayway/jsonpath/internal/JsonReader.java
  17. 2
      json-path/src/main/java/com/jayway/jsonpath/internal/Parser.java
  18. 11
      json-path/src/main/java/com/jayway/jsonpath/internal/Utils.java
  19. 2
      json-path/src/main/java/com/jayway/jsonpath/internal/spi/compiler/EvaluationContextImpl.java
  20. 6
      json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProvider.java
  21. 6
      json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProviderFactory.java
  22. 1
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JsonProviderFactory.java
  23. 3
      json-path/src/test/java/com/jayway/jsonpath/ArraySlicingTest.java
  24. 5
      json-path/src/test/java/com/jayway/jsonpath/CastTest.java
  25. 5
      json-path/src/test/java/com/jayway/jsonpath/DocumentationPageTests.java
  26. 6
      json-path/src/test/java/com/jayway/jsonpath/ExpressionEvalTest.java
  27. 2
      json-path/src/test/java/com/jayway/jsonpath/Filter2Test.java
  28. 6
      json-path/src/test/java/com/jayway/jsonpath/FilterTest.java
  29. 6
      json-path/src/test/java/com/jayway/jsonpath/HttpProviderTest.java
  30. 23
      json-path/src/test/java/com/jayway/jsonpath/IssuesTest.java
  31. 18
      json-path/src/test/java/com/jayway/jsonpath/JsonPathFilterTest.java
  32. 6
      json-path/src/test/java/com/jayway/jsonpath/JsonPathTest.java
  33. 6
      json-path/src/test/java/com/jayway/jsonpath/JsonProviderTest.java
  34. 12
      json-path/src/test/java/com/jayway/jsonpath/MultiAttributeTest.java
  35. 5
      json-path/src/test/java/com/jayway/jsonpath/NullHandlingTest.java
  36. 5
      json-path/src/test/java/com/jayway/jsonpath/internal/ArrayIndexFilterTest.java
  37. 5
      json-path/src/test/java/com/jayway/jsonpath/reader/ReadConfigurationTest.java
  38. 7
      json-path/src/test/java/com/jayway/jsonpath/util/ScriptEngineJsonPath.java

18
json-path-assert/src/main/java/com/jayway/jsonassert/JsonAssert.java

@ -2,20 +2,24 @@ package com.jayway.jsonassert;
import com.jayway.jsonassert.impl.JsonAsserterImpl;
import com.jayway.jsonassert.impl.matcher.*;
import com.jayway.jsonassert.impl.matcher.CollectionMatcher;
import com.jayway.jsonassert.impl.matcher.IsCollectionWithSize;
import com.jayway.jsonassert.impl.matcher.IsEmptyCollection;
import com.jayway.jsonassert.impl.matcher.IsMapContainingKey;
import com.jayway.jsonassert.impl.matcher.IsMapContainingValue;
import com.jayway.jsonpath.spi.json.JsonProviderFactory;
import org.hamcrest.Matcher;
import java.io.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.text.ParseException;
import java.util.Collection;
import java.util.Map;
/**
* User: kalle stenflo
* Date: 1/24/11
* Time: 9:31 PM
*/
public class JsonAssert {
/**

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

@ -2,11 +2,6 @@ package com.jayway.jsonassert;
import org.hamcrest.Matcher;
/**
* User: kallestenflo
* Date: 1/24/11
* Time: 9:22 PM
*/
public interface JsonAsserter {
/**

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

@ -3,7 +3,6 @@ package com.jayway.jsonassert.impl;
import com.jayway.jsonassert.JsonAsserter;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.InvalidPathException;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.Option;
import com.jayway.jsonpath.PathNotFoundException;
@ -12,11 +11,6 @@ import org.hamcrest.Matcher;
import static java.lang.String.format;
import static org.hamcrest.Matchers.*;
/**
* User: kalle stenflo
* Date: 1/21/11
* Time: 3:43 PM
*/
public class JsonAsserterImpl implements JsonAsserter {

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

@ -8,11 +8,6 @@ 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 class JsonAssertTest {
public final static String JSON =

19
json-path-web-test/pom.xml

@ -38,16 +38,27 @@
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.9.1</version>
<exclusions>
<exclusion>
<artifactId>jackson-annotations</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-core</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
<version>${commons-io.version}</version>
</dependency>
@ -70,8 +81,8 @@
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>

3
json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Bench.java

@ -2,7 +2,6 @@ package com.jayway.jsonpath.web.bench;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.internal.spi.json.JacksonProvider;
import com.jayway.jsonpath.spi.json.JsonProvider;
import com.jayway.jsonpath.spi.json.JsonProviderFactory;
import io.gatling.jsonpath.JsonPath$;
import org.boon.json.JsonParser;
@ -54,7 +53,7 @@ public class Bench {
} else if(res instanceof Boolean){
result = res.toString();
} else {
result = res != null ? JsonProviderFactory.createProvider().toJson(res) : null;
result = res != null ? JsonProviderFactory.createProvider().toJson(res) : "null";
}
return new Result("jayway", time, result, error);
}

2
json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Result.java

@ -2,8 +2,6 @@ package com.jayway.jsonpath.web.bench;
import com.jayway.jsonpath.internal.JsonFormatter;
import java.util.List;
public class Result {
public final String provider;

8
json-path-web-test/src/main/java/com/jayway/jsonpath/web/boot/Main.java

@ -1,9 +1,5 @@
package com.jayway.jsonpath.web.boot;
import static org.eclipse.jetty.servlet.ServletContextHandler.NO_SESSIONS;
import java.io.IOException;
import com.jayway.jsonpath.web.resource.IndexResource;
import com.jayway.jsonpath.web.resource.StaticResource;
import org.eclipse.jetty.server.Connector;
@ -16,6 +12,10 @@ import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.mvc.mustache.MustacheMvcFeature;
import org.glassfish.jersey.servlet.ServletContainer;
import java.io.IOException;
import static org.eclipse.jetty.servlet.ServletContextHandler.NO_SESSIONS;
public class Main {

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

@ -24,11 +24,6 @@ import java.util.Set;
import static com.jayway.jsonpath.internal.Utils.notNull;
/**
* User: kalle
* Date: 8/30/13
* Time: 12:05 PM
*/
public class Configuration {

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

@ -14,12 +14,6 @@
*/
package com.jayway.jsonpath;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 3/12/12
* Time: 7:49 AM
*/
public class InvalidConversionException extends RuntimeException {
public InvalidConversionException(String message) {

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

@ -15,12 +15,13 @@
package com.jayway.jsonpath;
import com.jayway.jsonpath.internal.*;
import com.jayway.jsonpath.internal.JsonReader;
import com.jayway.jsonpath.internal.Utils;
import com.jayway.jsonpath.internal.spi.compiler.PathCompiler;
import com.jayway.jsonpath.spi.compiler.Path;
import com.jayway.jsonpath.spi.http.HttpProviderFactory;
import com.jayway.jsonpath.spi.json.JsonProvider;
import com.jayway.jsonpath.spi.json.JsonProviderFactory;
import com.jayway.jsonpath.spi.compiler.Path;
import java.io.File;
import java.io.FileInputStream;

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

@ -14,11 +14,6 @@
*/
package com.jayway.jsonpath;
/**
* User: kalle
* Date: 8/30/13
* Time: 12:05 PM
*/
public enum Option {
/**
* Throw {@link PathNotFoundException} when JsonPath tries to read a property that does not exists.

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

@ -19,11 +19,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
/**
* User: kalle
* Date: 8/30/13
* Time: 12:03 PM
*/
public interface ParseContext {
ReadContext parse(String json);

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

@ -14,11 +14,6 @@
*/
package com.jayway.jsonpath;
/**
* User: kalle
* Date: 8/20/13
* Time: 2:33 PM
*/
public class PathNotFoundException extends InvalidPathException {
public PathNotFoundException() {

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

@ -16,11 +16,6 @@ package com.jayway.jsonpath;
import java.util.List;
/**
* User: kalle
* Date: 8/30/13
* Time: 12:03 PM
*/
public interface ReadContext {
/**

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

@ -1,6 +1,10 @@
package com.jayway.jsonpath.internal;
import com.jayway.jsonpath.*;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.Filter;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.ParseContext;
import com.jayway.jsonpath.ReadContext;
import com.jayway.jsonpath.spi.http.HttpProviderFactory;
import java.io.File;
@ -13,11 +17,6 @@ import java.util.List;
import static com.jayway.jsonpath.internal.Utils.notEmpty;
import static com.jayway.jsonpath.internal.Utils.notNull;
/**
* User: kalle
* Date: 8/30/13
* Time: 12:17 PM
*/
public class JsonReader implements ParseContext, ReadContext {
private final Configuration configuration;

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

@ -1,7 +1,5 @@
package com.jayway.jsonpath.internal;
import java.util.Arrays;
public class Parser {
public enum Token {

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

@ -2,7 +2,16 @@ package com.jayway.jsonpath.internal;
import com.jayway.jsonpath.InvalidConversionException;
import java.io.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamClass;
import java.io.OutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

2
json-path/src/main/java/com/jayway/jsonpath/internal/spi/compiler/EvaluationContextImpl.java

@ -2,8 +2,8 @@ package com.jayway.jsonpath.internal.spi.compiler;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.Option;
import com.jayway.jsonpath.spi.json.JsonProvider;
import com.jayway.jsonpath.spi.compiler.EvaluationContext;
import com.jayway.jsonpath.spi.json.JsonProvider;
import java.util.ArrayList;
import java.util.List;

6
json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProvider.java

@ -4,12 +4,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 3/10/12
* Time: 7:38 AM
*/
public interface HttpProvider {
InputStream get(URL url) throws IOException;

6
json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProviderFactory.java

@ -5,12 +5,6 @@ import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 3/10/12
* Time: 7:39 AM
*/
public abstract class HttpProviderFactory {
public static HttpProviderFactory factory = new HttpProviderFactory() {

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

@ -14,7 +14,6 @@
*/
package com.jayway.jsonpath.spi.json;
import com.jayway.jsonpath.internal.spi.json.JacksonProvider;
import com.jayway.jsonpath.internal.spi.json.JsonSmartJsonProvider;
/**

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

@ -9,9 +9,6 @@ import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertThat;
/**
* User: kalle
* Date: 8/20/13
* Time: 9:22 AM
*
* If you have a list
* nums = [1, 3, 5, 7, 8, 13, 20]

5
json-path/src/test/java/com/jayway/jsonpath/CastTest.java

@ -3,11 +3,6 @@ package com.jayway.jsonpath;
import org.junit.Assert;
import org.junit.Test;
/**
* User: kalle
* Date: 5/15/13
* Time: 9:22 PM
*/
public class CastTest {
public static final String JSON = "{\"sessionID\":7242750700467747000}" ;

5
json-path/src/test/java/com/jayway/jsonpath/DocumentationPageTests.java

@ -2,11 +2,6 @@ package com.jayway.jsonpath;
import org.junit.Test;
/**
* User: kalle
* Date: 8/23/13
* Time: 10:58 AM
*/
public class DocumentationPageTests {

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

@ -5,12 +5,6 @@ import com.jayway.jsonpath.spi.json.JsonProviderFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 2/4/11
* Time: 9:32 PM
*/
public class ExpressionEvalTest {
private static final Logger logger = LoggerFactory.getLogger(ExpressionEvalTest.class);

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

@ -6,7 +6,7 @@ import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import static com.jayway.jsonpath.Criteria.*;
import static com.jayway.jsonpath.Criteria.where;
import static com.jayway.jsonpath.Filter.filter;
import static org.assertj.core.api.Assertions.assertThat;

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

@ -17,12 +17,6 @@ import static junit.framework.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 3/5/12
* Time: 12:27 PM
*/
public class FilterTest {
public final static String DOCUMENT =

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

@ -11,12 +11,6 @@ import java.net.URL;
import static junit.framework.Assert.assertEquals;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 3/10/12
* Time: 8:12 AM
*/
@Ignore
public class HttpProviderTest {

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

@ -14,12 +14,6 @@ import static junit.framework.Assert.*;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 2/29/12
* Time: 8:42 AM
*/
public class IssuesTest {
private static final JsonProvider jp = JsonProviderFactory.createProvider();
@ -324,4 +318,21 @@ public class IssuesTest {
assertEquals(1, JsonPath.read(json, "$[0].a"));
}
@Test(expected = PathNotFoundException.class)
public void a_test() {
String json ="{\n" +
" \"success\": true,\n" +
" \"data\": {\n" +
" \"user\": 3,\n" +
" \"own\": null,\n" +
" \"passes\": null,\n" +
" \"completed\": null\n" +
" },\n" +
" \"version\": 1371160528774\n" +
"}";
Object read = JsonPath.read(json, "$.data.passes[0].id");
}
}

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

@ -1,23 +1,5 @@
package com.jayway.jsonpath;
import org.junit.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.assertEquals;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 3/5/12
* Time: 4:24 PM
*/
public class JsonPathFilterTest {
public final static String DOCUMENT =

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

@ -13,12 +13,6 @@ import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.*;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 2/2/11
* Time: 3:07 PM
*/
public class JsonPathTest {

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

@ -3,12 +3,6 @@ package com.jayway.jsonpath;
import com.jayway.jsonpath.internal.spi.json.JacksonProvider;
import org.junit.Test;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 11/8/11
* Time: 10:40 PM
*/
public class JsonProviderTest {
public final static String ARRAY = "[{\"value\": 1},{\"value\": 2}, {\"value\": 3},{\"value\": 4}]";

12
json-path/src/test/java/com/jayway/jsonpath/MultiAttributeTest.java

@ -1,17 +1,5 @@
package com.jayway.jsonpath;
import org.junit.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
/**
* User: kalle
* Date: 8/20/13
* Time: 8:03 AM
*/
public class MultiAttributeTest {
public final static String DOCUMENT =

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

@ -9,11 +9,6 @@ import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* User: kalle
* Date: 8/22/13
* Time: 10:39 AM
*/
public class NullHandlingTest {
public static final String DOCUMENT = "{\n" +

5
json-path/src/test/java/com/jayway/jsonpath/internal/ArrayIndexFilterTest.java

@ -8,11 +8,6 @@ import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* User: kalle
* Date: 9/9/13
* Time: 8:10 AM
*/
public class ArrayIndexFilterTest {
private static final String JSON = "[1, 3, 5, 7, 8, 13, 20]";

5
json-path/src/test/java/com/jayway/jsonpath/reader/ReadConfigurationTest.java

@ -7,11 +7,6 @@ import com.jayway.jsonpath.spi.json.JsonProvider;
import com.jayway.jsonpath.spi.json.JsonProviderFactory;
import org.junit.Test;
/**
* User: kalle
* Date: 8/29/13
* Time: 12:09 PM
*/
public class ReadConfigurationTest {
private static JsonProvider provider = JsonProviderFactory.createProvider();

7
json-path/src/test/java/com/jayway/jsonpath/util/ScriptEngineJsonPath.java

@ -4,16 +4,11 @@ import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 11/8/11
* Time: 1:01 PM
*/
public class ScriptEngineJsonPath {
private static ScriptEngineManager manager = new ScriptEngineManager();

Loading…
Cancel
Save