Skip to content

Commit

Permalink
Add log configuration
Browse files Browse the repository at this point in the history
* Find out how to improve the performance.
  • Loading branch information
Christian Ribeaud committed Mar 10, 2017
1 parent a244f93 commit 9e39a0a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 6 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<camel.version>2.18.1</camel.version>
<slf4j.version>1.7.22</slf4j.version>
<logback.classic>1.2.1</logback.classic>
<guava.version>21.0</guava.version>
<mockito.version>1.10.19</mockito.version>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down Expand Up @@ -49,6 +50,11 @@
</dependency>

<!-- testing -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.classic}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-testng</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <a href="mailto:christian.ribeaud@novartis.com">Christian Ribeaud</a>
*/
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");
}
};
}
}
6 changes: 0 additions & 6 deletions src/test/resources/log4j2.properties

This file was deleted.

16 changes: 16 additions & 0 deletions src/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.apache.camel.component.dataprovider" level="DEBUG"/>

<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

0 comments on commit 9e39a0a

Please sign in to comment.