mirror of
https://github.com/apache/activemq.git
synced 2025-02-18 07:56:20 +00:00
AMQ-1986 - Upgrade to Camel 1.5.0
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@709735 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
03a6468d12
commit
65ff8f4b9b
@ -27,6 +27,7 @@ import org.apache.activemq.util.ByteSequence;
|
|||||||
import org.apache.camel.CamelExchangeException;
|
import org.apache.camel.CamelExchangeException;
|
||||||
import org.apache.camel.Consumer;
|
import org.apache.camel.Consumer;
|
||||||
import org.apache.camel.Exchange;
|
import org.apache.camel.Exchange;
|
||||||
|
import org.apache.camel.NoTypeConversionAvailableException;
|
||||||
import org.apache.camel.Processor;
|
import org.apache.camel.Processor;
|
||||||
import org.apache.camel.Producer;
|
import org.apache.camel.Producer;
|
||||||
import org.apache.camel.RuntimeCamelException;
|
import org.apache.camel.RuntimeCamelException;
|
||||||
@ -188,9 +189,10 @@ public class JournalEndpoint extends DefaultEndpoint<Exchange> {
|
|||||||
public void process(Exchange exchange) throws Exception {
|
public void process(Exchange exchange) throws Exception {
|
||||||
incrementReference();
|
incrementReference();
|
||||||
try {
|
try {
|
||||||
|
ByteSequence body = null;
|
||||||
ByteSequence body = exchange.getIn().getBody(ByteSequence.class);
|
try {
|
||||||
if (body == null) {
|
body = exchange.getIn().getBody(ByteSequence.class);
|
||||||
|
} catch(NoTypeConversionAvailableException e) {
|
||||||
byte[] bytes = exchange.getIn().getBody(byte[].class);
|
byte[] bytes = exchange.getIn().getBody(byte[].class);
|
||||||
if (bytes != null) {
|
if (bytes != null) {
|
||||||
body = new ByteSequence(bytes);
|
body = new ByteSequence(bytes);
|
||||||
|
@ -16,15 +16,17 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.activemq.camel.component;
|
package org.apache.activemq.camel.component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.activemq.EmbeddedBrokerTestSupport;
|
|
||||||
import org.apache.activemq.broker.BrokerService;
|
|
||||||
import org.apache.activemq.command.ActiveMQDestination;
|
import org.apache.activemq.command.ActiveMQDestination;
|
||||||
import org.apache.activemq.command.ActiveMQQueue;
|
import org.apache.activemq.command.ActiveMQQueue;
|
||||||
import org.apache.activemq.command.ActiveMQTopic;
|
import org.apache.activemq.command.ActiveMQTopic;
|
||||||
|
import org.apache.activemq.EmbeddedBrokerTestSupport;
|
||||||
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.camel.CamelContext;
|
import org.apache.camel.CamelContext;
|
||||||
import org.apache.camel.CamelTemplate;
|
import org.apache.camel.Endpoint;
|
||||||
import org.apache.camel.impl.DefaultCamelContext;
|
import org.apache.camel.impl.DefaultCamelContext;
|
||||||
import org.apache.camel.spi.BrowsableEndpoint;
|
import org.apache.camel.spi.BrowsableEndpoint;
|
||||||
import org.apache.camel.util.CamelContextHelper;
|
import org.apache.camel.util.CamelContextHelper;
|
||||||
@ -44,18 +46,31 @@ public class AutoExposeQueuesInCamelTest extends EmbeddedBrokerTestSupport {
|
|||||||
protected ActiveMQTopic sampleTopic = new ActiveMQTopic("cheese");
|
protected ActiveMQTopic sampleTopic = new ActiveMQTopic("cheese");
|
||||||
|
|
||||||
protected CamelContext camelContext = new DefaultCamelContext();
|
protected CamelContext camelContext = new DefaultCamelContext();
|
||||||
protected CamelTemplate template;
|
|
||||||
|
|
||||||
public void testWorks() throws Exception {
|
public void testWorks() throws Exception {
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
LOG.debug("Looking for endpoints...");
|
LOG.debug("Looking for endpoints...");
|
||||||
List<BrowsableEndpoint> endpoints = CamelContextHelper.getSingletonEndpoints(camelContext, BrowsableEndpoint.class);
|
// Changed from using CamelContextHelper.getSingletonEndpoints here because JMS Endpoints in Camel
|
||||||
|
// are always non-singleton
|
||||||
|
List<BrowsableEndpoint> endpoints = getEndpoints(camelContext, BrowsableEndpoint.class);
|
||||||
for (BrowsableEndpoint endpoint : endpoints) {
|
for (BrowsableEndpoint endpoint : endpoints) {
|
||||||
LOG.debug("Endpoint: " + endpoint);
|
LOG.debug("Endpoint: " + endpoint);
|
||||||
}
|
}
|
||||||
assertEquals("Should have found an endpoint: "+ endpoints, 1, endpoints.size());
|
assertEquals("Should have found an endpoint: "+ endpoints, 1, endpoints.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> List<T> getEndpoints(CamelContext camelContext, Class<T> type) {
|
||||||
|
List<T> answer = new ArrayList<T>();
|
||||||
|
Collection<Endpoint> endpoints = camelContext.getEndpoints();
|
||||||
|
for (Endpoint endpoint : endpoints) {
|
||||||
|
if (type.isInstance(endpoint)) {
|
||||||
|
T value = type.cast(endpoint);
|
||||||
|
answer.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
2
pom.xml
2
pom.xml
@ -42,7 +42,7 @@
|
|||||||
<aopalliance-version>1.0</aopalliance-version>
|
<aopalliance-version>1.0</aopalliance-version>
|
||||||
<axion-version>1.0-M3-dev</axion-version>
|
<axion-version>1.0-M3-dev</axion-version>
|
||||||
<axis-version>1.2-RC1</axis-version>
|
<axis-version>1.2-RC1</axis-version>
|
||||||
<camel-version>1.4.0</camel-version>
|
<camel-version>1.5.0</camel-version>
|
||||||
<cglib-version>2.0</cglib-version>
|
<cglib-version>2.0</cglib-version>
|
||||||
<commons-beanutils-version>1.6.1</commons-beanutils-version>
|
<commons-beanutils-version>1.6.1</commons-beanutils-version>
|
||||||
<commons-collections-version>3.1</commons-collections-version>
|
<commons-collections-version>3.1</commons-collections-version>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user