camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1429471 - in /camel/trunk/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport: JaxWSCamelConduitTest.java JaxWSCamelTestSupport.java
Date Sun, 06 Jan 2013 06:44:23 GMT
Author: ningjiang
Date: Sun Jan  6 06:44:23 2013
New Revision: 1429471

URL: http://svn.apache.org/viewvc?rev=1429471&view=rev
Log:
Add more test code on the JaxWSCamelConduitTest

Modified:
    camel/trunk/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java
    camel/trunk/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelTestSupport.java

Modified: camel/trunk/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java?rev=1429471&r1=1429470&r2=1429471&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java
(original)
+++ camel/trunk/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java
Sun Jan  6 06:44:23 2013
@@ -27,7 +27,6 @@ import static org.hamcrest.CoreMatchers.
  */
 public class JaxWSCamelConduitTest extends JaxWSCamelTestSupport {
     
-
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
 
@@ -53,6 +52,7 @@ public class JaxWSCamelConduitTest exten
     @Test
     public void testStart1() {
         assertThat(getSampleWS("direct:start1").getSomething(), is("Something"));
+        
     }
 
     /**
@@ -60,7 +60,7 @@ public class JaxWSCamelConduitTest exten
      */
     @Test
     public void testStart2() {
-        assertThat(getSampleWS("direct:start2").getSomething(), is("Something"));
+        assertThat(getSampleWSWithCXFAPI("direct:start2").getSomething(), is("Something"));
     }
     
     // test the content type

Modified: camel/trunk/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelTestSupport.java?rev=1429471&r1=1429470&r2=1429471&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelTestSupport.java
(original)
+++ camel/trunk/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelTestSupport.java
Sun Jan  6 06:44:23 2013
@@ -24,10 +24,16 @@ import javax.xml.ws.Endpoint;
 import javax.xml.ws.Service;
 
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
+import org.apache.cxf.jaxws.JaxWsClientFactoryBean;
+import org.apache.cxf.jaxws.JaxWsClientProxy;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.junit.Before;
 
 public class JaxWSCamelTestSupport extends CamelTestSupport {
+    
     /**
      * Expected SOAP answer for the 'SampleWS.getSomething' method
      */
@@ -39,6 +45,8 @@ public class JaxWSCamelTestSupport exten
     public static final String REQUEST = "<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'>"
         + "<Body>" + "<getSomething xmlns='urn:test'/>"
         + "</Body>" + "</Envelope>";
+    
+    private Bus bus;
 
     /**
      * Sample WebService
@@ -65,7 +73,9 @@ public class JaxWSCamelTestSupport exten
      */
     @Before
     public void setUpCXFCamelContext() {
-        BusFactory.getThreadDefaultBus().getExtension(CamelTransportFactory.class).setCamelContext(context);
+        bus = BusFactory.getThreadDefaultBus();
+        // make sure the CamelTransportFactory is injected with right camel context
+        bus.getExtension(CamelTransportFactory.class).setCamelContext(context);
     }
 
     /**
@@ -84,6 +94,14 @@ public class JaxWSCamelTestSupport exten
         return s.getPort(SampleWS.class);
     }
     
+    public SampleWS getSampleWSWithCXFAPI(String camelEndpoint) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setAddress("camel://" + camelEndpoint);
+        factory.setServiceClass(SampleWS.class);
+        factory.setBus(bus);
+        return factory.create(SampleWS.class);
+    }
+    
     /**
      * Create a SampleWS Server to a specified route
      * @param camelEndpoint



Mime
View raw message