servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r610663 - in /servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src: main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java test/java/org/apache/servicemix/cxfse/CxfSeSpringTest.java
Date Thu, 10 Jan 2008 03:58:51 GMT
Author: ffang
Date: Wed Jan  9 19:58:31 2008
New Revision: 610663

URL: http://svn.apache.org/viewvc?rev=610663&view=rev
Log:
[SM-1193]Cxf Se endpoint should support the interfaceName is null in the incoming exchange

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java
    servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/test/java/org/apache/servicemix/cxfse/CxfSeSpringTest.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java?rev=610663&r1=610662&r2=610663&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java
Wed Jan  9 19:58:31 2008
@@ -181,9 +181,19 @@
         JBITransportFactory jbiTransportFactory = (JBITransportFactory) getBus()
                 .getExtension(ConduitInitiatorManager.class)
                 .getConduitInitiator(CxfSeComponent.JBI_TRANSPORT_ID);
+        QName serviceName = exchange.getService();
+        if (serviceName == null) {
+            serviceName = getService();
+            exchange.setService(serviceName);
+        }
+        QName interfaceName = exchange.getInterfaceName();
+        if (interfaceName == null) {
+            interfaceName = getInterfaceName();
+            exchange.setInterfaceName(interfaceName);
+        }
         JBIDestination jbiDestination = jbiTransportFactory
-                .getDestination(exchange.getService().toString()
-                        + exchange.getInterfaceName().toString());
+                .getDestination(serviceName.toString()
+                        + interfaceName.toString());
         DeliveryChannel dc = getContext().getDeliveryChannel();
         jbiTransportFactory.setDeliveryChannel(dc);
         jbiDestination.setDeliveryChannel(dc);
@@ -254,7 +264,6 @@
     public void stop() throws Exception {
         ReflectionUtils.callLifecycleMethod(getPojo(), PreDestroy.class);
         JBIDispatcherUtil.clean();
-        //getBus().shutdown(true);
         JBITransportFactory jbiTransportFactory = (JBITransportFactory) getBus()
             .getExtension(ConduitInitiatorManager.class)
             .getConduitInitiator(CxfSeComponent.JBI_TRANSPORT_ID);

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/test/java/org/apache/servicemix/cxfse/CxfSeSpringTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/test/java/org/apache/servicemix/cxfse/CxfSeSpringTest.java?rev=610663&r1=610662&r2=610663&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/test/java/org/apache/servicemix/cxfse/CxfSeSpringTest.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/test/java/org/apache/servicemix/cxfse/CxfSeSpringTest.java
Wed Jan  9 19:58:31 2008
@@ -34,10 +34,7 @@
     protected void setUp() throws Exception {
         super.setUp();
         client = new DefaultServiceMixClient(jbi);
-        io = client.createInOutExchange();
-        io.setService(new QName("http://apache.org/cxf/calculator", "CalculatorService"));
-        io.setInterfaceName(new QName("http://apache.org/cxf/calculator", "CalculatorPortType"));
-        io.setOperation(new QName("http://apache.org/cxf/calculator", "add"));
+        
     }
     
     protected void tearDown() throws Exception {
@@ -45,6 +42,10 @@
     }
     
     public void testCalculator() throws Exception {
+        io = client.createInOutExchange();
+        io.setService(new QName("http://apache.org/cxf/calculator", "CalculatorService"));
+        io.setInterfaceName(new QName("http://apache.org/cxf/calculator", "CalculatorPortType"));
+        io.setOperation(new QName("http://apache.org/cxf/calculator", "add"));
         io.getInMessage().setContent(new StringSource(
                   "<message xmlns=\"http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper\">"
                 + "  <part>"
@@ -62,7 +63,29 @@
         assertTrue(new SourceTransformer().contentToString(
                 io.getOutMessage()).indexOf("xmlns:msg=\"http://apache.org/cxf/calculator\"")
>= 0);
     }
-    
+
+    public void testCalculatorWithoutInterfaceName() throws Exception {
+        io = client.createInOutExchange();
+        io.setService(new QName("http://apache.org/cxf/calculator", "CalculatorService"));
+        io.setOperation(new QName("http://apache.org/cxf/calculator", "add"));
+        io.getInMessage().setContent(new StringSource(
+                  "<message xmlns=\"http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper\">"
+                + "  <part>"
+                + "    <add xmlns='http://apache.org/cxf/calculator/types'>"
+                + "      <arg0>1</arg0>"
+                + "      <arg1>2</arg1>"
+                + "    </add>"
+                + "  </part>"
+                + "</message>"));
+        client.sendSync(io);
+        //the return message should have type as well
+        
+        assertTrue(new SourceTransformer().contentToString(
+                io.getOutMessage()).indexOf("type=\"msg:addResponse\"") >= 0);
+        assertTrue(new SourceTransformer().contentToString(
+                io.getOutMessage()).indexOf("xmlns:msg=\"http://apache.org/cxf/calculator\"")
>= 0);
+    }
+
     
     
     @Override



Mime
View raw message