SLING-6906: Remove commons.json from testing junit remote.
authorKarl Pauls <pauls@apache.org>
Thu, 1 Jun 2017 12:44:19 +0000 (12:44 +0000)
committerKarl Pauls <pauls@apache.org>
Thu, 1 Jun 2017 12:44:19 +0000 (12:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1797216 13f79535-47bb-0310-9956-ffa450edef68

pom.xml
src/main/java/org/apache/sling/junit/remote/exported/ExampleRemoteTest.java
src/main/java/org/apache/sling/junit/remote/testrunner/RemoteExecutionException.java
src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTest.java
src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestRunner.java

diff --git a/pom.xml b/pom.xml
index d35e95f..7d3d7a2 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.junit.core</artifactId>
-            <version>1.0.11-SNAPSHOT</version>
+            <version>1.0.24-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.tools</artifactId>
-            <version>1.0.6</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.json</artifactId>
-            <version>2.0.6</version>
+            <version>1.0.17-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
index ba7b6be..7f160e7 100644 (file)
@@ -17,6 +17,7 @@
 package org.apache.sling.junit.remote.exported;
 
 import static org.junit.Assert.fail;
+
 import org.apache.sling.junit.remote.ide.SlingRemoteExecutionRule;
 import org.apache.sling.testing.tools.http.Request;
 import org.junit.Rule;
index 997d126..5c60e9f 100644 (file)
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.io.StringReader;
-import java.nio.CharBuffer;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Matcher;
index 99b194f..694c665 100644 (file)
@@ -18,8 +18,9 @@ package org.apache.sling.junit.remote.testrunner;
 
 import java.io.IOException;
 
-import org.apache.sling.commons.json.JSONException;
-import org.apache.sling.commons.json.JSONObject;
+import javax.json.JsonException;
+import javax.json.JsonObject;
+
 import org.junit.runner.Description;
 
 /** Info about a remote tests, as provided by the Sling JUnit servlet */
@@ -33,12 +34,12 @@ class SlingRemoteTest {
     public static final String FAILURE = "failure";
     public static final String TRACE = "trace";
     
-    SlingRemoteTest(Class<?> testClass, JSONObject json) throws JSONException {
+    SlingRemoteTest(Class<?> testClass, JsonObject json) throws JsonException {
         this.testClass = testClass;
         description = json.getString(DESCRIPTION);
-        failure = json.has(FAILURE) ? json.getString(FAILURE) : null;
+        failure = json.containsKey(FAILURE) ? json.getString(FAILURE) : null;
         if (failure != null) {
-            trace = json.has(TRACE) ? json.getString(TRACE) : null;
+            trace = json.containsKey(TRACE) ? json.getString(TRACE) : null;
         } else {
             trace = null;
         }
index 7bdf4d8..9f6ccd0 100644 (file)
  */
 package org.apache.sling.junit.remote.testrunner;
 
+import java.io.StringReader;
 import java.util.LinkedList;
 import java.util.List;
 
-import org.apache.sling.commons.json.JSONArray;
-import org.apache.sling.commons.json.JSONObject;
-import org.apache.sling.commons.json.JSONTokener;
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonObject;
+
 import org.apache.sling.junit.remote.httpclient.RemoteTestHttpClient;
 import org.apache.sling.testing.tools.http.RequestCustomizer;
 import org.apache.sling.testing.tools.http.RequestExecutor;
@@ -111,13 +113,13 @@ public class SlingRemoteTestRunner extends ParentRunner<SlingRemoteTest> {
                 "json"
                 );
         executor.assertContentType("application/json");
-        final JSONArray json = new JSONArray(new JSONTokener((executor.getContent())));
+        final JsonArray json = Json.createReader(new StringReader(executor.getContent())).readArray();
 
         // Response contains an array of objects identified by 
         // their INFO_TYPE, extract the tests
         // based on this vlaue
-        for(int i = 0 ; i < json.length(); i++) {
-            final JSONObject obj = json.getJSONObject(i);
+        for(int i = 0 ; i < json.size(); i++) {
+            final JsonObject obj = json.getJsonObject(i);
             if("test".equals(obj.getString("INFO_TYPE"))) {
                 children.add(new SlingRemoteTest(testClass, obj));
             }