Skip to content

Commit

Permalink
[resolves wildfly-extras#1874] Add support for camel connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
tdiesler committed Sep 21, 2017
1 parent eba312e commit fa4a83b
Show file tree
Hide file tree
Showing 19 changed files with 288 additions and 35 deletions.
14 changes: 14 additions & 0 deletions catalog/src/main/resources/component.roadmap
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,34 @@ apns #1982
asterisk #1983
atmos #1984
atmosphere-websocket #1406
atomix-map
atomix-messaging
atomix-multimap
atomix-queue
atomix-set
atomix-value
beanstalk #1419
caffeine-cache
caffeine-loadcache
chronicle-engine #1986
chunk #1987
cm-sms #1988
cmis #1989
cometd #1990
cometds #1991
consul #1992
crypto-cms
ehcache #1995
fop #1997
ganglia #1998
geocoder #1999
google-bigquery
grape #2001
guava-eventbus #2002
hazelcast #1440
hipchat #2003
iec60870-client
iec60870-server
jcr #2008
jing #2010
jolt #2011
Expand All @@ -224,6 +236,8 @@ spark-rest #1470
spring-ws #1476
stomp #2033
telegram #2035
thrift
twilio
xmpp #2037
yammer #2038

Expand Down
3 changes: 3 additions & 0 deletions catalog/src/main/resources/dataformat.roadmap
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ zipfile
[planned]

[undecided]
asn1
json-fastjson
thrift

[rejected]

2 changes: 2 additions & 0 deletions catalog/src/main/resources/other.roadmap
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ zipkin
[planned]

[undecided]
headersmap
leveldb #2063
reactor
ribbon #2064
shiro #2065
spring-cloud #2066
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<module name="org.apache.camel.component.cassandra" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.castor" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.coap" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.connector" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.context" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.couchdb" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.crypto" export="true" services="export" optional="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<module xmlns="urn:jboss:module:1.1" name="org.apache.camel">

<dependencies>
<module name="org.apache.camel.catalog" export="true" />
<module name="org.apache.camel.core" export="true" services="export" />
<module name="org.apache.camel.spring" export="true" services="export">
<imports>
Expand Down
52 changes: 18 additions & 34 deletions feature/pack/etc/smartics/camel-modules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
-->
<modules xmlns="http://smartics.de/ns/jboss-modules-descriptor/2">

<module name="org.apache.camel.catalog">
<include artifact="org.apache.camel:camel-catalog" />
<dependencies>
<module name="org.slf4j" />
</dependencies>
</module>

<module name="org.apache.camel.core">
<include artifact="org.apache.camel:camel-core" />
<apply-to-dependencies skip="true">
Expand Down Expand Up @@ -47,40 +54,6 @@
</dependencies>
</module>

<module name="org.apache.camel.spring">
<include artifact="org.apache.camel:camel-spring" />
<apply-to-dependencies skip="true">
</apply-to-dependencies>
<dependencies>
<module name="javax.api" />
<module name="javax.xml.bind.api" />
<module name="org.apache.camel.core" />
<module name="org.springframework.beans" export="true" />
<module name="org.springframework.context" />
<module name="org.springframework.core" />
<module name="org.springframework.jdbc" export="true" optional="true">
<imports>
<include path="META-INF" />
</imports>
<exports>
<include path="META-INF" />
<include path="org/springframework/jdbc/config" />
<exclude path="org/springframework/jdbc**" />
</exports>
</module>
<module name="org.springframework.tx" export="true">
<exports>
<exclude path="org/springframework/dao**" />
<exclude path="org/springframework/jca**" />
</exports>
</module>
<module name="org.slf4j" />
</dependencies>
<exports>
<exclude path="org/apache/camel/spring/remoting" />
</exports>
</module>

<module name="org.apache.camel.component.activemq">
<include artifact="org.apache.activemq:activemq-camel" />
<apply-to-dependencies skip="true">
Expand Down Expand Up @@ -378,6 +351,17 @@
</dependencies>
</module>

<module name="org.apache.camel.component.connector">
<include artifact="org.apache.camel:camel-connector" />
<apply-to-dependencies skip="true">
<include module="org.apache.camel.apt" />
<include module="org.springframework.boot" />
</apply-to-dependencies>
<dependencies>
<module name="org.slf4j" />
</dependencies>
</module>

<module name="org.apache.camel.component.context">
<include artifact="org.apache.camel:camel-context" />
<apply-to-dependencies skip="true">
Expand Down
34 changes: 34 additions & 0 deletions feature/pack/etc/smartics/spring-modules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,40 @@
-->
<modules xmlns="http://smartics.de/ns/jboss-modules-descriptor/2">

<module name="org.apache.camel.spring">
<include artifact="org.apache.camel:camel-spring" />
<apply-to-dependencies skip="true">
</apply-to-dependencies>
<dependencies>
<module name="javax.api" />
<module name="javax.xml.bind.api" />
<module name="org.apache.camel.core" />
<module name="org.springframework.beans" export="true" />
<module name="org.springframework.context" />
<module name="org.springframework.core" />
<module name="org.springframework.jdbc" export="true" optional="true">
<imports>
<include path="META-INF" />
</imports>
<exports>
<include path="META-INF" />
<include path="org/springframework/jdbc/config" />
<exclude path="org/springframework/jdbc**" />
</exports>
</module>
<module name="org.springframework.tx" export="true">
<exports>
<exclude path="org/springframework/dao**" />
<exclude path="org/springframework/jca**" />
</exports>
</module>
<module name="org.slf4j" />
</dependencies>
<exports>
<exclude path="org/apache/camel/spring/remoting" />
</exports>
</module>

<module name="org.springframework.aop">
<properties>
<property name="jboss.api" value="private"/>
Expand Down
4 changes: 4 additions & 0 deletions feature/pack/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-coap</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-connector</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-context</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.apache.camel.catalog">
<resources>
<artifact name="${org.apache.camel:camel-catalog}" />
</resources>
<dependencies>
<module name="org.slf4j" />
<module name="javax.xml.bind.api" />
</dependencies>
</module>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.apache.camel.component.connector">
<resources>
<artifact name="${org.apache.camel:camel-connector}" />
</resources>
<dependencies>
<module name="org.slf4j" />
<module name="javax.xml.bind.api" />
<module name="org.apache.camel.catalog" />
<module name="org.apache.camel.core" />
</dependencies>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<module name="org.apache.camel.component.cassandra" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.castor" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.coap" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.connector" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.context" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.couchdb" export="true" services="export" optional="true" />
<module name="org.apache.camel.component.crypto" export="true" services="export" optional="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<module xmlns="urn:jboss:module:1.1" name="org.apache.camel">

<dependencies>
<module name="org.apache.camel.catalog" export="true" />
<module name="org.apache.camel.core" export="true" services="export" />
<module name="org.apache.camel.spring" export="true" services="export">
<imports>
Expand Down
6 changes: 6 additions & 0 deletions itests/standalone/basic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@
</dependencies>

<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* #%L
* Wildfly Camel :: Testsuite
* %%
* Copyright (C) 2013 - 2014 RedHat
* %%
* 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%
*/

package org.wildfly.camel.test.connector;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.wildfly.camel.test.connector.foo.FooComponent;
import org.wildfly.extension.camel.CamelAware;

@CamelAware
@RunWith(Arquillian.class)
public class FooConnectorTest {

@Deployment
public static JavaArchive deployment() {
final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "camel-foo-tests");
archive.addClasses(FooComponent.class);
String fooPath = FooComponent.class.getPackage().getName().replace('.', '/');
archive.addAsManifestResource("connector/META-INF/services/foo", "services/" + fooPath);
archive.addAsResource("connector/camel-connector-schema.json", "camel-connector-schema.json");
archive.addAsResource("connector/camel-connector.json", "camel-connector.json");
return archive;
}

@Test
public void testFooConnector() throws Exception {

final CountDownLatch latch = new CountDownLatch(1);

CamelContext camelctx = new DefaultCamelContext();

FooComponent foo = new FooComponent();
camelctx.addComponent(foo.getComponentName(), foo);

camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("foo:timerName")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
latch.countDown();
}})
.to("mock:result");
}
});

camelctx.start();
try {
Assert.assertTrue("Countdown reached zero", latch.await(5, TimeUnit.MINUTES));
} finally {
camelctx.stop();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* 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.wildfly.camel.test.connector.foo;

import org.apache.camel.component.connector.DefaultConnectorComponent;

public class FooComponent extends DefaultConnectorComponent {

public FooComponent() {
super("foo", FooComponent.class);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# 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.
#

class=org.wildfly.camel.test.connector.foo.FooComponent
Loading

0 comments on commit fa4a83b

Please sign in to comment.