Browse Source

Moved providers out of internal.

pull/69/head
Kalle Stenflo 10 years ago
parent
commit
e6e28772f3
  1. 2
      changelog.md
  2. 2
      json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Bench.java
  3. 4
      json-path/src/main/java/com/jayway/jsonpath/Configuration.java
  4. 1
      json-path/src/main/java/com/jayway/jsonpath/internal/token/EvaluationContextImpl.java
  5. 1
      json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProvider.java
  6. 1
      json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProviderFactory.java
  7. 4
      json-path/src/main/java/com/jayway/jsonpath/spi/json/AbstractJsonProvider.java
  8. 2
      json-path/src/main/java/com/jayway/jsonpath/spi/json/GsonJsonProvider.java
  9. 2
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonNodeJsonProvider.java
  10. 2
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonProvider.java
  11. 3
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JsonSmartJsonProvider.java
  12. 2
      json-path/src/main/java/com/jayway/jsonpath/spi/mapper/Factory.java
  13. 5
      json-path/src/main/java/com/jayway/jsonpath/spi/mapper/GsonMappingProvider.java
  14. 4
      json-path/src/main/java/com/jayway/jsonpath/spi/mapper/JacksonMappingProvider.java
  15. 9
      json-path/src/main/java/com/jayway/jsonpath/spi/mapper/JsonSmartMappingProvider.java
  16. 10
      json-path/src/test/java/com/jayway/jsonpath/BaseTest.java
  17. 44
      json-path/src/test/java/com/jayway/jsonpath/old/HttpProviderTest.java
  18. 2
      json-path/src/test/java/com/jayway/jsonpath/old/JsonProviderTest.java

2
changelog.md

@ -1,5 +1,7 @@
In The Pipe
===========
* Moved provider implementations to spi package (no longer internal)
* Deprecated HTTP provider and methods
1.2.0 (2014-11-11)
==================

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

@ -3,7 +3,7 @@ package com.jayway.jsonpath.web.bench;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.Option;
import com.jayway.jsonpath.internal.spi.json.JacksonJsonProvider;
import com.jayway.jsonpath.spi.json.JacksonJsonProvider;
import io.gatling.jsonpath.JsonPath$;
import org.boon.json.JsonParser;
import org.boon.json.ObjectMapper;

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

@ -14,9 +14,9 @@
*/
package com.jayway.jsonpath;
import com.jayway.jsonpath.internal.spi.json.JsonSmartJsonProvider;
import com.jayway.jsonpath.internal.spi.mapper.JsonSmartMappingProvider;
import com.jayway.jsonpath.spi.json.JsonProvider;
import com.jayway.jsonpath.spi.json.JsonSmartJsonProvider;
import com.jayway.jsonpath.spi.mapper.JsonSmartMappingProvider;
import com.jayway.jsonpath.spi.mapper.MappingProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

@ -23,7 +23,6 @@ import com.jayway.jsonpath.internal.EvaluationContext;
import com.jayway.jsonpath.internal.Path;
import com.jayway.jsonpath.internal.PathRef;
import com.jayway.jsonpath.spi.json.JsonProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

@ -18,6 +18,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@Deprecated
public interface HttpProvider {
InputStream get(URL url) throws IOException;

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

@ -19,6 +19,7 @@ import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
@Deprecated
public abstract class HttpProviderFactory {
public static HttpProviderFactory factory = new HttpProviderFactory() {

4
json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/AbstractJsonProvider.java → json-path/src/main/java/com/jayway/jsonpath/spi/json/AbstractJsonProvider.java

@ -12,11 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jayway.jsonpath.internal.spi.json;
package com.jayway.jsonpath.spi.json;
import com.jayway.jsonpath.JsonPathException;
import com.jayway.jsonpath.spi.json.JsonProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

2
json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/GsonJsonProvider.java → json-path/src/main/java/com/jayway/jsonpath/spi/json/GsonJsonProvider.java

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jayway.jsonpath.internal.spi.json;
package com.jayway.jsonpath.spi.json;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

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

@ -1,4 +1,4 @@
package com.jayway.jsonpath.internal.spi.json;
package com.jayway.jsonpath.spi.json;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

2
json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JacksonJsonProvider.java → json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonProvider.java

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jayway.jsonpath.internal.spi.json;
package com.jayway.jsonpath.spi.json;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.ObjectMapper;

3
json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JsonSmartJsonProvider.java → json-path/src/main/java/com/jayway/jsonpath/spi/json/JsonSmartJsonProvider.java

@ -12,11 +12,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jayway.jsonpath.internal.spi.json;
package com.jayway.jsonpath.spi.json;
import com.jayway.jsonpath.InvalidJsonException;
import com.jayway.jsonpath.JsonPathException;
import com.jayway.jsonpath.spi.json.Mode;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
import net.minidev.json.JSONStyle;

2
json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/Factory.java → json-path/src/main/java/com/jayway/jsonpath/spi/mapper/Factory.java

@ -1,4 +1,4 @@
package com.jayway.jsonpath.internal.spi.mapper;
package com.jayway.jsonpath.spi.mapper;
public interface Factory<T> {

5
json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/GsonMappingProvider.java → json-path/src/main/java/com/jayway/jsonpath/spi/mapper/GsonMappingProvider.java

@ -12,17 +12,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jayway.jsonpath.internal.spi.mapper;
package com.jayway.jsonpath.spi.mapper;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.JsonPathException;
import com.jayway.jsonpath.TypeRef;
import com.jayway.jsonpath.spi.mapper.MappingException;
import com.jayway.jsonpath.spi.mapper.MappingProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

4
json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/JacksonMappingProvider.java → json-path/src/main/java/com/jayway/jsonpath/spi/mapper/JacksonMappingProvider.java

@ -12,14 +12,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jayway.jsonpath.internal.spi.mapper;
package com.jayway.jsonpath.spi.mapper;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.TypeRef;
import com.jayway.jsonpath.spi.mapper.MappingException;
import com.jayway.jsonpath.spi.mapper.MappingProvider;
public class JacksonMappingProvider implements MappingProvider {

9
json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/JsonSmartMappingProvider.java → json-path/src/main/java/com/jayway/jsonpath/spi/mapper/JsonSmartMappingProvider.java

@ -12,27 +12,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jayway.jsonpath.internal.spi.mapper;
package com.jayway.jsonpath.spi.mapper;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.TypeRef;
import com.jayway.jsonpath.spi.mapper.MappingException;
import com.jayway.jsonpath.spi.mapper.MappingProvider;
import net.minidev.json.JSONUtil;
import net.minidev.json.JSONValue;
import net.minidev.json.writer.JsonReader;
import net.minidev.json.writer.JsonReaderI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
public class JsonSmartMappingProvider implements MappingProvider {

10
json-path/src/test/java/com/jayway/jsonpath/BaseTest.java

@ -1,11 +1,11 @@
package com.jayway.jsonpath;
import com.jayway.jsonpath.internal.Path;
import com.jayway.jsonpath.internal.spi.json.GsonJsonProvider;
import com.jayway.jsonpath.internal.spi.json.JacksonJsonNodeJsonProvider;
import com.jayway.jsonpath.internal.spi.json.JacksonJsonProvider;
import com.jayway.jsonpath.internal.spi.mapper.GsonMappingProvider;
import com.jayway.jsonpath.internal.spi.mapper.JacksonMappingProvider;
import com.jayway.jsonpath.spi.json.GsonJsonProvider;
import com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider;
import com.jayway.jsonpath.spi.json.JacksonJsonProvider;
import com.jayway.jsonpath.spi.mapper.GsonMappingProvider;
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider;
import com.jayway.jsonpath.internal.token.PredicateContextImpl;
import java.util.HashMap;

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

@ -1,44 +0,0 @@
package com.jayway.jsonpath.old;
import com.jayway.jsonpath.internal.Utils;
import com.jayway.jsonpath.spi.http.HttpProviderFactory;
import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import static junit.framework.Assert.assertEquals;
public class HttpProviderTest {
private static final String EXPECTED = "{\n" +
" \"results\" : [],\n" +
" \"status\" : \"ZERO_RESULTS\"\n" +
"}";
@Test
@Ignore
public void http_get() throws Exception {
URL url = new URL("http://maps.googleapis.com/maps/api/geocode/json?sensor=false");
InputStream inputStream = null;
try {
inputStream = HttpProviderFactory.getProvider().get(url);
byte[] bytes = org.apache.commons.io.IOUtils.toByteArray(inputStream);
String json = new String(bytes).trim();
assertEquals(EXPECTED, json);
} catch (IOException e) {
Utils.closeQuietly(inputStream);
}
}
}

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

@ -1,6 +1,6 @@
package com.jayway.jsonpath.old;
import com.jayway.jsonpath.internal.spi.json.JacksonJsonProvider;
import com.jayway.jsonpath.spi.json.JacksonJsonProvider;
import org.junit.Test;
public class JsonProviderTest {

Loading…
Cancel
Save