You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2017/01/18 14:04:23 UTC

svn commit: r1779328 - in /felix/trunk/http/itest: pom.xml src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java src/test/java/org/apache/felix/http/itest/SessionHandlingTest.java

Author: cziegeler
Date: Wed Jan 18 14:04:23 2017
New Revision: 1779328

URL: http://svn.apache.org/viewvc?rev=1779328&view=rev
Log:
Remove dependency to json.org

Modified:
    felix/trunk/http/itest/pom.xml
    felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
    felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/SessionHandlingTest.java

Modified: felix/trunk/http/itest/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/pom.xml?rev=1779328&r1=1779327&r2=1779328&view=diff
==============================================================================
--- felix/trunk/http/itest/pom.xml (original)
+++ felix/trunk/http/itest/pom.xml Wed Jan 18 14:04:23 2017
@@ -74,10 +74,16 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>com.googlecode.json-simple</groupId>
-            <artifactId>json-simple</artifactId>
-            <version>1.1.1</version>
-			<scope>provided</scope>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-json_1.0_spec</artifactId>
+            <version>1.0-alpha-1</version>
+            <scope>provided</scope> 
+        </dependency>
+        <dependency>
+            <groupId>org.apache.johnzon</groupId>
+            <artifactId>johnzon-core</artifactId>
+            <version>1.0.0</version>
+            <scope>provided</scope>
         </dependency>
 		<dependency>
 			<groupId>org.apache.felix</groupId>
@@ -129,7 +135,7 @@
 		<dependency>
 			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.framework</artifactId>
-			<version>5.2.0</version>
+			<version>5.6.1</version>
 			<scope>test</scope>
 		</dependency>
 	</dependencies>

Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java?rev=1779328&r1=1779327&r2=1779328&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java Wed Jan 18 14:04:23 2017
@@ -310,31 +310,33 @@ public abstract class BaseIntegrationTes
         final String localRepo = System.getProperty("maven.repo.local", "");
 
         return options(
-            when( localRepo.length() > 0 ).useOptions(
-                    systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo)
-            ),
-//            CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"),
-
-            mavenBundle("org.slf4j", "slf4j-api", "1.7.5"),
-            mavenBundle("org.slf4j", "jcl-over-slf4j", "1.7.5"),
-            mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.5"),
-
-            mavenBundle("org.apache.sling", "org.apache.sling.commons.log", "4.0.0"),
-            mavenBundle("org.apache.sling", "org.apache.sling.commons.logservice", "1.0.2"),
-
-            mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api", System.getProperty("http.servlet.api.version")).startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("org.apache.felix", ORG_APACHE_FELIX_HTTP_JETTY, System.getProperty("http.jetty.version")).startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("org.apache.felix", "org.apache.felix.http.whiteboard", "3.0.0").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("org.apache.felix", "org.apache.felix.configadmin").version("1.8.8"),
-
-            mavenBundle("org.apache.httpcomponents", "httpcore-osgi", "4.3.2").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("org.apache.httpcomponents", "httpclient-osgi", "4.3.4").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("org.mockito", "mockito-all", "1.10.19").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("org.objenesis", "objenesis", "2.1").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("com.googlecode.json-simple", "json-simple", "1.1.1").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+                when( localRepo.length() > 0 ).useOptions(
+                        systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo)
+                        ),
+                //            CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"),
+
+                mavenBundle("org.slf4j", "slf4j-api", "1.7.5"),
+                mavenBundle("org.slf4j", "jcl-over-slf4j", "1.7.5"),
+                mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.5"),
+
+                mavenBundle("org.apache.sling", "org.apache.sling.commons.log", "4.0.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.commons.logservice", "1.0.2"),
+
+                mavenBundle("org.apache.geronimo.specs", "geronimo-json_1.0_spec", "1.0-alpha-1").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+                mavenBundle("org.apache.johnzon", "johnzon-core", "1.0.0").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+
+                mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api", System.getProperty("http.servlet.api.version")).startLevel(START_LEVEL_SYSTEM_BUNDLES),
+                mavenBundle("org.apache.felix", ORG_APACHE_FELIX_HTTP_JETTY, System.getProperty("http.jetty.version")).startLevel(START_LEVEL_SYSTEM_BUNDLES),
+                mavenBundle("org.apache.felix", "org.apache.felix.http.whiteboard", "3.0.0").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+                mavenBundle("org.apache.felix", "org.apache.felix.configadmin").version("1.8.8"),
+
+                mavenBundle("org.apache.httpcomponents", "httpcore-osgi", "4.3.2").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+                mavenBundle("org.apache.httpcomponents", "httpclient-osgi", "4.3.4").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+                mavenBundle("org.mockito", "mockito-all", "1.10.19").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+                mavenBundle("org.objenesis", "objenesis", "2.1").startLevel(START_LEVEL_SYSTEM_BUNDLES),
 
-            junitBundles(),
-            frameworkStartLevel(START_LEVEL_TEST_BUNDLE));
+                junitBundles(),
+                frameworkStartLevel(START_LEVEL_TEST_BUNDLE));
     }
 
     private final Map<String, ServiceTracker<?, ?>> trackers = new HashMap<String, ServiceTracker<?, ?>>();

Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/SessionHandlingTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/SessionHandlingTest.java?rev=1779328&r1=1779327&r2=1779328&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/SessionHandlingTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/SessionHandlingTest.java Wed Jan 18 14:04:23 2017
@@ -32,6 +32,7 @@ import static org.osgi.service.http.whit
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.Hashtable;
@@ -39,6 +40,7 @@ import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
+import javax.json.JsonObject;
 import javax.servlet.Servlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -53,9 +55,7 @@ import org.apache.http.impl.client.Basic
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONValue;
-import org.json.simple.parser.ParseException;
+import org.apache.johnzon.core.JsonProviderImpl;
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -97,7 +97,7 @@ public class SessionHandlingTest extends
 
             @Override
             protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-                throws IOException
+                    throws IOException
             {
                 final boolean create = req.getParameter("create") != null;
                 if ( create )
@@ -161,7 +161,7 @@ public class SessionHandlingTest extends
         Thread.sleep(500);
     }
 
-    private JSONObject getJSONResponse(final CloseableHttpClient client, final String path) throws IOException, ParseException
+    private JsonObject getJSONResponse(final CloseableHttpClient client, final String path) throws IOException
     {
         final HttpGet httpGet = new HttpGet(createURL(path).toExternalForm().toString());
         CloseableHttpResponse response1 = client.execute(httpGet);
@@ -170,7 +170,7 @@ public class SessionHandlingTest extends
             HttpEntity entity1 = response1.getEntity();
             final String content = EntityUtils.toString(entity1);
 
-            return (JSONObject) JSONValue.parseWithException(content);
+            return new JsonProviderImpl().createReader(new StringReader(content)).readObject();
         } finally {
             response1.close();
         }
@@ -196,55 +196,55 @@ public class SessionHandlingTest extends
                 .setDefaultCookieStore(new BasicCookieStore())
                 .build();
 
-        JSONObject json;
+        JsonObject json;
 
         // session should not be available
         // check for foo servlet
         json = getJSONResponse(httpclient, "/foo");
-        assertFalse(((Boolean)json.get("session")).booleanValue());
+        assertFalse(json.getBoolean("session"));
 
         // check for bar servlet
         json = getJSONResponse(httpclient, "/bar");
-        assertFalse(((Boolean)json.get("session")).booleanValue());
+        assertFalse(json.getBoolean("session"));
 
         // create session for  context of servlet foo
         // check session and session attribute
         json = getJSONResponse(httpclient, "/foo?create=true");
-        assertTrue(((Boolean)json.get("session")).booleanValue());
-        assertEquals("test1", json.get("value"));
-        final String sessionId1 = (String)json.get("sessionId");
+        assertTrue(json.getBoolean("session"));
+        assertEquals("test1", json.getString("value"));
+        final String sessionId1 = json.getString("sessionId");
         assertNotNull(sessionId1);
 
         // check session for servlet bar (= no session)
         json = getJSONResponse(httpclient, "/bar");
-        assertFalse(((Boolean)json.get("session")).booleanValue());
+        assertFalse(json.getBoolean("session"));
         // another request to servlet foo, still the same
         json = getJSONResponse(httpclient, "/foo");
-        assertTrue(((Boolean)json.get("session")).booleanValue());
-        assertEquals("test1", json.get("value"));
-        assertEquals(sessionId1, json.get("sessionId"));
+        assertTrue(json.getBoolean("session"));
+        assertEquals("test1", json.getString("value"));
+        assertEquals(sessionId1, json.getString("sessionId"));
 
         // create session for second context
         json = getJSONResponse(httpclient, "/bar?create=true");
-        assertTrue(((Boolean)json.get("session")).booleanValue());
-        assertEquals("test2", json.get("value"));
-        final String sessionId2 = (String)json.get("sessionId");
+        assertTrue(json.getBoolean("session"));
+        assertEquals("test2", json.getString("value"));
+        final String sessionId2 = json.getString("sessionId");
         assertNotNull(sessionId2);
         assertFalse(sessionId1.equals(sessionId2));
 
         // and context foo is untouched
         json = getJSONResponse(httpclient, "/foo");
-        assertTrue(((Boolean)json.get("session")).booleanValue());
-        assertEquals("test1", json.get("value"));
-        assertEquals(sessionId1, json.get("sessionId"));
+        assertTrue(json.getBoolean("session"));
+        assertEquals("test1", json.getString("value"));
+        assertEquals(sessionId1, json.getString("sessionId"));
 
         // invalidate session for foo context
         json = getJSONResponse(httpclient, "/foo?destroy=true");
-        assertFalse(((Boolean)json.get("session")).booleanValue());
+        assertFalse(json.getBoolean("session"));
         // bar should be untouched
         json = getJSONResponse(httpclient, "/bar");
-        assertTrue(((Boolean)json.get("session")).booleanValue());
-        assertEquals("test2", json.get("value"));
-        assertEquals(sessionId2, json.get("sessionId"));
+        assertTrue(json.getBoolean("session"));
+        assertEquals("test2", json.getString("value"));
+        assertEquals(sessionId2, json.getString("sessionId"));
     }
 }