cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashaki...@apache.org
Subject [1/2] cxf git commit: [CXF-6419]: Update JMSEndpoint properties using EndpointInfo
Date Thu, 21 May 2015 21:29:45 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 67f165611 -> 580366ccf


[CXF-6419]: Update JMSEndpoint properties using EndpointInfo


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

Branch: refs/heads/master
Commit: 988caadb6f2eed12456dc576704d4b118c98995f
Parents: 0eb7eb1
Author: Andrei Shakirin <andrei.shakirin@gmail.com>
Authored: Thu May 21 23:29:19 2015 +0200
Committer: Andrei Shakirin <andrei.shakirin@gmail.com>
Committed: Thu May 21 23:29:19 2015 +0200

----------------------------------------------------------------------
 .../cxf/transport/jms/uri/JMSEndpoint.java      | 24 +++++++++++++++++---
 .../cxf/transport/jms/uri/JMSEndpointTest.java  | 12 ++++++++++
 2 files changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/988caadb/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
index 1c7e126..f5e9d03 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
@@ -51,6 +51,8 @@ public class JMSEndpoint {
      */
     public static final String JNDI_PARAMETER_NAME_PREFIX = "jndi-";
 
+    public static final String JAXWS_PROPERTY_PREFIX = "jms.";
+
     private Map<String, String> jndiParameters = new HashMap<String, String>();
     private Map<String, String> parameters = new HashMap<String, String>();
     
@@ -119,9 +121,25 @@ public class JMSEndpoint {
             Map<String, Object> query = parsed.parseQuery();
             configureProperties(query);
             
-            // Use the properties like e.g. from JAXWS properties
-            if (ei != null && ei.getBinding() != null && ei.getBinding().getProperties()
!= null) {
-                configureProperties(ei.getBinding().getProperties());
+            // Use the properties like e.g. from JAXWS properties with "jms." prefix
+            Map<String, Object> jmsProps = new HashMap<String, Object>();
+            if (ei != null) {
+                getJaxWsJmsProps(ei.getProperties(), jmsProps);
+            }
+            if (ei != null && ei.getBinding() != null) {
+                getJaxWsJmsProps(ei.getBinding().getProperties(), jmsProps);
+            }
+            configureProperties(jmsProps);
+        }
+    }
+
+    private void getJaxWsJmsProps(Map<String, Object> jaxwsProps, Map<String, Object>
jmsProps) {
+        if (jaxwsProps == null) {
+            return;
+        }
+        for (String key : jaxwsProps.keySet()) {
+            if (key.startsWith(JAXWS_PROPERTY_PREFIX)) {
+                jmsProps.put(key.substring(JAXWS_PROPERTY_PREFIX.length()), jaxwsProps.get(key));
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/988caadb/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java
b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java
index f52f28e..53b1492 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java
@@ -21,12 +21,15 @@ package org.apache.cxf.transport.jms.uri;
 
 import java.util.Map;
 
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.jms.uri.JMSEndpoint.DeliveryModeType;
 import org.junit.Assert;
 import org.junit.Test;
 
 public class JMSEndpointTest extends Assert {
 
+    private static final String TEST_VALUE = "testValue";
+
     @Test
     public void testBasicQueue() throws Exception {
         JMSEndpoint endpoint = new JMSEndpoint("jms:queue:Foo.Bar?concurrentConsumers=21");
@@ -192,4 +195,13 @@ public class JMSEndpointTest extends Assert {
         JMSEndpoint endpoint = new JMSEndpoint("jms:queue:Foo.Bar?jndiTransactionManagerName=test");
         assertEquals("test", endpoint.getJndiTransactionManagerName());
     }
+    
+    @Test
+    public void testJaxWsProps() throws Exception {
+        EndpointInfo ei = new EndpointInfo();
+        ei.setProperty(JMSEndpoint.JAXWS_PROPERTY_PREFIX + "durableSubscriptionName", TEST_VALUE);
+        JMSEndpoint endpoint = new JMSEndpoint(ei, "jms:queue:Foo.Bar");
+        assertEquals(endpoint.getDurableSubscriptionName(), TEST_VALUE);
+    }
+
 }


Mime
View raw message