SLING-6910: Remove commons.json from crankstart
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1797264 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index f44af6d..ba2e68d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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>
diff --git a/src/test/java/org/apache/sling/crankstart/launcher/BasicLauncherIT.java b/src/test/java/org/apache/sling/crankstart/launcher/BasicLauncherIT.java
index b619472..a5a1cea 100644
--- a/src/test/java/org/apache/sling/crankstart/launcher/BasicLauncherIT.java
+++ b/src/test/java/org/apache/sling/crankstart/launcher/BasicLauncherIT.java
@@ -7,12 +7,13 @@
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 @@
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);
diff --git a/src/test/java/org/apache/sling/crankstart/launcher/U.java b/src/test/java/org/apache/sling/crankstart/launcher/U.java
index f13dfc7..9fa6666 100644
--- a/src/test/java/org/apache/sling/crankstart/launcher/U.java
+++ b/src/test/java/org/apache/sling/crankstart/launcher/U.java
@@ -4,6 +4,11 @@
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.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 @@
}
/** 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{
diff --git a/src/test/resources/provisioning-model/base.txt b/src/test/resources/provisioning-model/base.txt
index 16a4b23..8a53fad 100644
--- a/src/test/resources/provisioning-model/base.txt
+++ b/src/test/resources/provisioning-model/base.txt
@@ -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