You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/05/26 05:56:33 UTC

[2/2] git commit: Fixed the test error of camel-example-cxf with CXF 3.0.0

Fixed the test error of camel-example-cxf with CXF 3.0.0


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d8df3b79
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d8df3b79
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d8df3b79

Branch: refs/heads/master
Commit: d8df3b7969394841cf1fd3f6654ed964a5ef8778
Parents: efcff6e
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri May 23 21:34:30 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon May 26 11:55:47 2014 +0800

----------------------------------------------------------------------
 .../example/cxf/httptojms/CamelCxfExample.java  | 21 ++++++++++++++------
 .../camel/example/cxf/httptojms/Server.java     |  4 +++-
 .../META-INF/spring/HttpToJmsCamelContext.xml   |  2 +-
 .../src/main/resources/wsdl/hello_world.wsdl    |  8 +-------
 4 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d8df3b79/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/CamelCxfExample.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/CamelCxfExample.java b/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/CamelCxfExample.java
index 44cacc5..712ee86 100644
--- a/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/CamelCxfExample.java
+++ b/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/CamelCxfExample.java
@@ -18,9 +18,12 @@ package org.apache.camel.example.cxf.httptojms;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.CxfComponent;
+import org.apache.camel.component.cxf.CxfEndpoint;
 import org.apache.camel.component.properties.PropertiesComponent;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.test.AvailablePortFinder;
+import org.apache.hello_world_soap_http.Greeter;
 
 /**
  * An example for demonstrating how Camel works as a Router.
@@ -29,7 +32,9 @@ import org.apache.camel.test.AvailablePortFinder;
  */
 public final class CamelCxfExample {
     private static final String ROUTER_ADDRESS = "http://localhost:{{routerPort}}/SoapContext/SoapPort";
-    private static final String SERVICE_ADDRESS = "http://localhost:{{servicePort}}/SoapContext/SoapPort";
+    private static final String SERVICE_ADDRESS = "jms:jndi:dynamicQueues/test.soap.jmstransport.queue?jndiInitialContextFactory="
+            + "org.apache.activemq.jndi.ActiveMQInitialContextFactory&jndiConnectionFactoryName="
+            + "ConnectionFactory&jndiURL=vm://localhost";
     private static final String SERVICE_CLASS = "serviceClass=org.apache.hello_world_soap_http.Greeter";
     private static final String WSDL_LOCATION = "wsdlURL=wsdl/hello_world.wsdl";
     private static final String SERVICE_NAME = "serviceName={http://apache.org/hello_world_soap_http}SOAPService";
@@ -38,9 +43,7 @@ public final class CamelCxfExample {
 
     private static final String ROUTER_ENDPOINT_URI = "cxf://" + ROUTER_ADDRESS + "?" + SERVICE_CLASS + "&"
                                                    + WSDL_LOCATION + "&" + SERVICE_NAME + "&" + SOAP_OVER_HTTP_ROUTER + "&dataFormat=POJO";
-    private static final String SERVICE_ENDPOINT_URI = "cxf://" + SERVICE_ADDRESS + "?" + SERVICE_CLASS + "&"
-                                                   + WSDL_LOCATION + "&" + SERVICE_NAME + "&" + SOAP_OVER_JMS + "&dataFormat=POJO";
-
+   
     private CamelCxfExample() {
     }
     
@@ -51,10 +54,13 @@ public final class CamelCxfExample {
             // Set system properties for use with Camel property placeholders for running the example tests.
             System.setProperty("routerPort", String.valueOf(AvailablePortFinder.getNextAvailable()));
             System.setProperty("servicePort", String.valueOf(AvailablePortFinder.getNextAvailable()));
+            CxfComponent cxfComponent = new CxfComponent(getContext());
+            CxfEndpoint serviceEndpoint = new CxfEndpoint(SERVICE_ADDRESS, cxfComponent);
+            serviceEndpoint.setServiceClass(Greeter.class); 
             
             // Here we just pass the exception back, don't need to use errorHandler
             errorHandler(noErrorHandler());
-            from(ROUTER_ENDPOINT_URI).to(SERVICE_ENDPOINT_URI);
+            from(ROUTER_ENDPOINT_URI).to(serviceEndpoint);
         }
         
     }
@@ -82,9 +88,12 @@ public final class CamelCxfExample {
             // START SNIPPET: e3
             context.addRoutes(new RouteBuilder() {
                 public void configure() {
+                    CxfComponent cxfComponent = new CxfComponent(getContext());
+                    CxfEndpoint serviceEndpoint = new CxfEndpoint(SERVICE_ADDRESS, cxfComponent);
+                    serviceEndpoint.setServiceClass(Greeter.class);
                     // Here we just pass the exception back, don't need to use errorHandler
                     errorHandler(noErrorHandler());
-                    from(ROUTER_ENDPOINT_URI).to(SERVICE_ENDPOINT_URI);
+                    from(ROUTER_ENDPOINT_URI).to(serviceEndpoint);
                 }
             });
             // END SNIPPET: e3

http://git-wip-us.apache.org/repos/asf/camel/blob/d8df3b79/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/Server.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/Server.java b/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/Server.java
index 8a2bd11..5a84d4b 100644
--- a/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/Server.java
+++ b/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/Server.java
@@ -24,7 +24,9 @@ public class Server {
     public void start() throws Exception {
         System.out.println("Starting Server");
         Object implementor = new GreeterImpl();
-        String address = "http://cxf.apache.org/transports/jms";
+        String address = "jms:jndi:dynamicQueues/test.soap.jmstransport.queue?jndiInitialContextFactory="
+            + "org.apache.activemq.jndi.ActiveMQInitialContextFactory&jndiConnectionFactoryName="
+            + "ConnectionFactory&jndiURL=vm://localhost";
         endpoint = Endpoint.publish(address, implementor);
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d8df3b79/examples/camel-example-cxf/src/main/resources/META-INF/spring/HttpToJmsCamelContext.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-cxf/src/main/resources/META-INF/spring/HttpToJmsCamelContext.xml b/examples/camel-example-cxf/src/main/resources/META-INF/spring/HttpToJmsCamelContext.xml
index a551935..1f9207d 100644
--- a/examples/camel-example-cxf/src/main/resources/META-INF/spring/HttpToJmsCamelContext.xml
+++ b/examples/camel-example-cxf/src/main/resources/META-INF/spring/HttpToJmsCamelContext.xml
@@ -45,6 +45,6 @@
 
   <jaxws:endpoint id="serviceEndpoint"
                   implementor="org.apache.camel.example.cxf.httptojms.GreeterImpl"
-                  address="jms://"/>
+                  address="jms:jndi:dynamicQueues/test.soap.jmstransport.queue?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;jndiConnectionFactoryName=ConnectionFactory&amp;jndiURL=vm://localhost"/>
 
 </beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/d8df3b79/examples/camel-example-cxf/src/main/resources/wsdl/hello_world.wsdl
----------------------------------------------------------------------
diff --git a/examples/camel-example-cxf/src/main/resources/wsdl/hello_world.wsdl b/examples/camel-example-cxf/src/main/resources/wsdl/hello_world.wsdl
index ea54c7a..92143a8 100644
--- a/examples/camel-example-cxf/src/main/resources/wsdl/hello_world.wsdl
+++ b/examples/camel-example-cxf/src/main/resources/wsdl/hello_world.wsdl
@@ -235,13 +235,7 @@
         </wsdl:port>
 
         <wsdl:port binding="tns:JMSGreeterPortBinding" name="SoapOverJms">
-            <jms:address
-                destinationStyle="queue"
-                jndiConnectionFactoryName="ConnectionFactory"
-                jndiDestinationName="dynamicQueues/test.soap.jmstransport.queue">
-                <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
-                <jms:JMSNamingProperty name="java.naming.provider.url" value="vm://localhost"/>
-            </jms:address>
+            <soap:address location="jms:jndi:dynamicQueues/test.soap.jmstransport.queue?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;jndiConnectionFactoryName=ConnectionFactory&amp;jndiURL=vm://localhost"/>
         </wsdl:port>
     </wsdl:service>
 </wsdl:definitions>