Author: cschneider
Date: Thu Jun 27 09:13:14 2013
New Revision: 1497257

URL: http://svn.apache.org/r1497257
Log:
DOSGI-195 Calling service in test and avoid using BusFactory.newInstance 
because of classpath problems

Modified:
    
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
    cxf/dosgi/trunk/systests2/multi-bundle/pom.xml
    
cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java

Modified: 
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
URL: 
http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java?rev=1497257&r1=1497256&r2=1497257&view=diff
==============================================================================
--- 
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
 (original)
+++ 
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
 Thu Jun 27 09:13:14 2013
@@ -24,7 +24,7 @@ import java.util.Hashtable;
 import java.util.Map;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.CXFBusFactory;
 import org.apache.cxf.dosgi.dsw.Constants;
 import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.transport.http.DestinationRegistry;
@@ -74,7 +74,7 @@ public class HttpServiceManager {
 
     public Bus registerServletAndGetBus(String contextRoot, BundleContext 
callingContext,
             ServiceReference sref) {
-        Bus bus = BusFactory.newInstance().createBus();
+        Bus bus = new CXFBusFactory().createBus();
         bus.setExtension(new DestinationRegistryImpl(), 
DestinationRegistry.class);
         CXFNonSpringServlet cxf = new CXFNonSpringServlet();
         cxf.setBus(bus);

Modified: cxf/dosgi/trunk/systests2/multi-bundle/pom.xml
URL: 
http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/multi-bundle/pom.xml?rev=1497257&r1=1497256&r2=1497257&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests2/multi-bundle/pom.xml (original)
+++ cxf/dosgi/trunk/systests2/multi-bundle/pom.xml Thu Jun 27 09:13:14 2013
@@ -120,6 +120,11 @@
             <version>${cxf.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.apache.zookeeper</groupId>
             <artifactId>zookeeper</artifactId>
             <version>${zookeeper.version}</version>

Modified: 
cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java
URL: 
http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java?rev=1497257&r1=1497256&r2=1497257&view=diff
==============================================================================
--- 
cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java
 (original)
+++ 
cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java
 Thu Jun 27 09:13:14 2013
@@ -20,6 +20,11 @@ package org.apache.cxf.dosgi.systests2.m
 
 import javax.inject.Inject;
 
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterInfo;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterService;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreetingPhrase;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Option;
@@ -55,5 +60,12 @@ public class TestExportRestService exten
     @Test
     public void testEndpointAvailable() throws Exception {
         waitPort(8080);
+        
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+        GreeterService greeterService = 
JAXRSClientFactory.create("http://localhost:8080/greeter";,
+                                                                  
GreeterService.class);
+        GreeterInfo result = greeterService.greetMe("Chris");
+        GreetingPhrase greeting = result.getGreetings().get(0);
+        Assert.assertEquals("Hello", greeting.getPhrase());
+        Assert.assertEquals("Chris", greeting.getName());
     }
 }


Reply via email to