-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
second example of CXF and Spring, this uses code gen
- Loading branch information
1 parent
a7c07c0
commit 94280a9
Showing
8 changed files
with
489 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
A_ContractFirstWS_SpringDSLRoute2/testProxyBuilder/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Class-Path: | ||
|
91 changes: 91 additions & 0 deletions
91
A_ContractFirstWS_SpringDSLRoute2/testProxyBuilder/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
WildFly Camel Spring XML Web Application | ||
============= | ||
|
||
This is a template Apache Camel Spring application for the WildFly Camel subsystem. | ||
|
||
This project is setup to allow you to create a Apache Camel Spring application, which can be deployed to an application | ||
server running the WildFly Camel subsystem. An example Spring XML Camel Route has been created for you, together with an Arquillian | ||
integration test. | ||
|
||
Prerequisites | ||
============= | ||
|
||
* Minimum of Java 1.7 | ||
* Maven 3.2 or greater | ||
* JBoss EAP 6.4 | ||
|
||
|
||
Getting started at the Command Line | ||
------------------------------------ | ||
|
||
1. Install Red Hat Fuse on your application server | ||
|
||
2. Configure a $JBOSS_HOME environment variable to point at your application server installation directory | ||
|
||
3. Start the application server from the command line | ||
|
||
For Linux: | ||
|
||
$JBOSS_HOME/bin/standalone.sh -c standalone.xml | ||
|
||
For Windows: | ||
|
||
%JBOSS_HOME%\bin\standalone.bat -c standalone.xml | ||
|
||
|
||
Building the application | ||
------------------------ | ||
|
||
To build the application do: | ||
|
||
mvn clean install | ||
|
||
|
||
Run Arquillian Tests | ||
-------------------- | ||
|
||
By default, tests are configured to be skipped as Arquillian requires the use of a container. | ||
|
||
If you already have a running application server, you can run integration tests with: | ||
|
||
mvn clean test -Parq-remote | ||
|
||
Otherwise you can get Arquillian to start and stop the server for you (Note: you must have $JBOSS_HOME configured beforehand): | ||
|
||
mvn clean test -Parq-managed | ||
|
||
|
||
Deploying the application | ||
------------------------- | ||
|
||
To deploy the application to a running application server do: | ||
|
||
mvn clean package wildfly:deploy | ||
|
||
The server console should display lines like the following: | ||
|
||
(MSC service thread 1-16) Apache Camel (CamelContext: spring-context) is starting | ||
(MSC service thread 1-16) Camel context starting: spring-context | ||
(MSC service thread 1-6) Bound camel naming object: java:jboss/camel/context/spring-context | ||
(MSC service thread 1-16) Route: route4 started and consuming from: Endpoint[direct://start] | ||
(MSC service thread 1-16) Total 1 routes, of which 1 is started | ||
|
||
|
||
Access the application | ||
---------------------- | ||
|
||
The application will be available at http://localhost:8080/your-context-root?name=Kermit | ||
|
||
|
||
Undeploying the application | ||
--------------------------- | ||
|
||
mvn wildfly:undeploy | ||
|
||
|
||
Further reading | ||
--------------- | ||
|
||
Apache Camel documentation | ||
|
||
http://camel.apache.org/ |
242 changes: 242 additions & 0 deletions
242
A_ContractFirstWS_SpringDSLRoute2/testProxyBuilder/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,242 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.mycompany</groupId> | ||
<artifactId>camel-test-spring</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<packaging>war</packaging> | ||
<name>Fuse on EAP Camel Spring Application</name> | ||
<description>Fuse on EAP Camel Example using Spring</description> | ||
<properties> | ||
<version.maven.compiler.plugin>3.5.1</version.maven.compiler.plugin> | ||
<jboss.home>${env.JBOSS_HOME}</jboss.home> | ||
<version.maven.surefire.plugin>2.19.1</version.maven.surefire.plugin> | ||
<server.config>standalone-full-ha.xml</server.config> | ||
<maven.compiler.target>1.7</maven.compiler.target> | ||
<version.jboss.bom.eap>6.4.0.GA</version.jboss.bom.eap> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<camel.version>2.17.0.redhat-630187</camel.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin> | ||
<version.junit>4.11</version.junit> | ||
<maven.compiler.source>1.7</maven.compiler.source> | ||
<version.maven.war.plugin>2.5</version.maven.war.plugin> | ||
</properties> | ||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.bom.eap</groupId> | ||
<artifactId>jboss-javaee-6.0-with-tools</artifactId> | ||
<version>${version.jboss.bom.eap}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.spec.javax.servlet</groupId> | ||
<artifactId>jboss-servlet-api_3.0_spec</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-core</artifactId> | ||
<version>2.17.0.redhat-630187</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-cdi</artifactId> | ||
<version>2.17.0.redhat-630187</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.enterprise</groupId> | ||
<artifactId>cdi-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
<repositories> | ||
<repository> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
<id>redhat-ga-repository</id> | ||
<url>https://maven.repository.redhat.com/ga</url> | ||
</repository> | ||
<repository> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
<id>redhat-ea-repository</id> | ||
<url>https://maven.repository.redhat.com/earlyaccess/all</url> | ||
</repository> | ||
<repository> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
<id>fusesource-release-repository</id> | ||
<url>https://repo.fusesource.com/nexus/content/groups/public/</url> | ||
</repository> | ||
<repository> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
<id>fusesource-earlyaccess-repository</id> | ||
<url>https://repo.fusesource.com/nexus/content/groups/ea</url> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
<id>redhat-ga-repository</id> | ||
<url>https://maven.repository.redhat.com/ga</url> | ||
</pluginRepository> | ||
<pluginRepository> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
<id>redhat-ea-repository</id> | ||
<url>https://maven.repository.redhat.com/earlyaccess/all</url> | ||
</pluginRepository> | ||
<pluginRepository> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
<id>fusesource-release-plugin-repository</id> | ||
<url>https://repo.fusesource.com/nexus/content/groups/public/</url> | ||
</pluginRepository> | ||
<pluginRepository> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
<id>fusesource-earlyaccess-plugin-repository</id> | ||
<url>https://repo.fusesource.com/nexus/content/groups/ea</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
<build> | ||
<testResources> | ||
<testResource> | ||
<filtering>true</filtering> | ||
<directory>src/test/resources</directory> | ||
</testResource> | ||
</testResources> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.cxf</groupId> | ||
<artifactId>cxf-codegen-plugin</artifactId> | ||
<version>3.1.5</version> | ||
<executions> | ||
<execution> | ||
<id>generate-sources</id> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>wsdl2java</goal> | ||
</goals> | ||
<configuration> | ||
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot> | ||
<wsdlOptions> | ||
<wsdlOption> | ||
<wsdl>${basedir}/src/main/resources/wsdl/webService.wsdl</wsdl> | ||
</wsdlOption> | ||
</wsdlOptions> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${version.maven.compiler.plugin}</version> | ||
<configuration> | ||
<source>${maven.compiler.source}</source> | ||
<target>${maven.compiler.target}</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>${version.maven.war.plugin}</version> | ||
<configuration> | ||
<failOnMissingWebXml>false</failOnMissingWebXml> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.wildfly.plugins</groupId> | ||
<artifactId>wildfly-maven-plugin</artifactId> | ||
<version>${version.wildfly.maven.plugin}</version> | ||
<configuration> | ||
<serverConfig>${server.config}</serverConfig> | ||
<port>9999</port> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<profiles> | ||
<profile> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${version.maven.surefire.plugin}</version> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
<profile> | ||
<id>arq-managed</id> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.as</groupId> | ||
<artifactId>jboss-as-arquillian-container-managed</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
<profile> | ||
<id>arq-remote</id> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.as</groupId> | ||
<artifactId>jboss-as-arquillian-container-remote</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
</project> |
35 changes: 35 additions & 0 deletions
35
A_ContractFirstWS_SpringDSLRoute2/testProxyBuilder/src/main/java/org/test/ImplPortType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.test; | ||
|
||
import javax.annotation.PostConstruct; | ||
import javax.inject.Inject; | ||
import javax.jws.WebService; | ||
|
||
import org.apache.camel.CamelContext; | ||
import org.apache.camel.builder.ProxyBuilder; | ||
import com.test.webservices.test.TestPortType; | ||
import com.test.webservices.test.TestRequest; | ||
import com.test.webservices.test.TestResponse; | ||
import javax.annotation.Resource; | ||
import org.apache.camel.ProducerTemplate; | ||
|
||
@WebService(endpointInterface = "com.test.webservices.test.TestPortType", serviceName = "test") | ||
public class ImplPortType implements TestPortType { | ||
|
||
//@Inject | ||
//private CamelContext context; | ||
|
||
@Resource(name = "java:jboss/camel/context/the-context") | ||
private CamelContext context; | ||
|
||
private TestPortType portType; | ||
|
||
@Override | ||
public TestResponse test(TestRequest testRequest) { | ||
|
||
ProducerTemplate producer = context.createProducerTemplate(); | ||
TestResponse fromCamel = producer.requestBody("direct-vm:startTest", testRequest, TestResponse.class); | ||
System.out.println("### ImplPortType got a return Object from route! ###"); | ||
return fromCamel; | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
A_ContractFirstWS_SpringDSLRoute2/testProxyBuilder/src/main/java/org/test/MyBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.test; | ||
|
||
import com.test.webservices.test.TestResponse; | ||
|
||
public class MyBean { | ||
|
||
public TestResponse makeResponse(){ | ||
TestResponse ret = new TestResponse(); | ||
ret.setOutputMessage("Output from the TestResponse maker!"); | ||
System.out.println("### Bean returns: " + ret.toString() + " " + ret.getOutputMessage() + " ###"); | ||
return ret; | ||
} | ||
|
||
} |
Oops, something went wrong.