sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject svn commit: r1797390 - in /sling/trunk/contrib/launchpad/testing: pom.xml src/main/provisioning/model.txt src/test/java/org/apache/sling/launchpad/webapp/integrationtest/groovy/JSONGroovyBuilderTest.java
Date Fri, 02 Jun 2017 13:47:24 GMT
Author: pauls
Date: Fri Jun  2 13:47:24 2017
New Revision: 1797390

URL: http://svn.apache.org/viewvc?rev=1797390&view=rev
Log:
SLING-6929: Remove commons.json from ./contrib/launchpad/testing

Modified:
    sling/trunk/contrib/launchpad/testing/pom.xml
    sling/trunk/contrib/launchpad/testing/src/main/provisioning/model.txt
    sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/groovy/JSONGroovyBuilderTest.java

Modified: sling/trunk/contrib/launchpad/testing/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/testing/pom.xml?rev=1797390&r1=1797389&r2=1797390&view=diff
==============================================================================
--- sling/trunk/contrib/launchpad/testing/pom.xml (original)
+++ sling/trunk/contrib/launchpad/testing/pom.xml Fri Jun  2 13:47:24 2017
@@ -173,6 +173,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.johnzon</artifactId>
+            <version>1.0.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.launchpad.integration-tests</artifactId>
             <version>1.0.1-SNAPSHOT</version>
             <scope>test</scope>

Modified: sling/trunk/contrib/launchpad/testing/src/main/provisioning/model.txt
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/testing/src/main/provisioning/model.txt?rev=1797390&r1=1797389&r2=1797390&view=diff
==============================================================================
--- sling/trunk/contrib/launchpad/testing/src/main/provisioning/model.txt (original)
+++ sling/trunk/contrib/launchpad/testing/src/main/provisioning/model.txt Fri Jun  2 13:47:24
2017
@@ -21,6 +21,7 @@
 [artifacts]
   org.apache.sling/org.apache.sling.launchpad/8/slingstart
   org.apache.sling/org.apache.sling.launchpad.test-bundles/0.0.1-SNAPSHOT/slingfeature
+  org.apache.sling/org.apache.sling.commons.johnzon/1.0.0
 
 # SLING-2760 Do not include auth/selector in contrib build to avoid missing artifact dependency
on http://dyuproject.googlecode.com/svn/repos/maven2
 # Auth 

Modified: sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/groovy/JSONGroovyBuilderTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/groovy/JSONGroovyBuilderTest.java?rev=1797390&r1=1797389&r2=1797390&view=diff
==============================================================================
--- sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/groovy/JSONGroovyBuilderTest.java
(original)
+++ sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/groovy/JSONGroovyBuilderTest.java
Fri Jun  2 13:47:24 2017
@@ -17,12 +17,15 @@
 package org.apache.sling.launchpad.webapp.integrationtest.groovy;
 
 import java.io.IOException;
+import java.io.StringReader;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.sling.commons.json.JSONArray;
-import org.apache.sling.commons.json.JSONException;
-import org.apache.sling.commons.json.JSONObject;
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonException;
+import javax.json.JsonObject;
+
 import org.apache.sling.launchpad.webapp.integrationtest.RenderingTestBase;
 import org.apache.sling.servlets.post.SlingPostConstants;
 import org.slf4j.Logger;
@@ -56,40 +59,40 @@ public class JSONGroovyBuilderTest exten
         testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
     }
 
-    public void testObject() throws IOException, JSONException {
+    public void testObject() throws IOException, JsonException {
         final String toDelete = uploadTestScript("builder_object.groovy","json.groovy");
         try {
             final String content = getContent(displayUrl + ".json", CONTENT_TYPE_JSON);
-            JSONObject jo = new JSONObject(content);
-            assertEquals("Content contained wrong number of items", 1, jo.length());
-            assertEquals("Content contained wrong key", "text", jo.keys().next());
-            assertEquals("Content contained wrong data", testText, jo.get("text"));
+            JsonObject jo = Json.createReader(new StringReader(content)).readObject();
+            assertEquals("Content contained wrong number of items", 1, jo.size());
+            assertEquals("Content contained wrong key", "text", jo.keySet().iterator().next());
+            assertEquals("Content contained wrong data", testText, jo.getString("text"));
         } finally {
             testClient.delete(toDelete);
         }
     }
     
-    public void testRichObject() throws IOException, JSONException {
+    public void testRichObject() throws IOException, JsonException {
         final String toDelete = uploadTestScript("builder_rich_object.groovy","json.groovy");
         try {
             final String content = getContent(displayUrl + ".json", CONTENT_TYPE_JSON);
             log.debug("{} content: {}", displayUrl, content);
-            JSONObject jo = new JSONObject(content);
-            assertEquals("Content contained wrong number of items", 2, jo.length());
-            assertEquals("Content contained wrong data", testText, jo.get("text"));
-            assertEquals("Content contained wrong data", "bar", ((JSONObject) jo.get("obj")).get("foo"));
+            JsonObject jo = Json.createReader(new StringReader(content)).readObject();
+            assertEquals("Content contained wrong number of items", 2, jo.size());
+            assertEquals("Content contained wrong data", testText, jo.getString("text"));
+            assertEquals("Content contained wrong data", "bar", ((JsonObject) jo.getJsonObject("obj")).getString("foo"));
         } finally {
             testClient.delete(toDelete);
         }
     }
 
-    public void testArray() throws IOException, JSONException {
+    public void testArray() throws IOException, JsonException {
         final String toDelete = uploadTestScript("builder_array.groovy","json.groovy");
         try {
             final String content = getContent(displayUrl + ".json", CONTENT_TYPE_JSON);
-            JSONArray jo = new JSONArray(content);
-            assertEquals("Content contained wrong number of items", 1, jo.length());
-            assertEquals("Content contained wrong data", testText, jo.get(0));
+            JsonArray jo = Json.createReader(new StringReader(content)).readArray();
+            assertEquals("Content contained wrong number of items", 1, jo.size());
+            assertEquals("Content contained wrong data", testText, jo.getString(0));
         } finally {
             testClient.delete(toDelete);
         }



Mime
View raw message