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:
Jonathan Anstey 2008-11-01 17:46:44 +00:00
parent 03a6468d12
commit 65ff8f4b9b
3 changed files with 26 additions and 9 deletions

View File

@ -27,6 +27,7 @@ import org.apache.activemq.util.ByteSequence;
import org.apache.camel.CamelExchangeException;
import org.apache.camel.Consumer;
import org.apache.camel.Exchange;
import org.apache.camel.NoTypeConversionAvailableException;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.RuntimeCamelException;
@ -188,9 +189,10 @@ public class JournalEndpoint extends DefaultEndpoint<Exchange> {
public void process(Exchange exchange) throws Exception {
incrementReference();
try {
ByteSequence body = exchange.getIn().getBody(ByteSequence.class);
if (body == null) {
ByteSequence body = null;
try {
body = exchange.getIn().getBody(ByteSequence.class);
} catch(NoTypeConversionAvailableException e) {
byte[] bytes = exchange.getIn().getBody(byte[].class);
if (bytes != null) {
body = new ByteSequence(bytes);

View File

@ -16,15 +16,17 @@
*/
package org.apache.activemq.camel.component;
import java.util.ArrayList;
import java.util.Collection;
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.ActiveMQQueue;
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.CamelTemplate;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.spi.BrowsableEndpoint;
import org.apache.camel.util.CamelContextHelper;
@ -44,18 +46,31 @@ public class AutoExposeQueuesInCamelTest extends EmbeddedBrokerTestSupport {
protected ActiveMQTopic sampleTopic = new ActiveMQTopic("cheese");
protected CamelContext camelContext = new DefaultCamelContext();
protected CamelTemplate template;
public void testWorks() throws Exception {
Thread.sleep(2000);
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) {
LOG.debug("Endpoint: " + endpoint);
}
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
protected void setUp() throws Exception {
super.setUp();

View File

@ -42,7 +42,7 @@
<aopalliance-version>1.0</aopalliance-version>
<axion-version>1.0-M3-dev</axion-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>
<commons-beanutils-version>1.6.1</commons-beanutils-version>
<commons-collections-version>3.1</commons-collections-version>