From e6e28772f39e7cfb4cefb8f088dc98a7013f8dff Mon Sep 17 00:00:00 2001 From: Kalle Stenflo Date: Mon, 23 Feb 2015 21:17:55 +0100 Subject: [PATCH] Moved providers out of internal. --- changelog.md | 2 + .../com/jayway/jsonpath/web/bench/Bench.java | 2 +- .../com/jayway/jsonpath/Configuration.java | 4 +- .../internal/token/EvaluationContextImpl.java | 1 - .../jsonpath/spi/http/HttpProvider.java | 1 + .../spi/http/HttpProviderFactory.java | 1 + .../spi/json/AbstractJsonProvider.java | 4 +- .../spi/json/GsonJsonProvider.java | 2 +- .../spi/json/JacksonJsonNodeJsonProvider.java | 2 +- .../spi/json/JacksonJsonProvider.java | 2 +- .../spi/json/JsonSmartJsonProvider.java | 3 +- .../{internal => }/spi/mapper/Factory.java | 2 +- .../spi/mapper/GsonMappingProvider.java | 5 +-- .../spi/mapper/JacksonMappingProvider.java | 4 +- .../spi/mapper/JsonSmartMappingProvider.java | 9 +--- .../java/com/jayway/jsonpath/BaseTest.java | 10 ++--- .../jayway/jsonpath/old/HttpProviderTest.java | 44 ------------------- .../jayway/jsonpath/old/JsonProviderTest.java | 2 +- 18 files changed, 22 insertions(+), 78 deletions(-) rename json-path/src/main/java/com/jayway/jsonpath/{internal => }/spi/json/AbstractJsonProvider.java (98%) rename json-path/src/main/java/com/jayway/jsonpath/{internal => }/spi/json/GsonJsonProvider.java (99%) rename json-path/src/main/java/com/jayway/jsonpath/{internal => }/spi/json/JacksonJsonNodeJsonProvider.java (99%) rename json-path/src/main/java/com/jayway/jsonpath/{internal => }/spi/json/JacksonJsonProvider.java (98%) rename json-path/src/main/java/com/jayway/jsonpath/{internal => }/spi/json/JsonSmartJsonProvider.java (97%) rename json-path/src/main/java/com/jayway/jsonpath/{internal => }/spi/mapper/Factory.java (54%) rename json-path/src/main/java/com/jayway/jsonpath/{internal => }/spi/mapper/GsonMappingProvider.java (92%) rename json-path/src/main/java/com/jayway/jsonpath/{internal => }/spi/mapper/JacksonMappingProvider.java (92%) rename json-path/src/main/java/com/jayway/jsonpath/{internal => }/spi/mapper/JsonSmartMappingProvider.java (96%) delete mode 100644 json-path/src/test/java/com/jayway/jsonpath/old/HttpProviderTest.java diff --git a/changelog.md b/changelog.md index bbf3ceb0..25584d33 100644 --- a/changelog.md +++ b/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) ================== diff --git a/json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Bench.java b/json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Bench.java index 3d9a49e7..8d51620b 100644 --- a/json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Bench.java +++ b/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; diff --git a/json-path/src/main/java/com/jayway/jsonpath/Configuration.java b/json-path/src/main/java/com/jayway/jsonpath/Configuration.java index e9a2ceae..8e8b9e45 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/Configuration.java +++ b/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; diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/token/EvaluationContextImpl.java b/json-path/src/main/java/com/jayway/jsonpath/internal/token/EvaluationContextImpl.java index 86dfce14..c85419a9 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/token/EvaluationContextImpl.java +++ b/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; diff --git a/json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProvider.java b/json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProvider.java index 3b38f64b..403afd99 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProvider.java +++ b/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; diff --git a/json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProviderFactory.java b/json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProviderFactory.java index aaf75d71..d3704dab 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/spi/http/HttpProviderFactory.java +++ b/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() { diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/AbstractJsonProvider.java b/json-path/src/main/java/com/jayway/jsonpath/spi/json/AbstractJsonProvider.java similarity index 98% rename from json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/AbstractJsonProvider.java rename to json-path/src/main/java/com/jayway/jsonpath/spi/json/AbstractJsonProvider.java index 07e3c26f..0a7d7275 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/AbstractJsonProvider.java +++ b/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; diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/GsonJsonProvider.java b/json-path/src/main/java/com/jayway/jsonpath/spi/json/GsonJsonProvider.java similarity index 99% rename from json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/GsonJsonProvider.java rename to json-path/src/main/java/com/jayway/jsonpath/spi/json/GsonJsonProvider.java index 07c23b42..95bf35b5 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/GsonJsonProvider.java +++ b/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; diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JacksonJsonNodeJsonProvider.java b/json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonNodeJsonProvider.java similarity index 99% rename from json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JacksonJsonNodeJsonProvider.java rename to json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonNodeJsonProvider.java index 0a07b8f1..382e47af 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JacksonJsonNodeJsonProvider.java +++ b/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; diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JacksonJsonProvider.java b/json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonProvider.java similarity index 98% rename from json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JacksonJsonProvider.java rename to json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonProvider.java index 9372d89b..1d864bdc 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JacksonJsonProvider.java +++ b/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; diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JsonSmartJsonProvider.java b/json-path/src/main/java/com/jayway/jsonpath/spi/json/JsonSmartJsonProvider.java similarity index 97% rename from json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JsonSmartJsonProvider.java rename to json-path/src/main/java/com/jayway/jsonpath/spi/json/JsonSmartJsonProvider.java index 78b495eb..e6c54b8c 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JsonSmartJsonProvider.java +++ b/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; diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/Factory.java b/json-path/src/main/java/com/jayway/jsonpath/spi/mapper/Factory.java similarity index 54% rename from json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/Factory.java rename to json-path/src/main/java/com/jayway/jsonpath/spi/mapper/Factory.java index 32060b63..91b4843e 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/Factory.java +++ b/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 { diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/GsonMappingProvider.java b/json-path/src/main/java/com/jayway/jsonpath/spi/mapper/GsonMappingProvider.java similarity index 92% rename from json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/GsonMappingProvider.java rename to json-path/src/main/java/com/jayway/jsonpath/spi/mapper/GsonMappingProvider.java index 51bee874..7bf3a9db 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/GsonMappingProvider.java +++ b/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; diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/JacksonMappingProvider.java b/json-path/src/main/java/com/jayway/jsonpath/spi/mapper/JacksonMappingProvider.java similarity index 92% rename from json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/JacksonMappingProvider.java rename to json-path/src/main/java/com/jayway/jsonpath/spi/mapper/JacksonMappingProvider.java index 90a12ca2..3971b2b9 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/JacksonMappingProvider.java +++ b/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 { diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/JsonSmartMappingProvider.java b/json-path/src/main/java/com/jayway/jsonpath/spi/mapper/JsonSmartMappingProvider.java similarity index 96% rename from json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/JsonSmartMappingProvider.java rename to json-path/src/main/java/com/jayway/jsonpath/spi/mapper/JsonSmartMappingProvider.java index bd02d67f..a3b072b4 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/spi/mapper/JsonSmartMappingProvider.java +++ b/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 { diff --git a/json-path/src/test/java/com/jayway/jsonpath/BaseTest.java b/json-path/src/test/java/com/jayway/jsonpath/BaseTest.java index 680451ac..8070b04d 100644 --- a/json-path/src/test/java/com/jayway/jsonpath/BaseTest.java +++ b/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; diff --git a/json-path/src/test/java/com/jayway/jsonpath/old/HttpProviderTest.java b/json-path/src/test/java/com/jayway/jsonpath/old/HttpProviderTest.java deleted file mode 100644 index cc46a378..00000000 --- a/json-path/src/test/java/com/jayway/jsonpath/old/HttpProviderTest.java +++ /dev/null @@ -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); - } - - } - -} diff --git a/json-path/src/test/java/com/jayway/jsonpath/old/JsonProviderTest.java b/json-path/src/test/java/com/jayway/jsonpath/old/JsonProviderTest.java index 7cde8216..a1e31693 100644 --- a/json-path/src/test/java/com/jayway/jsonpath/old/JsonProviderTest.java +++ b/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 {