You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2017/06/01 12:44:19 UTC

svn commit: r1797216 - in /sling/trunk/testing/junit/remote: ./ src/main/java/org/apache/sling/junit/remote/exported/ src/main/java/org/apache/sling/junit/remote/testrunner/

Author: pauls
Date: Thu Jun  1 12:44:19 2017
New Revision: 1797216

URL: http://svn.apache.org/viewvc?rev=1797216&view=rev
Log:
SLING-6906: Remove commons.json from testing junit remote.

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

Modified: sling/trunk/testing/junit/remote/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/remote/pom.xml?rev=1797216&r1=1797215&r2=1797216&view=diff
==============================================================================
--- sling/trunk/testing/junit/remote/pom.xml (original)
+++ sling/trunk/testing/junit/remote/pom.xml Thu Jun  1 12:44:19 2017
@@ -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>
@@ -104,12 +104,7 @@
         <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>

Modified: sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/exported/ExampleRemoteTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/exported/ExampleRemoteTest.java?rev=1797216&r1=1797215&r2=1797216&view=diff
==============================================================================
--- sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/exported/ExampleRemoteTest.java (original)
+++ sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/exported/ExampleRemoteTest.java Thu Jun  1 12:44:19 2017
@@ -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;

Modified: sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/RemoteExecutionException.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/RemoteExecutionException.java?rev=1797216&r1=1797215&r2=1797216&view=diff
==============================================================================
--- sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/RemoteExecutionException.java (original)
+++ sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/RemoteExecutionException.java Thu Jun  1 12:44:19 2017
@@ -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;

Modified: sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTest.java?rev=1797216&r1=1797215&r2=1797216&view=diff
==============================================================================
--- sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTest.java (original)
+++ sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTest.java Thu Jun  1 12:44:19 2017
@@ -18,8 +18,9 @@ package org.apache.sling.junit.remote.te
 
 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;
         }

Modified: sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestRunner.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestRunner.java?rev=1797216&r1=1797215&r2=1797216&view=diff
==============================================================================
--- sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestRunner.java (original)
+++ sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestRunner.java Thu Jun  1 12:44:19 2017
@@ -16,12 +16,14 @@
  */
 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 exten
                 "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));
             }