cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [19/33] cxf git commit: [CXF-7008] Regression: CXF-5788 - JMS replyToDestination doesn't work
Date Sat, 13 Aug 2016 21:30:57 GMT
[CXF-7008] Regression: CXF-5788 - JMS replyToDestination doesn't work


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

Branch: refs/heads/master-jaxrs-2.1
Commit: 0f51e22bc7e13630aeac1996fba4d06e97dea37c
Parents: b39fad5
Author: Tadayoshi Sato <sato.tadayoshi@gmail.com>
Authored: Fri Aug 12 16:06:48 2016 +0900
Committer: Tadayoshi Sato <sato.tadayoshi@gmail.com>
Committed: Fri Aug 12 16:06:48 2016 +0900

----------------------------------------------------------------------
 .../apache/cxf/transport/jms/JMSConduit.java    |  2 +-
 .../cxf/transport/jms/JMSConfiguration.java     | 22 ++++++++++---
 .../cxf/systest/jms/JMSClientServerTest.java    | 34 ++++++++++++++++++++
 3 files changed, 53 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/0f51e22b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
index 677dcf6..f656af7 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
@@ -211,7 +211,7 @@ public class JMSConduit extends AbstractConduit implements JMSExchangeSender,
Me
             String jmsMessageID = sendMessage(request, outMessage, replyToDestination, correlationId,
closer,
                                               session);
             boolean useSyncReceive = ((correlationId == null || userCID != null) &&
!jmsConfig.isPubSubDomain())
-                || !replyToDestination.equals(staticReplyDestination);
+                || (!replyToDestination.equals(staticReplyDestination) && headers.getJMSReplyTo()
!= null);
             if (correlationId == null) {
                 correlationId = jmsMessageID;
                 correlationMap.put(correlationId, exchange);

http://git-wip-us.apache.org/repos/asf/cxf/blob/0f51e22b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
index 4ab0c89..607956d 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
@@ -77,6 +77,7 @@ public class JMSConfiguration {
      * Destination name to send out as replyTo address in the message 
      */
     private String replyToDestination;
+    private volatile Destination replyToDestinationDest;
     private String messageType = JMSConstants.TEXT_MESSAGE_TYPE;
     private boolean pubSubDomain;
     private boolean replyPubSubDomain;
@@ -441,14 +442,27 @@ public class JMSConfiguration {
         }
         return resolver.resolveDestinationName(session, replyToDestinationName, pubSubDomain);
     }
-    
+
     public Destination getReplyToDestination(Session session, String userDestination) throws
JMSException {
-        if (userDestination == null) {
+        if (userDestination != null) {
+            return destinationResolver.resolveDestinationName(session, userDestination, replyPubSubDomain);
+        }
+        if (replyToDestination == null) {
             return getReplyDestination(session);
         }
-        return destinationResolver.resolveDestinationName(session, userDestination, replyPubSubDomain);
+        Destination result = replyToDestinationDest;
+        if (result == null) {
+            synchronized (this) {
+                result = replyToDestinationDest;
+                if (result == null) {
+                    result = destinationResolver.resolveDestinationName(session, replyToDestination,
replyPubSubDomain);
+                    replyToDestinationDest = result;
+                }
+            }
+        }
+        return result;
     }
-    
+
     public Destination getReplyDestination(Session session) throws JMSException {
         Destination result = replyDestinationDest;
         if (result == null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/0f51e22b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
----------------------------------------------------------------------
diff --git a/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
index 376e8a2..4efa891 100644
--- a/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
+++ b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
@@ -33,6 +33,7 @@ import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Endpoint;
 import javax.xml.ws.Response;
 import javax.xml.ws.soap.AddressingFeature;
+import javax.xml.ws.soap.SOAPFaultException;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.cxf.Bus;
@@ -52,8 +53,11 @@ import org.apache.cxf.hello_world_jms.HelloWorldService;
 import org.apache.cxf.hello_world_jms.NoSuchCodeLitFault;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
+import org.apache.cxf.transport.jms.JMSConfigFeature;
+import org.apache.cxf.transport.jms.JMSConfiguration;
 import org.apache.cxf.transport.jms.JMSConstants;
 import org.apache.cxf.transport.jms.JMSMessageHeadersType;
 import org.apache.cxf.transport.jms.JMSPropertyType;
@@ -609,4 +613,34 @@ public class JMSClientServerTest extends AbstractBusClientServerTestBase
{
         ((Closeable)greeter).close();
     }
 
+    @Test(expected = SOAPFaultException.class)
+    public void testReplyAndReplyToDestinations() throws Exception {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setWsdlLocation("classpath:/wsdl/jms_test.wsdl");
+        factory.setServiceName(new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldService"));
+        factory.setEndpointName(new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldPort"));
+        factory.setAddress("jms://");
+        JMSConfigFeature feature = new JMSConfigFeature();
+        JMSConfiguration config = new JMSConfiguration();
+        config.setConnectionFactory(new ActiveMQConnectionFactory(broker.getBrokerURL()));
+        config.setRequestURI("test.jmstransport.text");
+        config.setTargetDestination("test.jmstransport.text");
+        // replyDestination and replyToDestination intentionally differ in this test scenario
+        // replyDestination = Destination name to listen on for reply messages
+        config.setReplyDestination("test.jmstransport.text.reply");
+        // replyToDestination = Destination name to send out as replyTo address in the message
+        config.setReplyToDestination("test.jmstransport.text.replyTo");
+        config.setReceiveTimeout(1000L);
+        feature.setJmsConfig(config);
+        factory.getFeatures().add(feature);
+        HelloWorldPortType greeter = factory.create(HelloWorldPortType.class);
+
+        try {
+            greeter.greetMe("FooBar");
+            // Timeout exception should be thrown
+        } finally {
+            ((java.io.Closeable)greeter).close();
+        }
+    }
+
 }


Mime
View raw message