You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gn...@apache.org on 2018/09/22 15:58:51 UTC
activemq git commit: [AMQ-7060] Remove deprecated features from camel
ActiveMQComponent
Repository: activemq
Updated Branches:
refs/heads/master cdbddcafa -> 8cbc2080a
[AMQ-7060] Remove deprecated features from camel ActiveMQComponent
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/8cbc2080
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/8cbc2080
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/8cbc2080
Branch: refs/heads/master
Commit: 8cbc2080a737aad063bde7260ba8e7963ec0b206
Parents: cdbddca
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Sat Sep 22 17:58:40 2018 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Sat Sep 22 17:58:40 2018 +0200
----------------------------------------------------------------------
.../camel/component/ActiveMQComponent.java | 54 +++-----------------
.../component/AutoExposeQueuesInCamelTest.java | 23 ---------
2 files changed, 6 insertions(+), 71 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq/blob/8cbc2080/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 047604c..a36e073 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
@@ -17,18 +17,17 @@
package org.apache.activemq.camel.component;
import java.net.URISyntaxException;
-import java.util.*;
+import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
+import javax.jms.Connection;
+
import org.apache.activemq.EnhancedConnection;
import org.apache.activemq.Service;
import org.apache.activemq.advisory.DestinationSource;
-import org.apache.activemq.command.ActiveMQDestination;
import org.apache.camel.CamelContext;
-import org.apache.camel.ComponentConfiguration;
import org.apache.camel.component.jms.JmsComponent;
import org.apache.camel.component.jms.JmsConfiguration;
-import org.apache.camel.spi.EndpointCompleter;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.URISupport;
@@ -37,23 +36,20 @@ import org.slf4j.LoggerFactory;
import org.springframework.jms.connection.SingleConnectionFactory;
import org.springframework.jms.core.JmsTemplate;
-import javax.jms.Connection;
-
/**
* The <a href="http://activemq.apache.org/camel/activemq.html">ActiveMQ Component</a>
*/
-public class ActiveMQComponent extends JmsComponent implements EndpointCompleter {
+public class ActiveMQComponent extends JmsComponent {
private final CopyOnWriteArrayList<SingleConnectionFactory> singleConnectionFactoryList =
- new CopyOnWriteArrayList<SingleConnectionFactory>();
+ new CopyOnWriteArrayList<SingleConnectionFactory>();
private final CopyOnWriteArrayList<Service> pooledConnectionFactoryServiceList =
- new CopyOnWriteArrayList<Service>();
+ new CopyOnWriteArrayList<Service>();
private static final transient Logger LOG = LoggerFactory.getLogger(ActiveMQComponent.class);
private boolean exposeAllQueues;
private CamelEndpointLoader endpointLoader;
private EnhancedConnection connection;
DestinationSource source;
- boolean sourceInitialized = false;
/**
* Creates an <a href="http://camel.apache.org/activemq.html">ActiveMQ Component</a>
@@ -103,14 +99,6 @@ public class ActiveMQComponent extends JmsComponent implements EndpointCompleter
}
}
- /**
- * @deprecated - use JmsComponent#setUsername(String)
- * @see JmsComponent#setUsername(String)
- */
- public void setUserName(String userName) {
- setUsername(userName);
- }
-
public void setTrustAllPackages(boolean trustAllPackages) {
if (getConfiguration() instanceof ActiveMQConfiguration) {
((ActiveMQConfiguration)getConfiguration()).setTrustAllPackages(trustAllPackages);
@@ -258,34 +246,4 @@ public class ActiveMQComponent extends JmsComponent implements EndpointCompleter
return answer;
}
- @Override
- public List<String> completeEndpointPath(ComponentConfiguration componentConfiguration, String completionText) {
- // try to initialize destination source only the first time
- if (!sourceInitialized) {
- createDestinationSource();
- sourceInitialized = true;
- }
- ArrayList<String> answer = new ArrayList<String>();
- if (source != null) {
- Set candidates = source.getQueues();
- String destinationName = completionText;
- if (completionText.startsWith("topic:")) {
- candidates = source.getTopics();
- destinationName = completionText.substring(6);
- } else if (completionText.startsWith("queue:")) {
- destinationName = completionText.substring(6);
- }
-
- Iterator it = candidates.iterator();
-
- while (it.hasNext()) {
- ActiveMQDestination destination = (ActiveMQDestination) it.next();
- if (destination.getPhysicalName().startsWith(destinationName)) {
- answer.add(destination.getPhysicalName());
- }
- }
- }
- return answer;
- }
-
}
http://git-wip-us.apache.org/repos/asf/activemq/blob/8cbc2080/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java
----------------------------------------------------------------------
diff --git a/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java b/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java
index 77a687a..bb1016e 100644
--- a/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java
+++ b/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java
@@ -66,29 +66,6 @@ public class AutoExposeQueuesInCamelTest extends EmbeddedBrokerTestSupport {
assertEquals("Should have found an endpoint: "+ endpoints, 2, endpoints.size());
}
- public void testCompleter() throws Exception {
- Thread.sleep(1000);
- List<String> result = component.completeEndpointPath(null, "foo");
- assertThat(result, is(Arrays.asList("foo.bar")));
- result = component.completeEndpointPath(null, "queue:foo");
- assertThat(result, is(Arrays.asList("foo.bar")));
- result = component.completeEndpointPath(null, "topic:ch");
- assertThat(result, is(Arrays.asList("cheese")));
- result = component.completeEndpointPath(null, "ch");
- assertTrue(result.isEmpty());
- result = component.completeEndpointPath(null, "queue:ch");
- assertTrue(result.isEmpty());
- result = component.completeEndpointPath(null, "topic:foo");
- assertTrue(result.isEmpty());
-
- broker.getAdminView().addQueue("runtime");
-
- Thread.sleep(1000);
-
- result = component.completeEndpointPath(null, "run");
- assertThat(result, is(Arrays.asList("runtime")));
- }
-
public <T> List<T> getEndpoints(CamelContext camelContext, Class<T> type) {
List<T> answer = new ArrayList<T>();
Collection<Endpoint> endpoints = camelContext.getEndpoints();