diff --git a/pom.xml b/pom.xml index 734c54d..31a620d 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,7 @@ UTF-8 2.18.1 1.7.22 + 1.2.1 21.0 1.10.19 1.8 @@ -49,6 +50,11 @@ + + ch.qos.logback + logback-classic + ${logback.classic} + org.apache.camel camel-testng diff --git a/src/test/java/org/apache/camel/component/dataprovider/DataProviderComponentMultithreadingTest.java b/src/test/java/org/apache/camel/component/dataprovider/DataProviderComponentMultithreadingTest.java new file mode 100644 index 0000000..3317aac --- /dev/null +++ b/src/test/java/org/apache/camel/component/dataprovider/DataProviderComponentMultithreadingTest.java @@ -0,0 +1,40 @@ +package org.apache.camel.component.dataprovider; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.impl.JndiRegistry; +import org.apache.camel.testng.CamelTestSupport; +import org.testng.annotations.Test; + +/** + * Test cases for corresponding class {@link DataProviderComponent}. + * + * @author Christian Ribeaud + */ +public class DataProviderComponentMultithreadingTest extends CamelTestSupport { + + @Test + public void testDataProvider() throws Exception { + MockEndpoint mock = getMockEndpoint("mock:result"); + // It will wait until it reaches the expected count + mock.expectedMessageCount(1000); + mock.assertIsSatisfied(); + } + + @Override + protected JndiRegistry createRegistry() throws Exception { + JndiRegistry registry = super.createRegistry(); + registry.bind("foo", new StaticDataProvider<>(DataProviderComponentTest.getRandomStrings(1000))); + return registry; + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + public void configure() { + from("dataprovider://foo?consumer.useFixedDelay=true&consumer.delay=20&consumer.maxMessagesPerPoll=20&initialDelay=20"). + to("mock:result"); + } + }; + } +} diff --git a/src/test/resources/log4j2.properties b/src/test/resources/log4j2.properties deleted file mode 100644 index df3daa5..0000000 --- a/src/test/resources/log4j2.properties +++ /dev/null @@ -1,6 +0,0 @@ -appender.out.type = Console -appender.out.name = out -appender.out.layout.type = PatternLayout -appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n -rootLogger.level = INFO -rootLogger.appenderRef.out.ref = out diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml new file mode 100644 index 0000000..f623577 --- /dev/null +++ b/src/test/resources/logback.xml @@ -0,0 +1,16 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file