Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Nov 26, 2015
1 parent 0e4b167 commit cfd5112
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
import org.apache.camel.Route;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.kafka.KafkaConstants;
import org.apache.camel.component.kafka.KafkaEndpoint;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.EventDrivenConsumerRoute;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
Expand Down Expand Up @@ -188,7 +190,7 @@ public void process(Exchange exchange) throws Exception {
public void testCustomKafkaPartitionerLoads() throws Exception {
String zkhost = "&zookeeperHost=localhost";
String zkport = "&zookeeperPort=" + ZOOKEEPER_PORT;
String partitioner = "&partitionerClass=" + SimpleKafkaPartitioner.class.getName();
String partitioner = "&partitioner=" + SimpleKafkaPartitioner.class.getName();
final String epuri = "kafka:localhost:" + KAFKA_PORT + "?topic=" + TEST_TOPIC_NAME + "&groupId=group1" + zkhost + zkport + partitioner;

CamelContext camelctx = new DefaultCamelContext();
Expand All @@ -201,8 +203,8 @@ public void configure() throws Exception {

camelctx.start();
try {
Route route = camelctx.getRoute("testCustomPartitioner");
Assert.assertTrue(route.getRouteContext().isRouteAdded());
EventDrivenConsumerRoute route = (EventDrivenConsumerRoute) camelctx.getRoute("testCustomPartitioner");
Assert.assertTrue(route.isStarted());
} finally {
camelctx.stop();
}
Expand All @@ -225,8 +227,8 @@ public void configure() throws Exception {

camelctx.start();
try {
Route route = camelctx.getRoute("testCustomSerializer");
Assert.assertTrue(route.getRouteContext().isRouteAdded());
EventDrivenConsumerRoute route = (EventDrivenConsumerRoute) camelctx.getRoute("testCustomSerializer");
Assert.assertTrue(route.isStarted());
} finally {
camelctx.stop();
}
Expand Down Expand Up @@ -263,7 +265,15 @@ private Producer<String, String> createKafkaMessageProducer() {
properties.put("request.required.acks", "1");

ProducerConfig config = new ProducerConfig(properties);
return new Producer<>(config);

// Kafka Scala logic uses TCCL to load internal classes
ClassLoader originalCl = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
return new Producer<>(config);
} finally {
Thread.currentThread().setContextClassLoader(originalCl);
}
}

private static class KakfaTopicConsumer implements Runnable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package org.wildfly.camel.test.kafka.subA;

import kafka.serializer.Encoder;
import kafka.utils.VerifiableProperties;

public class SimpleKafkaSerializer implements Encoder<String> {
public SimpleKafkaSerializer(VerifiableProperties props) {
}

@Override
public byte[] toBytes(String s) {
return s.getBytes();
Expand Down
12 changes: 6 additions & 6 deletions modules/etc/baseline/module-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
/org/apache/camel/component/jms/main/camel-jms-2.16.1.jar
/org/apache/camel/component/jmx/main/camel-jmx-2.16.1.jar
/org/apache/camel/component/jpa/main/camel-jpa-2.16.1.jar
/org/apache/camel/component/kafka/main/camel-kafka-2.16.1.jar
/org/apache/camel/component/kafka/main/camel-kafka-2.17-SNAPSHOT.jar
/org/apache/camel/component/lucene/main/camel-lucene-2.16.1.jar
/org/apache/camel/component/mail/main/camel-mail-2.16.1.jar
/org/apache/camel/component/metrics/main/camel-metrics-2.16.1.jar
Expand Down Expand Up @@ -115,13 +115,13 @@
/org/apache/cxf/ext/main/oauth-provider-20100527.jar
/org/apache/deltaspike/core/api/main/deltaspike-core-api-1.5.1.jar
/org/apache/deltaspike/core/impl/main/deltaspike-core-impl-1.5.1.jar
/org/apache/kafka/clients/main/kafka-clients-0.8.2.2.jar
/org/apache/kafka/clients/main/kafka-clients-0.9.0.0.jar
/org/apache/kafka/clients/main/lz4-1.2.0.jar
/org/apache/kafka/clients/main/snappy-java-1.1.1.7.jar
/org/apache/kafka/main/jopt-simple-3.2.jar
/org/apache/kafka/main/kafka_2.11-0.8.2.2.jar
/org/apache/kafka/main/kafka_2.11-0.9.0.0.jar
/org/apache/kafka/main/metrics-core-2.2.0.jar
/org/apache/kafka/main/zkclient-0.3.jar
/org/apache/kafka/main/zkclient-0.7.jar
/org/apache/lucene/ext/main/lucene-grouping-4.10.4.jar
/org/apache/lucene/ext/main/lucene-highlighter-4.10.4.jar
/org/apache/lucene/ext/main/lucene-join-4.10.4.jar
Expand Down Expand Up @@ -163,8 +163,8 @@
/org/restlet/main/org.restlet-2.3.1.jar
/org/restlet/main/org.restlet.ext.httpclient-2.3.1.jar
/org/scala/library/main/scala-library-2.11.7.jar
/org/scala/modules/main/scala-parser-combinators_2.11-1.0.2.jar
/org/scala/modules/main/scala-xml_2.11-1.0.2.jar
/org/scala/modules/main/scala-parser-combinators_2.11-1.0.4.jar
/org/scala/modules/main/scala-xml_2.11-1.0.4.jar
/org/springframework/aop/main/aopalliance-1.0.jar
/org/springframework/aop/main/spring-aop-4.1.8.RELEASE.jar
/org/springframework/beans/main/spring-beans-4.1.8.RELEASE.jar
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.apache.camel.component.kafka">
<resources>
<resource-root path="camel-kafka-2.16.1.jar" />
<resource-root path="camel-kafka-2.17-SNAPSHOT.jar" />
</resources>
<dependencies>
<module name="javax.api" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<property name="jboss.api" value="private" />
</properties>
<resources>
<resource-root path="kafka-clients-0.8.2.2.jar" />
<resource-root path="kafka-clients-0.9.0.0.jar" />
<resource-root path="lz4-1.2.0.jar" />
<resource-root path="snappy-java-1.1.1.7.jar" />
</resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
</properties>
<resources>
<resource-root path="jopt-simple-3.2.jar" />
<resource-root path="kafka_2.11-0.8.2.2.jar" />
<resource-root path="kafka_2.11-0.9.0.0.jar" />
<resource-root path="metrics-core-2.2.0.jar" />
<resource-root path="zkclient-0.3.jar" />
<resource-root path="zkclient-0.7.jar" />
</resources>
<dependencies>
<module name="javax.api" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,67 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
Gravia :: Container :: WildFly :: Patch
%%
Copyright (C) 2010 - 2014 JBoss by Red Hat
%%
Licensed 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.
#L%
-->


<module xmlns="urn:jboss:module:1.1" name="org.jboss.gravia">
<properties>
<property name="jboss.api" value="private"/>
</properties>

<resources>
<resource-root path="gravia-resource-1.3.1.jar"/>
<resource-root path="gravia-runtime-api-1.3.1.jar"/>
<resource-root path="gravia-runtime-embedded-1.3.1.jar"/>
<resource-root path="org.apache.felix.configadmin-1.8.8.jar">
<filter>
<exclude path="org/osgi/**" />
</filter>
</resource-root>
<resource-root path="org.apache.felix.log-1.0.1.jar">
<filter>
<exclude path="org/osgi/**" />
</filter>
</resource-root>
<resource-root path="org.apache.felix.metatype-1.0.8.jar">
<filter>
<exclude path="org/osgi/**" />
</filter>
</resource-root>
<resource-root path="org.apache.felix.scr-1.6.2.jar">
<filter>
<exclude path="org/osgi/**" />
</filter>
</resource-root>
</resources>

<exports>
<include path="org/jboss/gravia/resource"/>
<include path="org/jboss/gravia/runtime"/>
</exports>

<dependencies>
<module name="javax.api"/>
<module name="javax.servlet.api"/>
<module name="org.osgi.core"/>
<module name="org.osgi.enterprise"/>
<module name="org.slf4j"/>
</dependencies>

<resources>
<resource-root path="gravia-resource-1.3.1.jar" />
<resource-root path="gravia-runtime-api-1.3.1.jar" />
<resource-root path="gravia-runtime-embedded-1.3.1.jar" />
<resource-root path="org.apache.felix.configadmin-1.8.8.jar" />
<resource-root path="org.apache.felix.log-1.0.1.jar" />
<resource-root path="org.apache.felix.metatype-1.0.8.jar" />
<resource-root path="org.apache.felix.scr-1.6.2.jar" />
</resources>
<dependencies>
<module name="javax.api" />
<module name="biz.aQute" />
<module name="javax.servlet.api" />
<module name="net.sf.kxml" />
<module name="org.ops4j" />
<module name="org.osgi.compendium" />
<module name="org.osgi.core" />
<module name="org.osgi.enterprise" />
<module name="org.slf4j" />
</dependencies>
<exports>
<include path="org/jboss/gravia/resource" />
<include path="org/jboss/gravia/runtime" />
</exports>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<property name="jboss.api" value="private" />
</properties>
<resources>
<resource-root path="scala-parser-combinators_2.11-1.0.2.jar" />
<resource-root path="scala-xml_2.11-1.0.2.jar" />
<resource-root path="scala-parser-combinators_2.11-1.0.4.jar" />
<resource-root path="scala-xml_2.11-1.0.4.jar" />
</resources>
<dependencies>
<module name="org.scala.library" />
Expand Down

0 comments on commit cfd5112

Please sign in to comment.