You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cs...@apache.org on 2017/06/13 14:13:45 UTC

activemq git commit: AMQ-6585 - Fixing ActiveMQ camel components for 2.18.x

Repository: activemq
Updated Branches:
  refs/heads/master b6cb0eace -> 395a48dee


AMQ-6585 - Fixing ActiveMQ camel components for 2.18.x

The new version of Camel adds username and password to JmsComponent and
JmsConfiguration which interferes with the ActiveMQ version.  Fixing
ActiveMQComponent and ActiveMQConfiguration to use the inherited
properties now which fixes username/password unit tests.  Also fixed a
couple of other tests that had bad configuration.


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/395a48de
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/395a48de
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/395a48de

Branch: refs/heads/master
Commit: 395a48deea8806e76f91278b486f52bc4b9841a2
Parents: b6cb0ea
Author: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Authored: Tue Jun 13 10:11:07 2017 -0400
Committer: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Committed: Tue Jun 13 10:13:21 2017 -0400

----------------------------------------------------------------------
 .../camel/component/ActiveMQComponent.java      | 17 +++-------
 .../camel/component/ActiveMQConfiguration.java  | 34 ++++++++------------
 ...DestinationExclusiveConsumerTest-context.xml |  5 +++
 .../activemq/camel/SetHeaderTest-context.xml    |  4 +++
 4 files changed, 27 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/395a48de/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java
----------------------------------------------------------------------
diff --git a/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java b/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java
index d1328f2..440b46a 100644
--- a/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java
+++ b/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java
@@ -104,21 +104,11 @@ public class ActiveMQComponent extends JmsComponent implements EndpointCompleter
     }
 
     /**
-     * Sets the username to be used to login to ActiveMQ
+     * @deprecated - use JmsComponent#setUsername(String)
+     * @see JmsComponent#setUsername(String)
      */
     public void setUserName(String userName) {
-        if (getConfiguration() instanceof ActiveMQConfiguration) {
-            ((ActiveMQConfiguration)getConfiguration()).setUserName(userName);
-        }
-    }
-
-    /**
-     * Sets the password/passcode used to login to ActiveMQ
-     */
-    public void setPassword(String password) {
-        if (getConfiguration() instanceof ActiveMQConfiguration) {
-            ((ActiveMQConfiguration)getConfiguration()).setPassword(password);
-        }
+        setUsername(userName);
     }
 
     public void setTrustAllPackages(boolean trustAllPackages) {
@@ -303,6 +293,7 @@ public class ActiveMQComponent extends JmsComponent implements EndpointCompleter
      *
      * @return false
      */
+    @Override
     public boolean isAllowAutoWiredConnectionFactory() {
         return false;
     }

http://git-wip-us.apache.org/repos/asf/activemq/blob/395a48de/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java
----------------------------------------------------------------------
diff --git a/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java b/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java
index 26d31a6..4179b7b 100644
--- a/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java
+++ b/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java
@@ -35,8 +35,6 @@ public class ActiveMQConfiguration extends JmsConfiguration {
     private String brokerURL = ActiveMQConnectionFactory.DEFAULT_BROKER_URL;
     private boolean useSingleConnection = false;
     private boolean usePooledConnection = true;
-    private String userName;
-    private String password;
     private boolean trustAllPackages;
 
     public ActiveMQConfiguration() {
@@ -60,26 +58,22 @@ public class ActiveMQConfiguration extends JmsConfiguration {
         return useSingleConnection;
     }
 
-    public String getUserName() {
-        return userName;
-    }
-
     /**
-     * Sets the username to be used to login to ActiveMQ
+     * @deprecated - use JmsConfiguration#getUsername()
+     * @see JmsConfiguration#getUsername()
      */
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public String getPassword() {
-        return password;
+    @Deprecated
+    public String getUserName() {
+        return getUsername();
     }
 
     /**
-     * Sets the password/passcode used to login to ActiveMQ
+     * @deprecated - use JmsConfiguration#setUsername(String)
+     * @see JmsConfiguration#setUsername(String)
      */
-    public void setPassword(String password) {
-        this.password = password;
+    @Deprecated
+    public void setUserName(String userName) {
+        setUsername(userName);
     }
 
     /**
@@ -146,11 +140,11 @@ public class ActiveMQConfiguration extends JmsConfiguration {
     protected ConnectionFactory createConnectionFactory() {
         ActiveMQConnectionFactory answer = new ActiveMQConnectionFactory();
         answer.setTrustAllPackages(trustAllPackages);
-        if (userName != null) {
-            answer.setUserName(userName);
+        if (getUsername() != null) {
+            answer.setUserName(getUsername());
         }
-        if (password != null) {
-            answer.setPassword(password);
+        if (getPassword() != null) {
+            answer.setPassword(getPassword());
         }
         if (answer.getBeanName() == null) {
             answer.setBeanName("Camel");

http://git-wip-us.apache.org/repos/asf/activemq/blob/395a48de/activemq-camel/src/test/resources/org/apache/activemq/camel/CamelDestinationExclusiveConsumerTest-context.xml
----------------------------------------------------------------------
diff --git a/activemq-camel/src/test/resources/org/apache/activemq/camel/CamelDestinationExclusiveConsumerTest-context.xml b/activemq-camel/src/test/resources/org/apache/activemq/camel/CamelDestinationExclusiveConsumerTest-context.xml
index 7782b9e..c420957 100644
--- a/activemq-camel/src/test/resources/org/apache/activemq/camel/CamelDestinationExclusiveConsumerTest-context.xml
+++ b/activemq-camel/src/test/resources/org/apache/activemq/camel/CamelDestinationExclusiveConsumerTest-context.xml
@@ -39,5 +39,10 @@
   <bean id="connectionFactory" class="org.apache.activemq.spring.ActiveMQConnectionFactory">
     <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
   </bean>
+  
+  <bean id="activemq" 
+      class="org.apache.activemq.camel.component.ActiveMQComponent">
+      <property name="brokerURL" value="vm://localhost"/>
+   </bean>
 
 </beans>

http://git-wip-us.apache.org/repos/asf/activemq/blob/395a48de/activemq-camel/src/test/resources/org/apache/activemq/camel/SetHeaderTest-context.xml
----------------------------------------------------------------------
diff --git a/activemq-camel/src/test/resources/org/apache/activemq/camel/SetHeaderTest-context.xml b/activemq-camel/src/test/resources/org/apache/activemq/camel/SetHeaderTest-context.xml
index 5c80044..9dd6bf6 100644
--- a/activemq-camel/src/test/resources/org/apache/activemq/camel/SetHeaderTest-context.xml
+++ b/activemq-camel/src/test/resources/org/apache/activemq/camel/SetHeaderTest-context.xml
@@ -45,5 +45,9 @@
     <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
   </bean>
 
+  <bean id="activemq" 
+      class="org.apache.activemq.camel.component.ActiveMQComponent">
+      <property name="brokerURL" value="vm://localhost"/>
+   </bean>
 </beans>
         <!-- END SNIPPET: example -->