cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1124521 - in /cxf/trunk/rt/transports/jms/src: main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java test/java/org/apache/cxf/transport/jms/OldConfigTest.java
Date Thu, 19 May 2011 02:43:23 GMT
Author: ffang
Date: Thu May 19 02:43:22 2011
New Revision: 1124521

URL: http://svn.apache.org/viewvc?rev=1124521&view=rev
Log:
[CXF-3532]jms set username/password missmatch

Added:
    cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/OldConfigTest.java
Modified:
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java?rev=1124521&r1=1124520&r2=1124521&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java
Thu May 19 02:43:22 2011
@@ -124,7 +124,7 @@ public class JMSOldConfigHolder {
      * then be used to configure the JMSConfiguration object 
      * @param target 
      */
-    private JMSEndpoint getExtensorsAndConfig(Bus bus,
+    protected JMSEndpoint getExtensorsAndConfig(Bus bus,
                            EndpointInfo endpointInfo,
                            EndpointReferenceType target,
                            boolean isConduit) throws IOException {
@@ -184,6 +184,10 @@ public class JMSOldConfigHolder {
         throws IOException {
         JMSEndpoint endpoint = getExtensorsAndConfig(bus, endpointInfo, target, isConduit);
 
+        return configureEndpoint(isConduit, endpoint);
+    }
+
+    protected JMSConfiguration configureEndpoint(boolean isConduit, JMSEndpoint endpoint)
{
         if (address != null) {
             mapAddressToEndpoint(address, endpoint);
         }
@@ -197,7 +201,7 @@ public class JMSOldConfigHolder {
                 ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
             jmsConfig.setDeliveryMode(deliveryMode);
         }
-        
+
         if (endpoint.isSetPriority()) {
             int priority = endpoint.getPriority();
             jmsConfig.setPriority(priority);
@@ -210,10 +214,10 @@ public class JMSOldConfigHolder {
             JNDIConfiguration jndiConfig = new JNDIConfiguration();
             jndiConfig.setJndiConnectionFactoryName(endpoint.getJndiConnectionFactoryName());
             jmsConfig.setJndiTemplate(jt);
-            
+
             jndiConfig.setConnectionUserName(endpoint.getUsername());
             jndiConfig.setConnectionPassword(endpoint.getPassword());
-            
+
             jmsConfig.setJndiConfig(jndiConfig);
             if (endpoint.isSetReconnectOnException()) {
                 jmsConfig.setReconnectOnException(endpoint.isReconnectOnException());
@@ -281,7 +285,7 @@ public class JMSOldConfigHolder {
                 }
             }
         }
-        
+
         String requestURI = endpoint.getRequestURI();
         jmsConfig.setRequestURI(requestURI);
 
@@ -289,7 +293,7 @@ public class JMSOldConfigHolder {
         jmsConfig.setTargetService(targetService);
         return jmsConfig;
     }
-    
+
     private static void setReplyDestination(JMSConfiguration jmsConfig, JMSEndpoint endpoint)
{
         if (endpoint.getReplyToName() != null)  {
             jmsConfig.setReplyDestination(endpoint.getReplyToName());
@@ -314,7 +318,7 @@ public class JMSOldConfigHolder {
             endpoint.setUsername(address.getConnectionUserName());
         }
         if (address.isSetConnectionPassword()) {
-            endpoint.setPassword(address.getConnectionUserName());
+            endpoint.setPassword(address.getConnectionPassword());
         }
         if (address.isSetReconnectOnException()) {
             endpoint.setReconnectOnException(address.isReconnectOnException());

Added: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/OldConfigTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/OldConfigTest.java?rev=1124521&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/OldConfigTest.java
(added)
+++ cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/OldConfigTest.java
Thu May 19 02:43:22 2011
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.transport.jms;
+
+import junit.framework.Assert;
+import org.apache.cxf.transport.jms.uri.JMSEndpoint;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+public class OldConfigTest extends AbstractJMSTester {
+
+    @BeforeClass
+    public static void createAndStartBroker() throws Exception {
+        startBroker(new JMSBrokerSetup("tcp://localhost:61500"));
+    }
+
+    @Test
+    public void testUsernameAndPassword() throws Exception {
+        setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
+                "HelloWorldService", "HelloWorldPort");
+        JMSOldConfigHolder holder = new JMSOldConfigHolder();
+        JMSEndpoint endpoint = holder.getExtensorsAndConfig(bus, endpointInfo, target, false);
+        holder.configureEndpoint(false, endpoint);
+        Assert.assertEquals("User name does not match." , "testUser", endpoint.getUsername());
+        Assert.assertEquals("Password does not match." , "testPassword", endpoint.getPassword());
+    }
+}



Mime
View raw message