SMXCOMP-975: Upgrade to Camel 2.12.1
git-svn-id: https://svn.apache.org/repos/asf/servicemix/components/trunk@1533436 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/engines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiComponent.java b/engines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiComponent.java
index 246c37b..c4d5cc2 100644
--- a/engines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiComponent.java
+++ b/engines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiComponent.java
@@ -22,7 +22,8 @@
import org.apache.camel.*;
import org.apache.camel.impl.DefaultComponent;
-import org.apache.camel.processor.UnitOfWorkProcessor;
+import org.apache.camel.processor.UnitOfWorkProducer;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
import org.apache.servicemix.common.util.URIResolver;
import org.apache.servicemix.id.IdGenerator;
@@ -166,7 +167,7 @@
protected AsyncProcessor createCamelProcessor(Endpoint camelEndpoint) {
AsyncProcessor processor = null;
try {
- processor = new UnitOfWorkProcessor(camelEndpoint.createProducer());
+ processor = AsyncProcessorConverterHelper.convert(new UnitOfWorkProducer(camelEndpoint.createProducer()));
} catch (Exception e) {
throw new FailedToCreateProducerException(camelEndpoint, e);
}
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/AsyncJbiMessagingTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/AsyncJbiMessagingTest.java
index 23583d2..734c0a4 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/AsyncJbiMessagingTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/AsyncJbiMessagingTest.java
@@ -23,6 +23,7 @@
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.container.JBIContainer;
import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.junit.Test;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.InOnly;
@@ -37,6 +38,7 @@
private static final String MESSAGE = "<just><a>test</a></just>";
+ @Test
public void testNoSyncMessagingDeadlock() throws Exception {
ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
InOnly exchange = client.createInOnlyExchange();
@@ -47,6 +49,7 @@
ExchangeStatus.DONE, exchange.getStatus());
}
+ @Test
public void testCallbackExchangesEmptyOnError() throws Exception {
// disable the exchange completed listener as it is unable to detect failed exchanges
disableExchangeCompletedListener();
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/CamelConcurrentProducerCreationTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/CamelConcurrentProducerCreationTest.java
index 6839ffc..efa0e9e 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/CamelConcurrentProducerCreationTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/CamelConcurrentProducerCreationTest.java
@@ -32,6 +32,7 @@
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.container.JBIContainer;
import org.apache.servicemix.tck.mock.MockMessageExchange;
+import org.junit.Test;
/**
* Test cases to ensure multiple threads can safely create an use the {@link org.apache.camel.Producer}
@@ -41,6 +42,7 @@
private static final int COUNT = 1000;
+ @Test
public void testConcurrentlyCreateProducers() throws Exception {
final MockEndpoint mock = getMockEndpoint("mock:test");
mock.setResultWaitTime(60000);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/CamelConsumerEndpointTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/CamelConsumerEndpointTest.java
index 4956eea..68a3d45 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/CamelConsumerEndpointTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/CamelConsumerEndpointTest.java
@@ -22,12 +22,14 @@
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.container.JBIContainer;
import org.apache.servicemix.tck.mock.MockMessageExchange;
+import org.junit.Test;
/**
* Test cases for {@link CamelConsumerEndpoint}
*/
public class CamelConsumerEndpointTest extends JbiTestSupport {
-
+
+ @Test
public void testInvalidMessageExchangeDoesNotThrowException() throws Exception {
// sending a message to start the producers and create the external endpoint
client.sendBody("direct:a", "<hello>world</hello>");
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiCamelAttachmentTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiCamelAttachmentTest.java
index f0e3f41..617fdec 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiCamelAttachmentTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiCamelAttachmentTest.java
@@ -32,6 +32,7 @@
import org.apache.camel.impl.DefaultExchange;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.junit.Test;
/**
* Tests for attachment handling by servicemix-camel JBI component
@@ -41,6 +42,7 @@
private static final String ATTACHMENT_ID = "attach1";
private static final File TEST_FILE = new File("src/test/resources/attachment.png");
+ @Test
public void testPreserveAttachments() throws Exception {
Exchange exchange = new DefaultExchange(camelContext);
DataHandler attachment = new DataHandler(new FileDataSource(TEST_FILE));
@@ -61,7 +63,8 @@
fail("Expected a FileDataSource, but received a " + received.getIn().getAttachment(ATTACHMENT_ID).getDataSource().getClass());
}
}
-
+
+ @Test
public void testGetAttachmentsFromCamelProcessor() throws Exception {
InOut inout = getServicemixClient().createInOutExchange();
inout.setService(new QName("urn:test", "inout-service"));
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiCamelExceptionsTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiCamelExceptionsTest.java
index 1dbeb86..bad4d55 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiCamelExceptionsTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiCamelExceptionsTest.java
@@ -25,12 +25,14 @@
import org.apache.camel.StringSource;
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.ServiceMixClient;
+import org.junit.Test;
/**
* Tests on conveying a simple exception thrown by a bean in the camel route
*/
public class JbiCamelExceptionsTest extends JbiCamelErrorHandlingTestSupport {
+ @Test
public void testInOnlyConveysException() throws Exception {
ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
InOnly exchange = client.createInOnlyExchange();
@@ -42,6 +44,7 @@
assertTrue("A NullPointerException was expected", exchange.getError() instanceof NullPointerException);
}
+ @Test
public void testInOutHandlingBusinessException() throws Exception {
ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
InOut exchange = client.createInOutExchange();
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiConvertExceptionsTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiConvertExceptionsTest.java
index 3cd14e2..8f2d6dd 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiConvertExceptionsTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiConvertExceptionsTest.java
@@ -27,6 +27,7 @@
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.exception.FaultException;
+import org.junit.Test;
/**
* Test the convertExceptions=true flag (converts all exceptions to JBI FaultExceptions)
@@ -35,6 +36,7 @@
private static final String EXCEPTION = "This has completely gone wrong at runtime!";
+ @Test
public void testInOnlyConvertExceptions() throws Exception {
ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
InOut exchange = client.createInOutExchange();
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiDlcForCamelRouteTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiDlcForCamelRouteTest.java
index 4923298..ebd90f9 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiDlcForCamelRouteTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiDlcForCamelRouteTest.java
@@ -29,6 +29,7 @@
import org.apache.camel.StringSource;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.tck.ReceiverComponent;
+import org.junit.Test;
/**
* Tests on a JBI DLC endpoint handling an error in the Camel route
@@ -37,6 +38,7 @@
private static final String MESSAGE = "<just><a>test</a></just>";
+ @Test
public void testErrorHandlingByJbiEndpointInCamelRoute() throws Exception {
InOnly exchange = getServicemixClient().createInOnlyExchange();
exchange.setService(new QName("urn:test", "exception"));
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiDynamicRecipientListTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiDynamicRecipientListTest.java
index 64f0f48..b390c66 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiDynamicRecipientListTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiDynamicRecipientListTest.java
@@ -30,12 +30,14 @@
import org.apache.camel.util.jndi.JndiContext;
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.ServiceMixClient;
+import org.junit.Test;
/**
* Tests on using the Dynamic Recipient List pattern inside servicemix-camel
*/
public class JbiDynamicRecipientListTest extends JbiCamelErrorHandlingTestSupport {
+ @Test
public void testInOnlyDynamicRecipientListException() throws Exception {
MockEndpoint a = getMockEndpoint("mock:a");
a.expectedMessageCount(1);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointAvailableInRouteTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointAvailableInRouteTest.java
index f573f56..75cab3e 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointAvailableInRouteTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointAvailableInRouteTest.java
@@ -26,12 +26,14 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.junit.Test;
/**
* Tests to ensure that the Exchange.getFromEndpoint() call returns the originating Camel endpoint
*/
public class JbiEndpointAvailableInRouteTest extends JbiTestSupport {
+ @Test
public void testSendExchange() throws Exception {
InOnly exchange = getServicemixClient().createInOnlyExchange();
exchange.setService(new QName("urn:test", "service"));
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointWithMepSpecifiedTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointWithMepSpecifiedTest.java
index 3614635..72b22b6 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointWithMepSpecifiedTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointWithMepSpecifiedTest.java
@@ -28,6 +28,7 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.tck.ReceiverComponent;
+import org.junit.Test;
/**
* Tests to check correct handling of the ?mep=xxx setting on a Camel JBI endpoint
@@ -37,11 +38,12 @@
private MyReceiverComponent component;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
component = new MyReceiverComponent();
super.setUp();
}
-
+
+ @Test
public void testCamelInOutSendJbiInOnly() throws Exception {
client.request("direct:a", new Processor() {
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiExchangePropertiesPreservationTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiExchangePropertiesPreservationTest.java
index 4e03e1b..f7b10e1 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiExchangePropertiesPreservationTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiExchangePropertiesPreservationTest.java
@@ -25,6 +25,7 @@
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.junit.Test;
import javax.jbi.JBIException;
import javax.jbi.messaging.InOnly;
@@ -42,6 +43,7 @@
private static final Object NEW_VALUE = "newvalue";
private static final String MESSAGE = "<just><a>test</a></just>";
+ @Test
public void testPropertyPreservation() throws JBIException, InterruptedException {
MockEndpoint output = getMockEndpoint("mock:output");
output.expectedMessageCount(1);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyAsyncCamelTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyAsyncCamelTest.java
index 2f2bc08..80224aa 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyAsyncCamelTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyAsyncCamelTest.java
@@ -28,6 +28,7 @@
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.junit.Test;
/**
* Tests on handling JBI InOnly exchanges by Camel
@@ -36,6 +37,7 @@
private static final String MESSAGE = "<just><a>test</a></just>";
+ @Test
public void testInOnlyExchangeThroughAsyncRoute() throws Exception {
// first remove the ExchangeListener -- it will not be notified of the undeliverable MessageExchange
jbiContainer.removeListener(exchangeCompletedListener);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyCamelErrorHandlingTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyCamelErrorHandlingTest.java
index 626e9bc..36417e7 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyCamelErrorHandlingTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyCamelErrorHandlingTest.java
@@ -29,6 +29,7 @@
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.exception.FaultException;
+import org.junit.Test;
/**
* Tests on handling fault messages with the Camel Exception handler
@@ -36,7 +37,8 @@
public class JbiInOnlyCamelErrorHandlingTest extends JbiCamelErrorHandlingTestSupport {
private static final String MESSAGE = "<just><a>test</a></just>";
-
+
+ @Test
public void testInOnlyWithNoHandleFault() throws Exception {
MockEndpoint errors = getMockEndpoint("mock:errors");
errors.expectedMessageCount(1);
@@ -56,6 +58,7 @@
errors.assertIsSatisfied();
}
+ @Test
public void testRobustInOnlyWithNoHandleFault() throws Exception {
MockEndpoint errors = getMockEndpoint("mock:errors");
errors.expectedMessageCount(0);
@@ -173,8 +176,8 @@
public void configure() throws Exception {
onException(IllegalStateException.class).handled(false).to("jbi:service:urn:test:receiver-service");
onException(NullPointerException.class).handled(true).to("jbi:service:urn:test:receiver-service");
- onException().handled(false);
- errorHandler(deadLetterChannel("mock:errors").maximumRedeliveries(1).maximumRedeliveryDelay(300));
+ onException().to("mock:errors").handled(false);
+ //errorHandler(deadLetterChannel("mock:errors").maximumRedeliveries(1).maximumRedeliveryDelay(300));
from("jbi:service:urn:test:no-handle-fault").to("jbi:service:urn:test:faulty-service");
from("jbi:service:urn:test:handle-fault").handleFault().to("jbi:service:urn:test:faulty-service");
from("jbi:service:urn:test:error-not-handled").to("jbi:service:urn:test:iae-error-service");
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyPropertiesPipelineTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyPropertiesPipelineTest.java
index 6525f12..f3ff411 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyPropertiesPipelineTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyPropertiesPipelineTest.java
@@ -31,6 +31,7 @@
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.junit.Test;
/**
* Test to make sure that a Camel Pipeline is capable of preserving JBI headers
@@ -40,8 +41,9 @@
private static final String MESSAGE = "<just><a>test</a></just>";
private static final String HEADER_ORIGINAL = "original";
- private static final String HEADER_TRANSFORMER = "transformer";
+ private static final String HEADER_TRANSFORMER = "transformer";
+ @Test
public void testPipelinePreservesMessageHeaders() throws Exception {
MockEndpoint output = getMockEndpoint("mock:output");
output.expectedBodiesReceived(MESSAGE);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlySecuritySubjectTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlySecuritySubjectTest.java
index 0a88f59..4e0e622 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlySecuritySubjectTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlySecuritySubjectTest.java
@@ -32,6 +32,7 @@
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.tck.ReceiverComponent;
+import org.junit.Test;
/**
* Tests on handling JBI InOnly exchanges by Camel
@@ -40,6 +41,7 @@
private static final String MESSAGE = "<just><a>test</a></just>";
+ @Test
public void testSecuritySubjectConveyedThroughCamelRoute() throws Exception {
MockEndpoint done = getMockEndpoint("mock:done");
done.expectedMessageCount(1);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyTest.java
index 923ad0c..7ab7e46 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyTest.java
@@ -32,6 +32,7 @@
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.junit.Test;
/**
* Tests on handling JBI InOnly exchanges by Camel
@@ -41,6 +42,7 @@
private static final String MESSAGE = "<just><a>test</a></just>";
private static final int COUNT = 50;
+ @Test
public void testInOnlyExchangeConvertBody() throws Exception {
MockEndpoint done = getMockEndpoint("mock:done");
done.expectedBodiesReceived(MESSAGE);
@@ -54,7 +56,8 @@
assertEquals(ExchangeStatus.DONE, exchange.getStatus());
done.assertIsSatisfied();
}
-
+
+ @Test
public void testInOnlyExchangeForwardAndConvertBody() throws Exception {
MockEndpoint done = getMockEndpoint("mock:done");
done.expectedBodiesReceived(MESSAGE);
@@ -68,6 +71,7 @@
done.assertIsSatisfied();
}
+ @Test
public void testInOnlyWithException() throws Exception {
ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
InOnly exchange = client.createInOnlyExchange();
@@ -77,6 +81,7 @@
assertEquals(ExchangeStatus.ERROR, exchange.getStatus());
}
+ @Test
public void testInOutWithException() throws Exception {
ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
InOut exchange = client.createInOutExchange();
@@ -85,7 +90,8 @@
client.sendSync(exchange);
assertEquals(ExchangeStatus.ERROR, exchange.getStatus());
}
-
+
+ @Test
public void testInOnlyToAggregator() throws Exception {
ServiceMixClient smxClient = getServicemixClient();
getMockEndpoint("mock:aggregated").expectedMessageCount(1);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyToCamelObjectTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyToCamelObjectTest.java
index d925686..6a0d5e4 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyToCamelObjectTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyToCamelObjectTest.java
@@ -29,6 +29,7 @@
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.junit.Test;
/**
* Tests on handling JBI InOnly exchanges by Camel
@@ -38,6 +39,7 @@
private static final String MESSAGE = "<just><a>test</a></just>";
+ @Test
public void testInOnlyExchangeConvertBody() throws Exception {
MockEndpoint done = getMockEndpoint("mock:done");
done.expectedBodiesReceived(new MessageContainer(MESSAGE));
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyWithErrorHandledTrueSpringDSLTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyWithErrorHandledTrueSpringDSLTest.java
index 9e78b0a..7edfd02 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyWithErrorHandledTrueSpringDSLTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyWithErrorHandledTrueSpringDSLTest.java
@@ -37,6 +37,7 @@
import org.apache.servicemix.jbi.helper.MessageUtil;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.tck.ReceiverComponent;
+import org.junit.Test;
import org.springframework.util.Assert;
/**
@@ -52,7 +53,7 @@
private ReceiverComponent deadLetter;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
receiver = new ReceiverComponent() {
public void onMessageExchange(MessageExchange exchange) throws MessagingException {
NormalizedMessage inMessage = getInMessage(exchange);
@@ -77,13 +78,14 @@
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
super.tearDown();
// restore the original log level
Logger.getLogger("org.apache.servicemix").setLevel(LOG_LEVEL);
}
-
+
+ @Test
public void testErrorHandledByExceptionClause() throws Exception {
ServiceMixClient smxClient = getServicemixClient();
MessageExchange[] exchanges = new MessageExchange[] {smxClient.createInOnlyExchange(), smxClient.createRobustInOnlyExchange()};
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyWithFaultHandledTrueSpringDSLTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyWithFaultHandledTrueSpringDSLTest.java
index 68a7424..f41b2d6 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyWithFaultHandledTrueSpringDSLTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOnlyWithFaultHandledTrueSpringDSLTest.java
@@ -40,6 +40,7 @@
import org.apache.servicemix.jbi.helper.MessageUtil;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.tck.ReceiverComponent;
+import org.junit.Test;
import org.springframework.util.Assert;
/**
@@ -55,7 +56,7 @@
private ReceiverComponent deadLetter;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
receiver = new ReceiverComponent() {
public void onMessageExchange(MessageExchange exchange) throws MessagingException {
NormalizedMessage inMessage = getInMessage(exchange);
@@ -80,13 +81,14 @@
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
super.tearDown();
// restore the original log level
Logger.getLogger("org.apache.servicemix").setLevel(LOG_LEVEL);
}
-
+
+ @Test
public void testInOnlyWithFaultHandledByExceptionClause() throws Exception {
ServiceMixClient smxClient = getServicemixClient();
InOnly exchange = smxClient.createInOnlyExchange();
@@ -104,6 +106,7 @@
receiver.getMessageList().assertMessagesReceived(1);
}
+ @Test
public void testRobustInOnlyWithFaultHandledByExceptionClause() throws Exception {
ServiceMixClient smxClient = getServicemixClient();
RobustInOnly exchange = smxClient.createRobustInOnlyExchange();
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOptionalOutCamelTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOptionalOutCamelTest.java
index 05e73a6..2e0b14e 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOptionalOutCamelTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOptionalOutCamelTest.java
@@ -26,12 +26,14 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.StringSource;
import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.junit.Test;
/**
* Tests on handling JBI InOnly exchanges by Camel
*/
public class JbiInOptionalOutCamelTest extends JbiTestSupport {
-
+
+ @Test
public void testInOptionalOutFromCamelEndpoint() throws Exception {
MockEndpoint inonly = getMockEndpoint("mock:in-optional-out");
inonly.expectedMessageCount(1);
@@ -42,7 +44,8 @@
// let's wait for a moment to ensure that all pending Exchanges are handled
Thread.sleep(500);
}
-
+
+ @Test
public void testInOptionalOutFromJbiWithDone() throws Exception {
MockEndpoint inonly = getMockEndpoint("mock:in-optional-out");
inonly.expectedMessageCount(1);
@@ -58,7 +61,8 @@
getServicemixClient().done(exchange);
Thread.sleep(500);
}
-
+
+ @Test
public void testInOptionalOutFromJbiWithFault() throws Exception {
MockEndpoint inonly = getMockEndpoint("mock:in-optional-out");
inonly.expectedMessageCount(1);
@@ -76,7 +80,8 @@
getServicemixClient().sendSync(exchange);
assertEquals(ExchangeStatus.DONE, exchange.getStatus());
}
-
+
+ @Test
public void testInOptionalOutFromJbiWithError() throws Exception {
MockEndpoint inonly = getMockEndpoint("mock:in-optional-out");
inonly.expectedMessageCount(1);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutCamelErrorHandlingTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutCamelErrorHandlingTest.java
index 8d84947..d966b96 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutCamelErrorHandlingTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutCamelErrorHandlingTest.java
@@ -29,6 +29,7 @@
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.exception.FaultException;
+import org.junit.Test;
/**
* Tests on handling fault messages with the Camel Exception handler
@@ -37,6 +38,7 @@
private static final String MESSAGE = "<just><a>test</a></just>";
+ @Test
public void testInOutWithNoHandleFault() throws Exception {
MockEndpoint errors = getMockEndpoint("mock:errors");
errors.expectedMessageCount(0);
@@ -56,6 +58,7 @@
Thread.sleep(500);
}
+ @Test
public void testInOutWithHandleFault() throws Exception {
MockEndpoint errors = getMockEndpoint("mock:errors");
errors.expectedMessageCount(0);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutCamelJMSFlowExceptionHandledTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutCamelJMSFlowExceptionHandledTest.java
new file mode 100644
index 0000000..fbc8e31
--- /dev/null
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutCamelJMSFlowExceptionHandledTest.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.camel;
+
+import org.apache.camel.CamelException;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.StringSource;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.servicemix.client.DefaultServiceMixClient;
+import org.apache.servicemix.client.ServiceMixClient;
+import org.apache.servicemix.jbi.exception.FaultException;
+import org.junit.Test;
+
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOut;
+import javax.xml.namespace.QName;
+
+/**
+ * Test to ensure possibility of conveying exceptions over the JMS/JCA flow with convertException=true
+ */
+public class JbiInOutCamelJMSFlowExceptionHandledTest extends JbiCamelErrorHandlingTestSupport {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ // make sure all exchanges in the ESB are serializable (e.g. for use with JMS/JCA flow)
+ enableCheckForSerializableExchanges();
+ }
+
+ @Test
+ public void testInOutWithErrorHandledTrue() throws Exception {
+ MockEndpoint errors = getMockEndpoint("mock:errors");
+ errors.expectedMessageCount(1);
+
+ ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
+ InOut exchange = client.createInOutExchange();
+ exchange.setService(new QName("urn:test", "error-handled-true"));
+ exchange.getInMessage().setContent(new StringSource(MESSAGE));
+ client.sendSync(exchange);
+ assertEquals(ExchangeStatus.ACTIVE, exchange.getStatus());
+ client.done(exchange);
+
+ errors.assertIsSatisfied();
+
+ // let's wait a moment to make sure that the last DONE MessageExchange is handled
+ Thread.sleep(500);
+ }
+
+ @Override
+ protected RouteBuilder createRoutes() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ onException(CamelException.class).handled(true).to("mock:errors");
+
+ from("jbi:service:urn:test:error-handled-true")
+ .process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ throw new CamelException();
+ }
+ })
+ .setBody(constant("<msg>Done</msg>"));
+ }
+ };
+ }
+}
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutCamelJMSFlowExceptionTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutCamelJMSFlowExceptionTest.java
index 492f811..2536974 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutCamelJMSFlowExceptionTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutCamelJMSFlowExceptionTest.java
@@ -29,6 +29,8 @@
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.exception.FaultException;
+import org.junit.Ignore;
+import org.junit.Test;
/**
* Test to ensure possibility of conveying exceptions over the JMS/JCA flow with convertException=true
@@ -36,13 +38,14 @@
public class JbiInOutCamelJMSFlowExceptionTest extends JbiCamelErrorHandlingTestSupport {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
// make sure all exchanges in the ESB are serializable (e.g. for use with JMS/JCA flow)
enableCheckForSerializableExchanges();
}
-
+
+ @Test
public void testInOutWithConvertExceptionsEnabled() throws Exception {
MockEndpoint errors = getMockEndpoint("mock:errors");
errors.expectedMessageCount(1);
@@ -61,42 +64,16 @@
errors.assertIsSatisfied();
}
-
- public void testInOutWithErrorHandledTrue() throws Exception {
- MockEndpoint errors = getMockEndpoint("mock:errors");
- errors.expectedMessageCount(1);
-
- ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
- InOut exchange = client.createInOutExchange();
- exchange.setService(new QName("urn:test", "error-handled-true"));
- exchange.getInMessage().setContent(new StringSource(MESSAGE));
- client.sendSync(exchange);
- assertEquals(ExchangeStatus.ACTIVE, exchange.getStatus());
- client.done(exchange);
-
- errors.assertIsSatisfied();
-
- // let's wait a moment to make sure that the last DONE MessageExchange is handled
- Thread.sleep(500);
- }
@Override
protected RouteBuilder createRoutes() {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- onException(org.apache.camel.processor.validation.SchemaValidationException.class).handled(false);
- onException(org.apache.camel.CamelException.class).handled(true);
- errorHandler(deadLetterChannel("mock:errors").maximumRedeliveries(1).maximumRedeliveryDelay(300));
+ onException(org.apache.camel.processor.validation.SchemaValidationException.class).to("mock:errors").handled(false);
+
from("jbi:service:urn:test:error-not-handled?convertExceptions=true")
.to("validator:org/apache/servicemix/camel/simple.xsd");
- from("jbi:service:urn:test:error-handled-true")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- throw new CamelException();
- }
- })
- .setBody(constant("<msg>Done</msg>"));
}
};
}
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutPipelineTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutPipelineTest.java
index 53b457d..6ece243 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutPipelineTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutPipelineTest.java
@@ -37,6 +37,7 @@
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.junit.Test;
/**
@@ -50,6 +51,7 @@
private MyHeaderFilterStrategy myFilterStrategy = new MyHeaderFilterStrategy();
+ @Test
public void testPipelineWithMessageHeadersAndAttachements() throws Exception {
ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
InOut exchange = client.createInOutExchange();
@@ -72,6 +74,7 @@
Thread.sleep(1000);
}
+ @Test
public void testPipelineWithMessageProviderHeaderFiltering() throws Exception {
ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
InOut exchange = client.createInOutExchange();
@@ -89,6 +92,7 @@
Thread.sleep(1000);
}
+ @Test
public void testPipelineWithMessageConsumerHeaderFiltering() throws Exception {
ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutWithPojoTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutWithPojoTest.java
index cec24c3..1d05be2 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutWithPojoTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutWithPojoTest.java
@@ -27,6 +27,7 @@
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.junit.Test;
/**
* Tests on handling JBI InOut exchanges by Camel when they return a non-Source payload
@@ -34,7 +35,8 @@
public class JbiInOutWithPojoTest extends JbiTestSupport {
private static final String MESSAGE = "<just><a>test</a></just>";
-
+
+ @Test
public void testInOutWithCamelReturningPojoPayload() throws Exception {
ServiceMixClient client = new DefaultServiceMixClient(jbiContainer);
InOut exchange = client.createInOutExchange();
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiNoCheckSerializationTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiNoCheckSerializationTest.java
index 7c39fe2..7ebb5f8 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiNoCheckSerializationTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiNoCheckSerializationTest.java
@@ -31,6 +31,7 @@
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.junit.Test;
/**
* <p>
@@ -45,7 +46,8 @@
private static final String SERIALIZABLE_KEY = "serializable";
private static final String INVALID_SERIALIZABLE_KEY = "invalid.serializable";
private static final String NON_SERIALIZABLE_KEY = "non.serializable";
-
+
+ @Test
public void testInOutWithNoCheckSerialization() throws Exception {
MockEndpoint errors = getMockEndpoint("mock:errors");
errors.expectedMessageCount(1);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiOperationCamelTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiOperationCamelTest.java
index f674a43..c839f42 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiOperationCamelTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiOperationCamelTest.java
@@ -27,6 +27,7 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.StringSource;
import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.junit.Test;
/**
* Tests on handling JBI InOnly exchanges by Camel
@@ -34,7 +35,8 @@
public class JbiOperationCamelTest extends JbiTestSupport {
private static final QName OPERATION = new QName("urn:test", "doit");
-
+
+ @Test
public void testInOnlySetOperationOnCamelEndpoint() throws Exception {
MockEndpoint inonly = getMockEndpoint("mock:in-only");
inonly.expectedMessageCount(1);
@@ -48,7 +50,8 @@
String str2 = URLDecoder.decode(JbiBinding.getOperation(exchange).toString(), "UTF-8");
assertEquals(str1, str2);
}
-
+
+ @Test
public void testInOnlySetOperationOnCamelExchange() throws Exception {
MockEndpoint inonly = getMockEndpoint("mock:in-only");
inonly.expectedMessageCount(1);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiProducerTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiProducerTest.java
index 083e1bf..b19af19 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiProducerTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiProducerTest.java
@@ -22,6 +22,7 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.junit.Test;
/**
* Test for {@link JbiEndpoint.JbiProducer}
@@ -31,6 +32,7 @@
/*
* Ensure that no exceptions get thrown when shutting down the routes
*/
+ @Test
public void testShutdown() throws Exception {
client.stop();
try {
@@ -41,7 +43,7 @@
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
// testing shutdown, so will do this manually
}
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiSerializableMessageExchangeTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiSerializableMessageExchangeTest.java
index 7651daf..e7be8f4 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiSerializableMessageExchangeTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiSerializableMessageExchangeTest.java
@@ -29,6 +29,7 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.tck.ReceiverComponent;
+import org.junit.Test;
/**
* Tests on handling JBI InOnly exchanges by Camel
@@ -37,6 +38,7 @@
private static final String MESSAGE = "<just><a>test</a></just>";
+ @Test
public void testInOnlyExchangeConvertBody() throws Exception {
MockEndpoint done = getMockEndpoint("mock:done");
done.expectedBodiesReceived(MESSAGE);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiStrangeNamespaceHandlingTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiStrangeNamespaceHandlingTest.java
index 86b6602..2b9cc69 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiStrangeNamespaceHandlingTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiStrangeNamespaceHandlingTest.java
@@ -29,6 +29,7 @@
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.jaxp.StringSource;
import org.apache.servicemix.tck.ReceiverComponent;
+import org.junit.Test;
/**
* Tests on sending JBI InOut and InOnly exchanges from within a Camel route to
@@ -38,6 +39,7 @@
private static final String MESSAGE = "<just><a>test</a></just>";
+ @Test
public void testInOutWithStrangeNamespace() throws Exception {
MockEndpoint inout = getMockEndpoint("mock:in-out");
inout.expectedMessageCount(1);
@@ -56,7 +58,8 @@
// let's wait a moment to make sure that the last DONE MessageExchange is handled
Thread.sleep(1000);
}
-
+
+ @Test
public void testInOnlyWithStrangeNamespace() throws Exception {
MockEndpoint inonly = getMockEndpoint("mock:in-only");
inonly.expectedMessageCount(1);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiStrictSerializationTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiStrictSerializationTest.java
index df4a696..eeeecdc 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiStrictSerializationTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiStrictSerializationTest.java
@@ -30,6 +30,7 @@
import org.apache.servicemix.camel.test.InvalidSerializableObject;
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.ServiceMixClient;
+import org.junit.Test;
/**
* Testcase for strictSerialization=true (removes all non-serializable headers, even those that incorrectly
@@ -41,6 +42,7 @@
private static final String INVALID_SERIALIZABLE_KEY = "invalid.serializable";
private static final String NON_SERIALIZABLE_KEY = "non.serializable";
+ @Test
public void testInOutWithStrictSerialization() throws Exception {
MockEndpoint errors = getMockEndpoint("mock:errors");
errors.expectedMessageCount(1);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java
index d3df3c8..0dbfe77 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java
@@ -22,6 +22,7 @@
import java.io.ObjectOutputStream;
import java.lang.reflect.Field;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -39,6 +40,7 @@
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.spi.Synchronization;
import org.apache.camel.test.TestSupport;
+import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.common.Registry;
@@ -52,7 +54,7 @@
/**
* @version $Revision: 563665 $
*/
-public abstract class JbiTestSupport extends TestSupport {
+public abstract class JbiTestSupport extends CamelTestSupport {
protected Exchange receivedExchange;
@@ -127,7 +129,7 @@
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
if (camelContext == null) {
camelContext = createCamelContext();
client = camelContext.createProducerTemplate();
@@ -195,7 +197,7 @@
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
exchangeCompletedListener.assertExchangeCompleted();
getServicemixClient().close();
@@ -259,7 +261,8 @@
// little hack to access the endpoints map in the registry directly
Field field = Registry.class.getDeclaredField("endpoints");
field.setAccessible(true);
- Map<String, org.apache.servicemix.common.Endpoint> endpoints = (Map) field.get(component.getRegistry());
+ Map<String, org.apache.servicemix.common.Endpoint> endpoints = new HashMap();
+ endpoints.putAll((Map) field.get(component.getRegistry()));
for (org.apache.servicemix.common.Endpoint endpoint : endpoints.values()) {
if (type.isAssignableFrom(endpoint.getClass())) {
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiToCamelCbrTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiToCamelCbrTest.java
index b07379c..b9f0fcb 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiToCamelCbrTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiToCamelCbrTest.java
@@ -33,6 +33,7 @@
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.junit.Test;
/**
* Tests on correct handling of several XML Source implementations being sent by ServiceMix to Camel
@@ -45,7 +46,7 @@
private Level level;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
// let's disable DEBUG logging for ServiceMix or all message content will be DOMSource anyway
if (level == null) {
@@ -55,7 +56,7 @@
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
super.tearDown();
// restore the original log level
if (level != null) {
@@ -64,16 +65,19 @@
}
}
+ @Test
public void testCbrWithStringSource() throws Exception {
doTestCbr(new StringSource(MESSAGE_IN_FRENCH),
new StringSource(MESSAGE_IN_ENGLISH));
}
-
+
+ @Test
public void testCbrWithStreamSource() throws Exception {
doTestCbr(new StreamSource(new StringReader(MESSAGE_IN_FRENCH)),
new StreamSource(new StringReader(MESSAGE_IN_ENGLISH)));
}
-
+
+ @Test
public void testCbrWithDomSource() throws Exception {
doTestCbr(transformer.toDOMSource(new StringSource(MESSAGE_IN_FRENCH)),
transformer.toDOMSource(new StringSource(MESSAGE_IN_ENGLISH)));
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiToCamelStreamSourceTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiToCamelStreamSourceTest.java
index f9303db..d1ef6a8 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiToCamelStreamSourceTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiToCamelStreamSourceTest.java
@@ -33,6 +33,7 @@
import org.apache.servicemix.components.util.TransformComponentSupport;
import org.apache.servicemix.jbi.api.ServiceMixClient;
import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.junit.Test;
/**
* Tests for handling StreamSource sent by JBI to Camel
@@ -44,7 +45,7 @@
private static final Level LOG_LEVEL = Logger.getLogger("org.apache.servicemix").getEffectiveLevel();
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
// change the log level to avoid the conversion to DOMSource
@@ -52,13 +53,14 @@
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
super.tearDown();
// restore the original log level
Logger.getLogger("org.apache.servicemix").setLevel(LOG_LEVEL);
}
-
+
+ @Test
public void testSendingStreamSource() throws Exception {
MockEndpoint result = getMockEndpoint("mock:result");
result.expectedBodiesReceived(MESSAGE);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTryCatchExceptionTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTryCatchExceptionTest.java
index b241171..6c5c655 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTryCatchExceptionTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTryCatchExceptionTest.java
@@ -19,6 +19,7 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.junit.Test;
import java.util.List;
@@ -29,6 +30,7 @@
private static final String MESSAGE = "<just><a>test</a></just>";
+ @Test
public void testInOnlyExchangeConvertBody() throws Exception {
MockEndpoint caught = getMockEndpoint("mock:caught");
caught.expectedMessageCount(1);
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/MinaEndpointSpringDSLTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/MinaEndpointSpringDSLTest.java
index 8eef881..d75b6a1 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/MinaEndpointSpringDSLTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/MinaEndpointSpringDSLTest.java
@@ -19,16 +19,18 @@
import java.util.List;
import junit.framework.Assert;
import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.junit.Test;
/**
* This tests whether camel-mina can be deployed in ServiceMix (see CAMEL-1146)
*/
public class MinaEndpointSpringDSLTest extends SpringJbiTestSupport {
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
}
+ @Test
public void test() throws Exception {
Assert.assertTrue(true);
}
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiAndBackToCamelTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiAndBackToCamelTest.java
index eebbb66..4e5dec6 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiAndBackToCamelTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiAndBackToCamelTest.java
@@ -28,6 +28,7 @@
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.resolver.URIResolver;
import org.apache.servicemix.tck.SenderComponent;
+import org.junit.Test;
/**
* @version $Revision: 563665 $
@@ -35,6 +36,7 @@
public class SendFromCamelToJbiAndBackToCamelTest extends JbiTestSupport {
protected SenderComponent senderComponent = new SenderComponent();
+ @Test
public void testCamelInvokingJbi() throws Exception {
senderComponent.sendMessages(1);
@@ -87,7 +89,7 @@
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
camelContext.stop();
}
}
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiTest.java
index 23c18f1..3e4b93b 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiTest.java
@@ -25,6 +25,7 @@
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.tck.MessageList;
import org.apache.servicemix.tck.ReceiverComponent;
+import org.junit.Test;
/**
* @version $Revision: 563665 $
@@ -33,6 +34,7 @@
private ReceiverComponent receiverComponent = new ReceiverComponent();
+ @Test
public void testCamelInvokingJbi() throws Exception {
sendExchangeAsync("<foo bar='123'/>");
MessageList list = receiverComponent.getMessageList();
@@ -69,7 +71,7 @@
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
camelContext.stop();
}
}
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
index 2f9b5af..84dc37b 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
@@ -25,6 +25,7 @@
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.tck.MessageList;
import org.apache.servicemix.tck.ReceiverComponent;
+import org.junit.Test;
/**
* @version $Revision: 563665 $
@@ -33,6 +34,7 @@
JbiTestSupport {
private ReceiverComponent receiverComponent = new ReceiverComponent();
+ @Test
public void testCamelInvokingJbi() throws Exception {
sendExchange("<foo bar='123'/>");
MessageList list = receiverComponent.getMessageList();
@@ -70,7 +72,7 @@
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
camelContext.stop();
}
}
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SpringJbiTestSupport.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SpringJbiTestSupport.java
index 1ec3cc2..21a3003 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SpringJbiTestSupport.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SpringJbiTestSupport.java
@@ -69,7 +69,7 @@
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
super.tearDown();
jbiContainer.stop();
jbiContainer.shutDown();
diff --git a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/TestCamelRouter.java b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/TestCamelRouter.java
index 80aa194..6a3e1a6 100644
--- a/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/TestCamelRouter.java
+++ b/engines/servicemix-camel/src/test/java/org/apache/servicemix/camel/TestCamelRouter.java
@@ -20,7 +20,7 @@
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.CamelTestSupport;
+import org.apache.camel.test.junit4.CamelTestSupport;
/**
* @version $Revision: 563665 $
@@ -64,7 +64,7 @@
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
a = resolveMandatoryEndpoint("mock:a", MockEndpoint.class);
b = resolveMandatoryEndpoint("mock:b", MockEndpoint.class);
diff --git a/pom.xml b/pom.xml
index de81589..667b9fc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,6 +69,7 @@
<servicemix.legal.version>1.0</servicemix.legal.version>
<servicemix.specs.version>2.2.0</servicemix.specs.version>
<servicemix-utils.version>1.6.0</servicemix-utils.version>
+
<servicemix.version>3.3.2</servicemix.version>
<!-- OSGi properties used by maven-bundle-plugin -->
@@ -85,7 +86,7 @@
<activemq.version>5.7.0</activemq.version>
<!-- Camel -->
- <camel.version>2.10.3</camel.version>
+ <camel.version>2.12.1</camel.version>
<!-- CXF -->
<cxf.version>2.6.4</cxf.version>