mirror of https://github.com/apache/activemq.git
[AMQ-7060] Remove deprecated features from camel ActiveMQComponent
This commit is contained in:
parent
cdbddcafa2
commit
8cbc2080a7
|
@ -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,12 +36,10 @@ 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>();
|
||||
private final CopyOnWriteArrayList<Service> pooledConnectionFactoryServiceList =
|
||||
|
@ -53,7 +50,6 @@ public class ActiveMQComponent extends JmsComponent implements EndpointCompleter
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue