AMQ-3417 upgrade Camel version to 2.8.0

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1151406 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Willem Ning Jiang 2011-07-27 09:51:07 +00:00
parent 170a7b5bf5
commit 5e6f8a1ee8
18 changed files with 86 additions and 59 deletions

View File

@ -91,14 +91,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<type>test-jar</type>
<artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -26,12 +26,10 @@ import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.TextMessage;
import junit.framework.Assert;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.impl.DefaultProducerTemplate;
import org.apache.camel.spring.SpringTestSupport;
import org.apache.camel.test.junit4.CamelSpringTestSupport;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@ -39,12 +37,13 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
*
*/
public class CamelJmsTest extends SpringTestSupport {
public class CamelJmsTest extends CamelSpringTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(CamelJmsTest.class);
protected String expectedBody = "<hello>world!</hello>";
@Test
public void testSendingViaJmsIsReceivedByCamel() throws Exception {
MockEndpoint result = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
result.expectedBodiesReceived(expectedBody);
@ -69,6 +68,7 @@ public class CamelJmsTest extends SpringTestSupport {
LOG.info("Received message: " + result.getReceivedExchanges());
}
@Test
public void testConsumingViaJMSReceivesMessageFromCamel() throws Exception {
// lets create a message
Destination destination = getMandatoryBean(Destination.class, "consumeFrom");
@ -87,10 +87,10 @@ public class CamelJmsTest extends SpringTestSupport {
template.sendBody("seda:consumer", expectedBody);
Message message = consumer.receive(5000);
Assert.assertNotNull("Should have received a message from destination: " + destination, message);
assertNotNull("Should have received a message from destination: " + destination, message);
TextMessage textMessage = assertIsInstanceOf(TextMessage.class, message);
Assert.assertEquals("Message body", expectedBody, textMessage.getText());
assertEquals("Message body", expectedBody, textMessage.getText());
LOG.info("Received message: " + message);
}

View File

@ -24,17 +24,20 @@ import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.util.Wait;
import org.apache.camel.spring.SpringTestSupport;
import org.apache.camel.test.junit4.CamelSpringTestSupport;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class DlqTest extends SpringTestSupport {
public class DlqTest extends CamelSpringTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(DlqTest.class);
BrokerService broker = null;
int messageCount;
@Test
public void testSendToDlq() throws Exception {
sendJMSMessageToKickOffRoute();

View File

@ -31,8 +31,10 @@ import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.TransactionId;
import org.apache.activemq.util.Wait;
import org.apache.camel.spring.SpringTestSupport;
import org.apache.camel.test.junit4.CamelSpringTestSupport;
import org.apache.commons.dbcp.BasicDataSource;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.AbstractXmlApplicationContext;
@ -41,7 +43,9 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* shows broker 'once only delivery' and recovery with XA
*/
public class JmsJdbcXATest extends SpringTestSupport {
@Ignore("When upgrade to the Camel 2.8.0, this test will be hang due to camel-jdbc autoCommit issue CAMEL-4272."
+ "We should remove this Ignore annotation when upgrade Camel version again")
public class JmsJdbcXATest extends CamelSpringTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(JmsJdbcXATest.class);
BrokerService broker = null;
int messageCount;
@ -89,6 +93,7 @@ public class JmsJdbcXATest extends SpringTestSupport {
return count;
}
@Test
public void testRecoveryCommit() throws Exception {
java.sql.Connection jdbcConn = initDb();

View File

@ -18,12 +18,13 @@ package org.apache.activemq.camel.component;
import org.apache.activemq.spring.ActiveMQConnectionFactory;
import org.apache.activemq.pool.PooledConnectionFactory;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Endpoint;
import org.apache.camel.component.jms.JmsConsumer;
import org.apache.camel.component.jms.JmsEndpoint;
import org.apache.camel.component.jms.JmsProducer;
import org.apache.camel.processor.CamelLogger;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.listener.AbstractMessageListenerContainer;
import org.springframework.jms.connection.SingleConnectionFactory;
@ -31,8 +32,9 @@ import org.springframework.jms.connection.SingleConnectionFactory;
/**
*
*/
public class ActiveMQConfigureTest extends ContextTestSupport {
public class ActiveMQConfigureTest extends CamelTestSupport {
@Test
public void testJmsTemplateUsesPoolingConnectionFactory() throws Exception {
JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo");
JmsProducer producer = (JmsProducer) endpoint.createProducer();
@ -42,6 +44,7 @@ public class ActiveMQConfigureTest extends ContextTestSupport {
assertIsInstanceOf(PooledConnectionFactory.class, template.getConnectionFactory());
}
@Test
public void testJmsTemplateUsesSingleConnectionFactory() throws Exception {
JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo?useSingleConnection=true");
JmsProducer producer = (JmsProducer) endpoint.createProducer();
@ -52,6 +55,7 @@ public class ActiveMQConfigureTest extends ContextTestSupport {
assertIsInstanceOf(ActiveMQConnectionFactory.class, connectionFactory.getTargetConnectionFactory());
}
@Test
public void testJmsTemplateDoesNotUsePoolingConnectionFactory() throws Exception {
JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo?usePooledConnection=false");
JmsProducer producer = (JmsProducer) endpoint.createProducer();
@ -61,6 +65,7 @@ public class ActiveMQConfigureTest extends ContextTestSupport {
assertIsInstanceOf(ActiveMQConnectionFactory.class, template.getConnectionFactory());
}
@Test
public void testListenerContainerUsesSpringConnectionFactory() throws Exception {
JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:topic:test.foo");
JmsConsumer consumer = endpoint.createConsumer(new CamelLogger());

View File

@ -22,24 +22,25 @@ import java.util.Date;
import java.util.List;
import javax.jms.Destination;
import javax.jms.Message;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jms.JmsMessage;
import org.apache.camel.component.mock.AssertionClause;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
*/
public class ActiveMQJmsHeaderRouteTest extends ContextTestSupport {
public class ActiveMQJmsHeaderRouteTest extends CamelTestSupport {
private static final transient Logger LOG = LoggerFactory.getLogger(ActiveMQJmsHeaderRouteTest.class);
protected Object expectedBody = "<time>" + new Date() + "</time>";
@ -47,6 +48,7 @@ public class ActiveMQJmsHeaderRouteTest extends ContextTestSupport {
protected String correlationID = "ABC-123";
protected String messageType = getClass().getName();
@Test
public void testForwardingAMessageAcrossJMSKeepingCustomJMSHeaders() throws Exception {
MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);

View File

@ -26,19 +26,20 @@ import javax.jms.Destination;
import static org.apache.activemq.camel.component.ActiveMQComponent.activeMQComponent;
import org.apache.activemq.camel.converter.ActiveMQConverter;
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.AssertionClause;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
*/
public class ActiveMQReplyToHeaderUsingConverterTest extends ContextTestSupport {
public class ActiveMQReplyToHeaderUsingConverterTest extends CamelTestSupport {
private static final transient Logger LOG = LoggerFactory.getLogger(ActiveMQReplyToHeaderUsingConverterTest.class);
protected Object expectedBody = "<time>" + new Date() + "</time>";
protected String replyQueueName = "queue://test.my.reply.queue";
@ -47,6 +48,7 @@ public class ActiveMQReplyToHeaderUsingConverterTest extends ContextTestSupport
protected String messageType = getClass().getName();
protected boolean useReplyToHeader = false;
@Test
public void testSendingAMessageFromCamelSetsCustomJmsHeaders() throws Exception {
MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);

View File

@ -16,21 +16,25 @@
*/
package org.apache.activemq.camel.component;
import org.springframework.jms.connection.JmsTransactionManager;
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import static org.apache.activemq.camel.component.ActiveMQComponent.activeMQComponent;
import org.apache.camel.component.jms.JmsEndpoint;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Before;
import org.junit.Test;
import org.springframework.jms.connection.JmsTransactionManager;
import static org.apache.activemq.camel.component.ActiveMQComponent.activeMQComponent;
/**
*
*/
public class ActiveMQRouteTest extends ContextTestSupport {
public class ActiveMQRouteTest extends CamelTestSupport {
protected MockEndpoint resultEndpoint;
protected String startEndpointUri = "activemq:queue:test.a";
@Test
public void testJmsRouteWithTextMessage() throws Exception {
String expectedBody = "Hello there!";
@ -46,8 +50,8 @@ public class ActiveMQRouteTest extends ContextTestSupport {
template.sendBodyAndHeader(startEndpointUri, expectedBody, "cheese", 123);
}
@Override
protected void setUp() throws Exception {
@Before
public void setUp() throws Exception {
super.setUp();
resultEndpoint = (MockEndpoint) context.getEndpoint("mock:result");

View File

@ -16,26 +16,24 @@
*/
package org.apache.activemq.camel.component;
import java.util.List;
import org.apache.activemq.util.ByteSequence;
import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.command.DataStructure;
import org.apache.activemq.command.DestinationInfo;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.Message;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.AssertionClause;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.component.jms.JmsMessage;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
*
*/
public class AdvisoryConsumerExample extends ContextTestSupport {
public class AdvisoryConsumerExample extends CamelTestSupport {
@Test
public void testWorks() throws Exception {
// lets create a new queue
template.sendBody("activemq:NewQueue." + System.currentTimeMillis(), "<hello>world!</hello>");

View File

@ -29,7 +29,7 @@ import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.spi.BrowsableEndpoint;
import org.apache.camel.util.CamelContextHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -27,31 +27,30 @@ import java.util.Map;
import javax.jms.Destination;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Headers;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jms.JmsConstants;
import org.apache.camel.component.mock.AssertionClause;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
*/
public class InvokeRequestReplyUsingJmsReplyToHeaderTest extends ContextTestSupport {
public class InvokeRequestReplyUsingJmsReplyToHeaderTest extends CamelTestSupport {
private static final transient Logger LOG = LoggerFactory.getLogger(ActiveMQReplyToHeaderUsingConverterTest.class);
protected String replyQueueName = "queue://test.reply";
protected Object correlationID = "ABC-123";
protected Object groupID = "GROUP-XYZ";
private MyServer myBean = new MyServer();
@Test
public void testPerformRequestReplyOverJms() throws Exception {
MockEndpoint resultEndpoint = getMockEndpoint("mock:result");

View File

@ -18,14 +18,17 @@ package org.apache.activemq.camel.component;
import java.io.File;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Endpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
*
*/
public class JournalConfigureTest extends ContextTestSupport {
public class JournalConfigureTest extends CamelTestSupport {
@Test
public void testDefaltConfig() throws Exception {
JournalEndpoint endpoint = resolveMandatoryEndpoint("activemq.journal:target/test");
assertEquals("directory", new File("target", "test"), endpoint.getDirectory());
@ -33,6 +36,7 @@ public class JournalConfigureTest extends ContextTestSupport {
assertEquals("syncProduce", true, endpoint.isSyncProduce());
}
@Test
public void testConfigViaOptions() throws Exception {
JournalEndpoint endpoint = resolveMandatoryEndpoint("activemq.journal:target/test?syncConsume=true&syncProduce=false");
assertEquals("directory", new File("target", "test"), endpoint.getDirectory());

View File

@ -19,10 +19,11 @@ package org.apache.activemq.camel.component;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* Used to get an idea of what kind of performance can be expected from
@ -30,12 +31,13 @@ import org.apache.camel.builder.RouteBuilder;
*
*
*/
public class JournalRoutePerformance extends ContextTestSupport {
public class JournalRoutePerformance extends CamelTestSupport {
AtomicLong produceCounter = new AtomicLong();
AtomicLong consumeCounter = new AtomicLong();
AtomicBoolean running = new AtomicBoolean(true);
@Test
public void testPerformance() throws Exception {
int payLoadSize = 1024;

View File

@ -19,19 +19,19 @@ package org.apache.activemq.camel.component;
import java.util.List;
import org.apache.activemq.util.ByteSequence;
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.AssertionClause;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
*
*/
public class JournalRouteTest extends ContextTestSupport {
public class JournalRouteTest extends CamelTestSupport {
@Test
public void testSimpleJournalRoute() throws Exception {
byte[] payload = "Hello World".getBytes();

View File

@ -21,16 +21,18 @@ import javax.jms.MessageListener;
import javax.jms.Message;
import javax.jms.TextMessage;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
*
*/
public class InvokeJmsMessageListenerTest extends ContextTestSupport {
public class InvokeJmsMessageListenerTest extends CamelTestSupport {
protected MyMessageListener messageListener = new MyMessageListener();
private String expectedBody = "<hello>world!</hello>";
@Test
public void testCamelInvokesMessageListener() throws Exception {
template.sendBody("direct:start", expectedBody);

View File

@ -24,17 +24,20 @@ import javax.jms.TextMessage;
import static org.apache.activemq.camel.component.ActiveMQComponent.activeMQComponent;
import org.apache.activemq.spring.ConsumerBean;
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
*
*/
public class InvokeMessageListenerTest extends ContextTestSupport { protected MockEndpoint resultEndpoint;
public class InvokeMessageListenerTest extends CamelTestSupport {
protected MockEndpoint resultEndpoint;
protected String startEndpointUri = "activemq:queue:test.a";
protected ConsumerBean listener = new ConsumerBean();
@Test
public void testSendTextMessage() throws Exception {
String expectedBody = "Hello there!";

View File

@ -107,7 +107,7 @@
VALUES('${in.header.JMSMessageId}','${in.header.JMSCorrelationId}','${in.body}')
</simple>
</setBody>
<to uri="jdbc:managedDataSourceWithRecovery"/>
<to uri="jdbc:managedDataSourceWithRecovery?resetAutoCommit=false"/>
</route>
</camelContext>

View File

@ -45,7 +45,7 @@
<aries-version>0.2-incubating</aries-version>
<axion-version>1.0-M3-dev</axion-version>
<axis-version>1.2-RC1</axis-version>
<camel-version>2.7.0</camel-version>
<camel-version>2.8.0</camel-version>
<cglib-version>2.0</cglib-version>
<commons-beanutils-version>1.6.1</commons-beanutils-version>
<commons-collections-version>3.2.1</commons-collections-version>
@ -427,6 +427,11 @@
<artifactId>camel-jms</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-web</artifactId>