cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1212530 - in /cxf/trunk/rt/transports/jms: pom.xml src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java src/test/java/org/apache/cxf/transport/jms/MessageIdAsCorrelationIdJMSConduitTest.java
Date Fri, 09 Dec 2011 17:24:43 GMT
Author: cschneider
Date: Fri Dec  9 17:24:43 2011
New Revision: 1212530

URL: http://svn.apache.org/viewvc?rev=1212530&view=rev
Log:
CXF-3920 Return the correct transport URI

Modified:
    cxf/trunk/rt/transports/jms/pom.xml
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
    cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/MessageIdAsCorrelationIdJMSConduitTest.java

Modified: cxf/trunk/rt/transports/jms/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/pom.xml?rev=1212530&r1=1212529&r2=1212530&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/pom.xml (original)
+++ cxf/trunk/rt/transports/jms/pom.xml Fri Dec  9 17:24:43 2011
@@ -66,6 +66,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-bindings-soap</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-testutils</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java?rev=1212530&r1=1212529&r2=1212530&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
Fri Dec  9 17:24:43 2011
@@ -21,13 +21,16 @@ package org.apache.cxf.transport.jms;
 import java.util.logging.Logger;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.binding.soap.model.SoapBindingInfo;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.ConfigurationException;
 import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.springframework.beans.factory.annotation.Required;
@@ -50,6 +53,8 @@ public class JMSConfigFeature extends Ab
         if (!(conduit instanceof JMSConduit)) {
             throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
         }
+        Endpoint ep = client.getEndpoint();
+        changeTransportUriToJms(ep);
         JMSConduit jmsConduit = (JMSConduit)conduit;
         jmsConduit.setJmsConfig(jmsConfig);
         super.initialize(client, bus);
@@ -62,11 +67,27 @@ public class JMSConfigFeature extends Ab
         if (!(destination instanceof JMSDestination)) {
             throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
         }
+        Endpoint ep = server.getEndpoint();
+        changeTransportUriToJms(ep);
         JMSDestination jmsDestination = (JMSDestination)destination;
         jmsDestination.setJmsConfig(jmsConfig);
         super.initialize(server, bus);
     }
 
+    private void changeTransportUriToJms(Endpoint ep) {
+        if (ep.getBinding() == null) {
+            return;
+        }
+        if (ep.getBinding().getBindingInfo() == null) {
+            return;
+        }
+        BindingInfo bindingInfo = ep.getBinding().getBindingInfo();
+        if (bindingInfo instanceof SoapBindingInfo) {
+            SoapBindingInfo soapBindingInfo = (SoapBindingInfo) bindingInfo;
+            soapBindingInfo.setTransportURI("http://schemas.xmlsoap.org/soap/jms");
+        }
+    }
+
     public JMSConfiguration getJmsConfig() {
         return jmsConfig;
     }

Modified: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/MessageIdAsCorrelationIdJMSConduitTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/MessageIdAsCorrelationIdJMSConduitTest.java?rev=1212530&r1=1212529&r2=1212530&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/MessageIdAsCorrelationIdJMSConduitTest.java
(original)
+++ cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/MessageIdAsCorrelationIdJMSConduitTest.java
Fri Dec  9 17:24:43 2011
@@ -53,9 +53,8 @@ public class MessageIdAsCorrelationIdJMS
     private ConnectionFactory connectionFactory;
     private String requestMessageId;
 
-
-    @Test
-    public void testSendReceive() {
+    
+    public void sendAndReceive(String replyDestination) {
         BusFactory bf = BusFactory.newInstance();
         Bus bus = bf.createBus();
         BusFactory.setDefaultBus(bus);
@@ -70,6 +69,7 @@ public class MessageIdAsCorrelationIdJMS
         jmsConfig.setTargetDestination("queue:test");
         jmsConfig.setReplyDestination("queue:reply");
         jmsConfig.setConnectionFactory(connectionFactory);
+        jmsConfig.setReplyDestination(replyDestination);
 
         JMSConduit conduit = new JMSConduit(endpointInfo, target, jmsConfig, bus);
         Exchange exchange = new ExchangeImpl();
@@ -82,6 +82,16 @@ public class MessageIdAsCorrelationIdJMS
         conduit.close();
     }
 
+    @Test
+    public void testSendReceiveWithTempReplyQueue() {
+        sendAndReceive(null);
+    }
+    
+    @Test
+    public void testSendReceive() {
+        sendAndReceive("queue:testreply");
+    }
+
     private void runReceiver() {
         Executors.newSingleThreadExecutor().execute(new Runnable() {
             public void run() {



Mime
View raw message