You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2017/06/30 15:59:40 UTC

[2/4] aries-jax-rs-whiteboard git commit: [JAXRS] fix tests

[JAXRS] fix tests

Signed-off-by: Raymond Auge <ra...@liferay.com>


Project: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/repo
Commit: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/commit/9577e66a
Tree: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/tree/9577e66a
Diff: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/diff/9577e66a

Branch: refs/heads/master
Commit: 9577e66a4c536cee2d2649c77849012aabd97dc9
Parents: faf6b1f
Author: Raymond Auge <ra...@liferay.com>
Authored: Thu Jun 29 14:00:51 2017 -0400
Committer: Raymond Auge <ra...@liferay.com>
Committed: Thu Jun 29 14:00:51 2017 -0400

----------------------------------------------------------------------
 jax-rs.itests/bnd.bnd                           |  2 +
 jax-rs.itests/itest.bndrun                      | 26 +++++-------
 jax-rs.itests/pom.xml                           | 43 +++++++++++++-------
 jax-rs.itests/src/main/java/test/JaxrsTest.java | 29 +++++++++----
 4 files changed, 63 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/9577e66a/jax-rs.itests/bnd.bnd
----------------------------------------------------------------------
diff --git a/jax-rs.itests/bnd.bnd b/jax-rs.itests/bnd.bnd
index f601893..08f3ff5 100644
--- a/jax-rs.itests/bnd.bnd
+++ b/jax-rs.itests/bnd.bnd
@@ -3,3 +3,5 @@ Bundle-Description: Integration Test bundle for the JAX-RS extender
 Test-Cases: \
 	${classes;CONCRETE;EXTENDS;junit.framework.TestCase},\
 	${classes;CONCRETE;ANNOTATED;org.junit.Test}
+
+-contract: JavaJAXRS

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/9577e66a/jax-rs.itests/itest.bndrun
----------------------------------------------------------------------
diff --git a/jax-rs.itests/itest.bndrun b/jax-rs.itests/itest.bndrun
index b8cd6ef..b3fc4db 100644
--- a/jax-rs.itests/itest.bndrun
+++ b/jax-rs.itests/itest.bndrun
@@ -23,27 +23,23 @@
 	osgi.identity;filter:='(osgi.identity=osgi.cmpn)'
 -runbundles: \
 	javax.annotation-api;version='[1.2.0,1.2.1)',\
-	org.apache.aries.jax.rs.javax.ws.rs_2.0;version='[0.0.1,0.0.2)',\
+	javax.json-api;version='[1.0.0,1.0.1)',\
 	log4j;version='[1.2.17,1.2.18)',\
 	org.apache.aries.jax.rs.itests;version='[0.0.1,0.0.2)',\
-	org.apache.cxf.cxf-core;version='[3.1.10,3.1.11)',\
-	org.apache.cxf.cxf-rt-transports-http;version='[3.1.10,3.1.11)',\
-	org.apache.cxf.cxf-rt-frontend-jaxrs;version='[3.1.10,3.1.11)',\
-	org.apache.cxf.cxf-rt-rs-client;version='[3.1.10,3.1.11)',\
-	org.apache.ws.xmlschema.core;version='[2.2.1,2.2.2)',\
-	org.osgi.service.jaxrs;version='[1.0.0,2.0.0)',\
-	org.osgi.util.function;version='[1.1.0,2.0.0)',\
-	org.osgi.util.promise;version='[1.1.0,2.0.0)',\
-	osgi.enroute.hamcrest.wrapper;version='[1.3.0,1.3.1)',\
-	osgi.enroute.junit.wrapper;version='[4.12.0,4.12.1)',\
-	javax.json-api;version='[1.0.0,1.0.1)',\
+	org.apache.aries.jax.rs.jaxrs.api;version='[0.0.1,0.0.2)',\
 	org.apache.aries.jax.rs.whiteboard;version='[0.0.1,0.0.2)',\
+	org.apache.felix.configadmin;version='[1.8.14,1.8.15)',\
+	org.apache.felix.eventadmin;version='[1.4.8,1.4.9)',\
 	org.apache.felix.http.jetty;version='[3.4.0,3.4.1)',\
 	org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
+	org.apache.ws.xmlschema.core;version='[2.2.1,2.2.2)',\
 	org.objectweb.asm;version='[5.0.4,5.0.5)',\
+	org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',\
+	org.osgi.util.function;version='[1.1.0,1.1.1)',\
+	org.osgi.util.promise;version='[1.1.0,1.1.1)',\
+	osgi.enroute.hamcrest.wrapper;version='[1.3.0,1.3.1)',\
+	osgi.enroute.junit.wrapper;version='[4.12.0,4.12.1)',\
 	slf4j.api;version='[1.7.21,1.7.22)',\
-	slf4j.log4j12;version='[1.6.1,1.6.2)',\
-	org.apache.felix.eventadmin;version='[1.4.8,1.4.9)',\
-	org.osgi.service.cm;version='[1.5.0,1.5.1)'
+	slf4j.log4j12;version='[1.6.1,1.6.2)'
 
 #-runvm: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/9577e66a/jax-rs.itests/pom.xml
----------------------------------------------------------------------
diff --git a/jax-rs.itests/pom.xml b/jax-rs.itests/pom.xml
index 83817ed..0648798 100644
--- a/jax-rs.itests/pom.xml
+++ b/jax-rs.itests/pom.xml
@@ -91,13 +91,18 @@
             <version>6.0.0</version>
         </dependency>
         <dependency>
+            <groupId>javax.annotation</groupId>
+            <artifactId>javax.annotation-api</artifactId>
+            <version>1.2</version>
+        </dependency>
+        <dependency>
             <groupId>javax.json</groupId>
             <artifactId>javax.json-api</artifactId>
             <version>1.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.jax.rs</groupId>
-            <artifactId>org.apache.aries.jax.rs.log4j-configuration</artifactId>
+            <artifactId>org.apache.aries.jax.rs.jaxrs.api</artifactId>
             <version>0.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
@@ -106,9 +111,9 @@
             <version>0.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-rs-client</artifactId>
-            <version>${cxf.version}</version>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.configadmin</artifactId>
+            <version>1.8.14</version>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>
@@ -126,18 +131,33 @@
             <version>1.1.2</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr</artifactId>
+            <version>2.0.8</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ws.xmlschema</groupId>
+            <artifactId>xmlschema-core</artifactId>
+            <version>2.2.1</version>
+        </dependency>
+        <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.eclipse.osgi</artifactId>
             <version>3.10.100.v20150529-1857</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.util.promise</artifactId>
+            <artifactId>org.osgi.util.function</artifactId>
             <version>LATEST</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.util.function</artifactId>
+            <artifactId>org.osgi.service.jaxrs</artifactId>
+            <version>LATEST</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.util.promise</artifactId>
             <version>LATEST</version>
         </dependency>
         <dependency>
@@ -151,14 +171,9 @@
             <version>1.3.0</version>
         </dependency>
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.service.jaxrs</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.aries.jax.rs</groupId>
-            <artifactId>javax.ws.rs_2.0</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
+            <groupId>org.ow2.asm</groupId>
+            <artifactId>asm</artifactId>
+            <version>5.0.4</version>
         </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/9577e66a/jax-rs.itests/src/main/java/test/JaxrsTest.java
----------------------------------------------------------------------
diff --git a/jax-rs.itests/src/main/java/test/JaxrsTest.java b/jax-rs.itests/src/main/java/test/JaxrsTest.java
index 5fd2b3d..1c6e8e7 100644
--- a/jax-rs.itests/src/main/java/test/JaxrsTest.java
+++ b/jax-rs.itests/src/main/java/test/JaxrsTest.java
@@ -23,6 +23,8 @@ import static org.osgi.service.jaxrs.whiteboard.JaxRSWhiteboardConstants.*;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -52,6 +54,20 @@ import static org.junit.Assert.assertNull;
 
 public class JaxrsTest {
 
+    private ServiceTracker<ClientBuilder, ClientBuilder> _clientBuilderTracker;
+
+    @After
+    public void after() {
+        _clientBuilderTracker.close();
+    }
+
+    @Before
+    public void before() {
+        _clientBuilderTracker = new ServiceTracker<>(bundleContext, ClientBuilder.class, null);
+
+        _clientBuilderTracker.open();
+    }
+
     @Test
     public void testApplication() {
         ServiceRegistration<?> serviceRegistration = null;
@@ -677,18 +693,15 @@ public class JaxrsTest {
     }
 
     private Client createClient() {
-        Thread thread = Thread.currentThread();
-
-        ClassLoader contextClassLoader = thread.getContextClassLoader();
+        ClientBuilder clientBuilder;
 
         try {
-            thread.setContextClassLoader(
-                org.apache.cxf.jaxrs.client.Client.class.getClassLoader());
+            clientBuilder = _clientBuilderTracker.waitForService(5000);
 
-            return ClientBuilder.newClient();
+            return clientBuilder.build();
         }
-        finally {
-            thread.setContextClassLoader(contextClassLoader);
+        catch (InterruptedException ie) {
+            throw new RuntimeException(ie);
         }
     }