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 20:45:58 UTC

svn commit: r1797264 - in /sling/trunk/contrib/crankstart/launcher: pom.xml src/test/java/org/apache/sling/crankstart/launcher/BasicLauncherIT.java src/test/java/org/apache/sling/crankstart/launcher/U.java src/test/resources/provisioning-model/base.txt

Author: pauls
Date: Thu Jun  1 20:45:58 2017
New Revision: 1797264

URL: http://svn.apache.org/viewvc?rev=1797264&view=rev
Log:
SLING-6910: Remove commons.json from crankstart

Modified:
    sling/trunk/contrib/crankstart/launcher/pom.xml
    sling/trunk/contrib/crankstart/launcher/src/test/java/org/apache/sling/crankstart/launcher/BasicLauncherIT.java
    sling/trunk/contrib/crankstart/launcher/src/test/java/org/apache/sling/crankstart/launcher/U.java
    sling/trunk/contrib/crankstart/launcher/src/test/resources/provisioning-model/base.txt

Modified: sling/trunk/contrib/crankstart/launcher/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/crankstart/launcher/pom.xml?rev=1797264&r1=1797263&r2=1797264&view=diff
==============================================================================
--- sling/trunk/contrib/crankstart/launcher/pom.xml (original)
+++ sling/trunk/contrib/crankstart/launcher/pom.xml Thu Jun  1 20:45:58 2017
@@ -187,13 +187,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.tools</artifactId>
-            <version>1.0.10</version>
-            <scope>test</scope>
-        </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>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -208,5 +202,11 @@
             <version>2.4</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+          <groupId>org.apache.johnzon</groupId>
+          <artifactId>johnzon-core</artifactId>
+          <version>1.0.0</version>
+          <scope>test</scope>
+        </dependency>
       </dependencies>
 </project>

Modified: sling/trunk/contrib/crankstart/launcher/src/test/java/org/apache/sling/crankstart/launcher/BasicLauncherIT.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/crankstart/launcher/src/test/java/org/apache/sling/crankstart/launcher/BasicLauncherIT.java?rev=1797264&r1=1797263&r2=1797264&view=diff
==============================================================================
--- sling/trunk/contrib/crankstart/launcher/src/test/java/org/apache/sling/crankstart/launcher/BasicLauncherIT.java (original)
+++ sling/trunk/contrib/crankstart/launcher/src/test/java/org/apache/sling/crankstart/launcher/BasicLauncherIT.java Thu Jun  1 20:45:58 2017
@@ -7,12 +7,13 @@ import static org.junit.Assert.fail;
 import java.io.IOException;
 import java.util.UUID;
 
+import javax.json.JsonArray;
+import javax.json.JsonObject;
+
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.sling.commons.json.JSONArray;
-import org.apache.sling.commons.json.JSONObject;
 import org.apache.sling.commons.testing.junit.Retry;
 import org.apache.sling.commons.testing.junit.RetryRule;
 import org.apache.sling.crankstart.junit.CrankstartSetup;
@@ -162,16 +163,16 @@ public class BasicLauncherIT {
                 osgiConsole.getBundleState(symbolicName));
         
         // Start level is in the props array, with key="Start Level"
-        final JSONObject status = U.getBundleData(C, client, symbolicName);
-        final JSONArray props = status.getJSONArray("data").getJSONObject(0).getJSONArray("props");
+        final JsonObject status = U.getBundleData(C, client, symbolicName);
+        final JsonArray props = status.getJsonArray("data").getJsonObject(0).getJsonArray("props");
         final String KEY = "key";
         final String SL = "Start Level";
         boolean found = false;
-        for(int i=0; i < props.length(); i++) {
-            final JSONObject o = props.getJSONObject(i);
-            if(o.has(KEY) && SL.equals(o.getString(KEY))) {
+        for(int i=0; i < props.size(); i++) {
+            final JsonObject o = props.getJsonObject(i);
+            if(o.containsKey(KEY) && SL.equals(o.getString(KEY))) {
                 found = true;
-                assertEquals("Expecting the start level that's set in provisioning model", "99", o.getString("value"));
+                assertEquals("Expecting the start level that's set in provisioning model", 99, o.getInt("value"));
             }
         }
         assertTrue("Expecting start level to be found in JSON output", found);

Modified: sling/trunk/contrib/crankstart/launcher/src/test/java/org/apache/sling/crankstart/launcher/U.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/crankstart/launcher/src/test/java/org/apache/sling/crankstart/launcher/U.java?rev=1797264&r1=1797263&r2=1797264&view=diff
==============================================================================
--- sling/trunk/contrib/crankstart/launcher/src/test/java/org/apache/sling/crankstart/launcher/U.java (original)
+++ sling/trunk/contrib/crankstart/launcher/src/test/java/org/apache/sling/crankstart/launcher/U.java Thu Jun  1 20:45:58 2017
@@ -4,6 +4,11 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertNotNull;
 
 import java.io.IOException;
+import java.io.StringReader;
+
+import javax.json.Json;
+import javax.json.JsonException;
+import javax.json.JsonObject;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpEntity;
@@ -15,8 +20,6 @@ import org.apache.http.client.methods.Ht
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.util.EntityUtils;
-import org.apache.sling.commons.json.JSONException;
-import org.apache.sling.commons.json.JSONObject;
 import org.apache.sling.crankstart.junit.CrankstartSetup;
 import org.apache.sling.testing.tools.http.RequestBuilder;
 import org.apache.sling.testing.tools.http.RequestExecutor;
@@ -52,15 +55,14 @@ public class U {
     }
 
     /** Get JSON bundle data from webconsole */ 
-    static JSONObject getBundleData(CrankstartSetup C, DefaultHttpClient client, String symbolicName) 
-            throws ClientProtocolException, IOException, JSONException {
+    static JsonObject getBundleData(CrankstartSetup C, DefaultHttpClient client, String symbolicName) 
+            throws ClientProtocolException, IOException, JsonException {
         final RequestBuilder b = new RequestBuilder(C.getBaseUrl());
         final RequestExecutor e = new RequestExecutor(client);
-        return new JSONObject(e.execute(
+        return Json.createReader(new StringReader((e.execute(
                 b.buildGetRequest("/system/console/bundles/" + symbolicName + ".json")
-                .withCredentials(U.ADMIN, U.ADMIN)
-        ).assertStatus(200)
-        .getContent());
+                .withCredentials(U.ADMIN, U.ADMIN))
+            ).assertStatus(200).getContent())).readObject();
     }
     
     public static String getContent(HttpResponse response) throws IOException{

Modified: sling/trunk/contrib/crankstart/launcher/src/test/resources/provisioning-model/base.txt
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/crankstart/launcher/src/test/resources/provisioning-model/base.txt?rev=1797264&r1=1797263&r2=1797264&view=diff
==============================================================================
--- sling/trunk/contrib/crankstart/launcher/src/test/resources/provisioning-model/base.txt (original)
+++ sling/trunk/contrib/crankstart/launcher/src/test/resources/provisioning-model/base.txt Thu Jun  1 20:45:58 2017
@@ -36,4 +36,5 @@
   org.apache.sling/org.apache.sling.commons.osgi/2.2.0
   org.apache.sling/org.apache.sling.commons.log/2.1.2
   org.apache.felix/org.apache.felix.configadmin/1.6.0
-  org.apache.felix/org.apache.felix.webconsole/3.1.6
\ No newline at end of file
+  org.apache.felix/org.apache.felix.webconsole/4.3.4
+  commons-fileupload/commons-fileupload/1.3.2