camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmoulli...@apache.org
Subject svn commit: r1392822 - in /camel/trunk/examples/camel-example-cdi: ./ src/test/java/org/apache/camel/example/cdi/one/ src/test/java/org/apache/camel/example/cdi/one/jbossas/ src/test/java/org/apache/camel/example/cdi/one/weld/ src/test/java/org/apache/...
Date Tue, 02 Oct 2012 10:08:16 GMT
Author: cmoulliard
Date: Tue Oct  2 10:08:16 2012
New Revision: 1392822

URL: http://svn.apache.org/viewvc?rev=1392822&view=rev
Log:
Refactor jboss profile to use instead arquillian-jboss-managed

Added:
    camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/jbossas/
    camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/jbossas/IntegrationTest.java
    camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/weld/
    camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/weld/IntegrationTest.java
    camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/jbossas/
    camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/jbossas/SeparateRouteBuilderIntegrationTest.java
    camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/weld/
    camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/weld/SeparateRouteBuilderIntegrationTest.java
    camel/trunk/examples/camel-example-cdi/src/test/resources/
    camel/trunk/examples/camel-example-cdi/src/test/resources/arquillian.xml
    camel/trunk/examples/camel-example-cdi/src/test/resources/log4j.properties
Removed:
    camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/IntegrationTest.java
    camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/SeparateRouteBuilderIntegrationTest.java
Modified:
    camel/trunk/examples/camel-example-cdi/README.txt
    camel/trunk/examples/camel-example-cdi/pom.xml

Modified: camel/trunk/examples/camel-example-cdi/README.txt
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/README.txt?rev=1392822&r1=1392821&r2=1392822&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-cdi/README.txt (original)
+++ camel/trunk/examples/camel-example-cdi/README.txt Tue Oct  2 10:08:16 2012
@@ -19,17 +19,18 @@ You can see the routing rules by looking
   To stop the example hit ctrl + c
   
 When we launch the example using the camel maven plugin, a local CDI container
-is created and started. Additionally there're two maven profiles being defined
-by this example (see pom.xml for details) so that using maven we can easily embed
-and deploy the example as a web-app into an application server.
+is created and started.
 
-To run the example using JBoss type
-  mvn deploy -Pjboss
+Additionally there are maven profiles being defined by this example (see pom.xml for details)
+which allow to test using arquillian the project in weld container, jboss-as, ...
+
+To run the example with Arquillian & JBossAS 7.x managed, type
+  mvn test -Parquillian-jbossas-managed
   
-And for Glassfish
-  mvn deploy -Pglassfish
+And for Arquillian & Weld
+  mvn test -Parquillian-weld-ee-embedded
 
-Please note that both the JBoss as well as Glassfish maven artifacts are pretty
+Please note that both the JBoss as well as Weld maven artifacts are pretty
 big in size so be patient as maven downloads them into your local repository for
 the first time.
 

Modified: camel/trunk/examples/camel-example-cdi/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/pom.xml?rev=1392822&r1=1392821&r2=1392822&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-cdi/pom.xml (original)
+++ camel/trunk/examples/camel-example-cdi/pom.xml Tue Oct  2 10:08:16 2012
@@ -15,241 +15,350 @@
     License.
   -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
 
-  <parent>
-    <groupId>org.apache.camel</groupId>
-    <artifactId>examples</artifactId>
-    <version>2.11-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>camel-example-cdi</artifactId>
-  <packaging>war</packaging>
-  <name>Camel :: Example :: CDI</name>
-  <description>An example showing how to work with Camel and CDI for dependency injection</description>
-
-  <properties>
-    <camel.osgi.export>org.apache.camel.example.cdi.*</camel.osgi.export>
-    <camel.osgi.import>
-      javax.ejb,
-      javax.inject,
-      org.apache.camel,
-      org.apache.camel.builder,
-      org.apache.camel.model,
-      org.apache.camel.cdi,
-      org.apache.activemq.broker,
-      org.apache.activemq.camel.component,
-      org.apache.activemq.pool,
-      org.apache.activemq.xbean
-    </camel.osgi.import>
-    <!-- avoid to import the bunch of spring related package -->
-    <camel.osgi.dynamic>org.springframework.*</camel.osgi.dynamic>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-cdi</artifactId>
-    </dependency>
-
-    <!-- we make use of the javax.ejb.Startup API while running the example -->
-    <!-- embedded inside glassfish/jboss (see the 2 profiles below) -->
-    <dependency>
-      <groupId>org.apache.geronimo.specs</groupId>
-      <artifactId>geronimo-ejb_3.1_spec</artifactId>
-      <version>${geronimo-ejb_3.1_spec-version}</version>
-      <scope>provided</scope>
-    </dependency>
-
-    <!-- activemq component -->
-    <dependency>
-      <groupId>org.apache.activemq</groupId>
-      <artifactId>activemq-camel</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.activemq</groupId>
-      <artifactId>activemq-pool</artifactId>
-    </dependency>
-
-    <!-- logging -->
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-    </dependency>
-
-    <!-- for testing -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.arquillian.junit</groupId>
-      <artifactId>arquillian-junit-container</artifactId>
-      <version>${arquillian-junit-container-version}</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <!-- allows the routes to be run via 'mvn camel:run' -->
-      <plugin>
+    <parent>
         <groupId>org.apache.camel</groupId>
-        <artifactId>camel-maven-plugin</artifactId>
-        <version>${project.version}</version>
-        <configuration>
-          <useCDI>true</useCDI>
-        </configuration>
-        <dependencies>
-          <!-- lets use deltaspike & weld -->
-          <dependency>
-            <groupId>org.apache.deltaspike.cdictrl</groupId>
-            <artifactId>deltaspike-cdictrl-weld</artifactId>
-            <version>${deltaspike-version}</version>
-          </dependency>
-          <dependency>
-            <groupId>org.jboss.weld.se</groupId>
-            <artifactId>weld-se-core</artifactId>
-            <version>${weld-version}</version>
-          </dependency>
-        </dependencies>
-      </plugin>
-
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-war-plugin</artifactId>
-        <configuration>
-          <webResources>
-            <!-- place the legal files under the META-INF folder -->
-            <resource>
-              <directory>src/main/resources/META-INF</directory>
-              <targetPath>META-INF</targetPath>
-              <includes>
-                <include>*.txt</include>
-              </includes>
-            </resource>
-            <!-- place beans.xml where it's expected to be, that's under the path WEB-INF/beans.xml -->
-            <resource>
-              <directory>src/main/resources/META-INF</directory>
-              <targetPath>WEB-INF</targetPath>
-              <includes>
-                <include>beans.xml</include>
-              </includes>
-            </resource>
-          </webResources>
-          <!-- exclude beans.xml from the root of the WAR -->
-          <packagingExcludes>beans.xml</packagingExcludes>
-          <failOnMissingWebXml>false</failOnMissingWebXml>
-        </configuration>
-      </plugin>
-
-      <plugin>
-        <!-- lets re-enable IntegrationTest -->
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <includes>
-            <include>**/*Test.java</include>
-          </includes>
-          <excludes>
-            <exclude>**/*XXXTest.*</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-  <profiles>
-    <profile>
-      <id>arquillian-weld-ee-embedded</id>
-      <activation>
-        <activeByDefault>true</activeByDefault>
-      </activation>
-      <dependencies>
-        <dependency>
-          <groupId>org.jboss.spec</groupId>
-          <artifactId>jboss-javaee-6.0</artifactId>
-          <version>${jboss-javaee-6-version}</version>
-          <type>pom</type>
-          <scope>provided</scope>
-        </dependency>
-        <dependency>
-          <groupId>org.jboss.arquillian.container</groupId>
-          <artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
-          <version>${arquillian-weld-ee-embedded-version}</version>
-          <scope>test</scope>
-        </dependency>
-        <dependency>
-          <groupId>org.jboss.weld</groupId>
-          <artifactId>weld-core</artifactId>
-          <version>${weld-version}</version>
-          <scope>test</scope>
-        </dependency>
-      </dependencies>
-    </profile>
-
-    <profile>
-      <id>glassfish</id>
-      <properties>
-        <embedded-glassfish-plugin-version>3.1.2.2</embedded-glassfish-plugin-version>
-
-        <!-- skip running the tests while deploying. you can still run them using the default profile -->
-        <!-- 'arquillian-weld-ee-embedded' having the required dependencies for the test execution -->
-        <maven.test.skip>true</maven.test.skip>
-      </properties>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.glassfish.embedded</groupId>
-            <artifactId>maven-embedded-glassfish-plugin</artifactId>
-            <version>${embedded-glassfish-plugin-version}</version>
-            <configuration>
-              <goalPrefix>glassfish</goalPrefix>
-              <app>target/${project.artifactId}-${project.version}.war</app>
-              <port>8080</port>
-              <contextRoot>${project.name}</contextRoot>
-            </configuration>
-            <executions>
-              <execution>
-                <phase>package</phase>
-                <goals>
-                  <goal>run</goal>
-                </goals>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
+        <artifactId>examples</artifactId>
+        <version>2.11-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-example-cdi</artifactId>
+    <packaging>war</packaging>
+    <name>Camel :: Example :: CDI</name>
+    <description>An example showing how to work with Camel and CDI for dependency injection</description>
+
+    <properties>
+        <camel.osgi.export>org.apache.camel.example.cdi.*</camel.osgi.export>
+        <camel.osgi.import>
+            javax.ejb,
+            javax.inject,
+            org.apache.camel,
+            org.apache.camel.builder,
+            org.apache.camel.model,
+            org.apache.camel.cdi,
+            org.apache.activemq.broker,
+            org.apache.activemq.camel.component,
+            org.apache.activemq.pool,
+            org.apache.activemq.xbean
+        </camel.osgi.import>
+        <!-- avoid to import the bunch of spring related package -->
+        <camel.osgi.dynamic>org.springframework.*</camel.osgi.dynamic>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-cdi</artifactId>
+        </dependency>
+
+        <!-- we make use of the javax.ejb.Startup API while running the example -->
+        <!-- embedded inside glassfish/jbossas (see the 2 profiles below) -->
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-ejb_3.1_spec</artifactId>
+            <version>${geronimo-ejb_3.1_spec-version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- activemq component -->
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-camel</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-pool</artifactId>
+        </dependency>
 
-    <profile>
-      <id>jboss</id>
-      <properties>
-        <jboss-plugin-version>7.2.Final</jboss-plugin-version>
-
-        <!-- skip running the tests while deploying. you can still run them using the default profile -->
-        <!-- 'arquillian-weld-ee-embedded' having the required dependencies for the test execution -->
-        <maven.test.skip>true</maven.test.skip>
-      </properties>
-      <build>
+        <!-- logging -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+        </dependency>
+
+        <!-- for testing -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.arquillian.junit</groupId>
+            <artifactId>arquillian-junit-container</artifactId>
+            <version>${arquillian-junit-container-version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.shrinkwrap.resolver</groupId>
+            <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+            <version>2.0.0-alpha-4</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
         <plugins>
-          <plugin>
-            <groupId>org.jboss.as.plugins</groupId>
-            <artifactId>jboss-as-maven-plugin</artifactId>
-            <version>${jboss-plugin-version}</version>
-            <executions>
-              <execution>
-                <phase>package</phase>
-                <goals>
-                  <goal>run</goal>
-                </goals>
-              </execution>
-            </executions>
-          </plugin>
+            <!-- allows the routes to be run via 'mvn camel:run' -->
+            <plugin>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-maven-plugin</artifactId>
+                <version>${project.version}</version>
+                <configuration>
+                    <useCDI>true</useCDI>
+                </configuration>
+                <dependencies>
+                    <!-- lets use deltaspike & weld -->
+                    <dependency>
+                        <groupId>org.apache.deltaspike.cdictrl</groupId>
+                        <artifactId>deltaspike-cdictrl-weld</artifactId>
+                        <version>${deltaspike-version}</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.jboss.weld.se</groupId>
+                        <artifactId>weld-se-core</artifactId>
+                        <version>${weld-version}</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <configuration>
+                    <webResources>
+                        <!-- place the legal files under the META-INF folder -->
+                        <resource>
+                            <directory>src/main/resources/META-INF</directory>
+                            <targetPath>META-INF</targetPath>
+                            <includes>
+                                <include>*.txt</include>
+                            </includes>
+                        </resource>
+                        <!-- place beans.xml where it's expected to be, that's under the path WEB-INF/beans.xml -->
+                        <resource>
+                            <directory>src/main/resources/META-INF</directory>
+                            <targetPath>WEB-INF</targetPath>
+                            <includes>
+                                <include>beans.xml</include>
+                            </includes>
+                        </resource>
+                    </webResources>
+                    <!-- exclude beans.xml from the root of the WAR -->
+                    <packagingExcludes>beans.xml</packagingExcludes>
+                    <failOnMissingWebXml>false</failOnMissingWebXml>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <!-- lets re-enable IntegrationTest -->
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <systemProperties>
+                        <arquillian.launch>${arquillian}</arquillian.launch>
+                        <arquillian>${arquillian}</arquillian>
+                    </systemProperties>
+                    <includes>
+                        <include>**/*Test.java</include>
+                    </includes>
+                    <excludes>
+                        <exclude>**/*XXXTest.*</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
         </plugins>
-      </build>
-    </profile>
-  </profiles>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>arquillian-weld-ee-embedded</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.jboss.spec</groupId>
+                    <artifactId>jboss-javaee-6.0</artifactId>
+                    <version>${jboss-javaee-6-version}</version>
+                    <type>pom</type>
+                    <scope>provided</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.jboss.arquillian.container</groupId>
+                    <artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
+                    <version>${arquillian-weld-ee-embedded-version}</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.jboss.weld</groupId>
+                    <artifactId>weld-core</artifactId>
+                    <version>${weld-version}</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <!-- lets re-enable IntegrationTest -->
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <systemPropertyVariables>
+                                <arquillian.launch>weld-ee-embedded-1.1</arquillian.launch>
+                                <arquillian>weld-ee-embedded-1.1</arquillian>
+                            </systemPropertyVariables>
+                            <excludes>
+                                <exclude>**/jbossas/**</exclude>
+                            </excludes>
+                        </configuration>
+                    </plugin>
+                </plugins>
+
+            </build>
+        </profile>
+
+        <profile>
+            <id>arquillian-jbossas-managed</id>
+            <properties>
+                <jboss-arquillian-version>7.1.1.Final</jboss-arquillian-version>
+                <arquillian-version>1.0.0.CR6</arquillian-version>
+                <maven.test.skip>false</maven.test.skip>
+            </properties>
+            <dependencies>
+                <dependency>
+                    <groupId>org.jboss.spec</groupId>
+                    <artifactId>jboss-javaee-6.0</artifactId>
+                    <version>${jboss-javaee-6-version}</version>
+                    <type>pom</type>
+                    <scope>provided</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.jboss.as</groupId>
+                    <artifactId>jboss-as-arquillian-container-managed</artifactId>
+                    <version>${jboss-arquillian-version}</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.jboss.arquillian.protocol</groupId>
+                    <artifactId>arquillian-protocol-servlet</artifactId>
+                    <version>${arquillian-version}</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.jboss.shrinkwrap.resolver</groupId>
+                    <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+                    <version>2.0.0-alpha-4</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-dependency-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>unpack</id>
+                                <phase>process-test-classes</phase>
+                                <goals>
+                                    <goal>unpack</goal>
+                                </goals>
+                                <configuration>
+                                    <artifactItems>
+                                        <artifactItem>
+                                            <groupId>org.jboss.as</groupId>
+                                            <artifactId>jboss-as-dist</artifactId>
+                                            <version>${jboss-arquillian-version}</version>
+                                            <type>zip</type>
+                                            <overWrite>false</overWrite>
+                                            <outputDirectory>target</outputDirectory>
+                                        </artifactItem>
+                                    </artifactItems>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <!-- lets re-enable IntegrationTest -->
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <systemPropertyVariables>
+                                <arquillian.launch>jbossas-managed</arquillian.launch>
+                                <arquillian>jbossas-managed</arquillian>
+                            </systemPropertyVariables>
+                            <excludes>
+                                <exclude>**/weld/**</exclude>
+                            </excludes>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>glassfish</id>
+            <properties>
+                <embedded-glassfish-plugin-version>3.1.2.2</embedded-glassfish-plugin-version>
+
+                <!-- skip running the tests while deploying. you can still run them using the default profile -->
+                <!-- 'arquillian-weld-ee-embedded' having the required dependencies for the test execution -->
+                <maven.test.skip>true</maven.test.skip>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.glassfish.embedded</groupId>
+                        <artifactId>maven-embedded-glassfish-plugin</artifactId>
+                        <version>${embedded-glassfish-plugin-version}</version>
+                        <configuration>
+                            <goalPrefix>glassfish</goalPrefix>
+                            <app>target/${project.artifactId}-${project.version}.war</app>
+                            <port>8080</port>
+                            <contextRoot>${project.name}</contextRoot>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>jboss</id>
+            <properties>
+                <jboss-plugin-version>7.2.Final</jboss-plugin-version>
+
+                <!-- skip running the tests while deploying. you can still run them using the default profile -->
+                <!-- 'arquillian-weld-ee-embedded' having the required dependencies for the test execution -->
+                <maven.test.skip>true</maven.test.skip>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.jboss.as.plugins</groupId>
+                        <artifactId>jboss-as-maven-plugin</artifactId>
+                        <version>${jboss-plugin-version}</version>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+
+    </profiles>
 </project>

Added: camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/jbossas/IntegrationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/jbossas/IntegrationTest.java?rev=1392822&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/jbossas/IntegrationTest.java (added)
+++ camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/jbossas/IntegrationTest.java Tue Oct  2 10:08:16 2012
@@ -0,0 +1,107 @@
+/**
+ * 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.apache.camel.example.cdi.one.jbossas;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.ContextName;
+import org.apache.camel.cdi.Mock;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.example.cdi.MyRoutes;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import java.io.File;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+
+@RunWith(Arquillian.class)
+public class IntegrationTest {
+    static boolean routeConfigured;
+    private static final transient Logger LOG = LoggerFactory.getLogger(IntegrationTest.class);
+
+    @Inject
+    MyRoutes config;
+
+    @Inject
+    @Mock
+    MockEndpoint result;
+
+    @Produces
+    @ApplicationScoped
+    @ContextName
+    public RouteBuilder createRoutes() {
+        return new RouteBuilder() {
+            public void configure() {
+                routeConfigured = true;
+                Endpoint resultEndpoint = config.getResultEndpoint();
+                LOG.info("consuming from output: " + resultEndpoint + " to endpoint: " + result);
+
+                from(resultEndpoint).to(result);
+            }
+        };
+    }
+
+    @Test
+    public void integrationTest() throws Exception {
+        assertNotNull("config not injected!", config);
+        assertNotNull("MockEndpoint result not injected!", result);
+        assertTrue("RouteBuilder has not been configured!", routeConfigured);
+
+        result.expectedMessageCount(2);
+        result.assertIsSatisfied();
+    }
+
+    @Deployment
+    @TargetsContainer("jbossas-managed")
+    public static Archive<?> createTestArchive() {
+
+
+        JavaArchive jarTest = ShrinkWrap.create(JavaArchive.class)
+                .addPackage(MyRoutes.class.getPackage())
+                .addPackage(IntegrationTest.class.getPackage())
+                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+
+        File[] libs = Maven.resolver()
+                .loadPomFromFile("pom.xml")
+                .resolve("org.apache.camel:camel-core","org.apache.camel:camel-cdi","org.apache.activemq:activemq-camel")
+                .withTransitivity()
+                .as(File.class);
+
+        return ShrinkWrap
+                .create(WebArchive.class, "test.war")
+                .addAsLibrary(jarTest)
+                .addAsLibraries(libs);
+    }
+
+}

Added: camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/weld/IntegrationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/weld/IntegrationTest.java?rev=1392822&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/weld/IntegrationTest.java (added)
+++ camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/one/weld/IntegrationTest.java Tue Oct  2 10:08:16 2012
@@ -0,0 +1,98 @@
+/**
+ * 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.apache.camel.example.cdi.one.weld;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.CdiCamelContext;
+import org.apache.camel.cdi.ContextName;
+import org.apache.camel.cdi.Mock;
+import org.apache.camel.cdi.internal.CamelExtension;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.example.cdi.MyRoutes;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class IntegrationTest {
+    static boolean routeConfigured;
+    private static final transient Logger LOG = LoggerFactory.getLogger(IntegrationTest.class);
+
+    @Inject
+    MyRoutes config;
+
+    @Inject
+    @Mock
+    MockEndpoint result;
+
+    @Produces
+    @ApplicationScoped
+    @ContextName
+    public RouteBuilder createRoutes() {
+        return new RouteBuilder() {
+            public void configure() {
+                routeConfigured = true;
+                Endpoint resultEndpoint = config.getResultEndpoint();
+                LOG.info("consuming from output: " + resultEndpoint + " to endpoint: " + result);
+
+                from(resultEndpoint).to(result);
+            }
+        };
+    }
+
+    @Test
+    public void integrationTest() throws Exception {
+        assertNotNull("config not injected!", config);
+        assertNotNull("MockEndpoint result not injected!", result);
+        assertTrue("RouteBuilder has not been configured!", routeConfigured);
+
+        result.expectedMessageCount(2);
+        result.assertIsSatisfied();
+    }
+
+    @Deployment
+    @TargetsContainer("weld-ee-embedded-1.1")
+    public static JavaArchive createDeployment() {
+
+        JavaArchive jar =  ShrinkWrap.create(JavaArchive.class)
+                .addPackage(CdiCamelContext.class.getPackage())
+                .addPackage(CamelExtension.class.getPackage())
+                .addPackage(MyRoutes.class.getPackage())
+                .addPackage(IntegrationTest.class.getPackage())
+                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+
+        // System.out.println(jar.toString(true));
+
+        return jar;
+    }
+
+}

Added: camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/jbossas/SeparateRouteBuilderIntegrationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/jbossas/SeparateRouteBuilderIntegrationTest.java?rev=1392822&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/jbossas/SeparateRouteBuilderIntegrationTest.java (added)
+++ camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/jbossas/SeparateRouteBuilderIntegrationTest.java Tue Oct  2 10:08:16 2012
@@ -0,0 +1,78 @@
+/**
+ * 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.apache.camel.example.cdi.two.jbossas;
+
+import org.apache.camel.cdi.CdiCamelContext;
+import org.apache.camel.cdi.internal.CamelExtension;
+import org.apache.camel.example.cdi.MyRoutes;
+import org.apache.camel.example.cdi.two.TestRouteBuilder;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.inject.Inject;
+
+import java.io.File;
+
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Lets use a separate {@link org.apache.camel.example.cdi.two.TestRouteBuilder} to test the routes
+ */
+@RunWith(Arquillian.class)
+public class SeparateRouteBuilderIntegrationTest {
+    @Inject
+    TestRouteBuilder testRouteBuilder;
+
+    @Test
+    public void integrationTest() throws Exception {
+        assertNotNull("testRouteBuilder not injected!", testRouteBuilder);
+
+        testRouteBuilder.assertIsSatisfied();
+    }
+
+    @Deployment
+    @TargetsContainer("jbossas-managed")
+    public static Archive<?> createTestArchive() {
+
+
+        JavaArchive jarTest = ShrinkWrap.create(JavaArchive.class)
+                .addPackage(MyRoutes.class.getPackage())
+                .addPackage(TestRouteBuilder.class.getPackage())
+                .addPackage(SeparateRouteBuilderIntegrationTest.class.getPackage())
+                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+
+        File[] libs = Maven.resolver()
+                .loadPomFromFile("pom.xml")
+                .resolve("org.apache.camel:camel-core","org.apache.camel:camel-cdi","org.apache.activemq:activemq-camel")
+                .withTransitivity()
+                .as(File.class);
+
+        return ShrinkWrap
+                .create(WebArchive.class, "test.war")
+                .addAsLibrary(jarTest)
+                .addAsLibraries(libs);
+    }
+}

Added: camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/weld/SeparateRouteBuilderIntegrationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/weld/SeparateRouteBuilderIntegrationTest.java?rev=1392822&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/weld/SeparateRouteBuilderIntegrationTest.java (added)
+++ camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/two/weld/SeparateRouteBuilderIntegrationTest.java Tue Oct  2 10:08:16 2012
@@ -0,0 +1,62 @@
+/**
+ * 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.apache.camel.example.cdi.two.weld;
+
+import org.apache.camel.cdi.CdiCamelContext;
+import org.apache.camel.cdi.internal.CamelExtension;
+import org.apache.camel.example.cdi.MyRoutes;
+import org.apache.camel.example.cdi.two.TestRouteBuilder;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.inject.Inject;
+
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Lets use a separate {@link org.apache.camel.example.cdi.two.TestRouteBuilder} to test the routes
+ */
+@RunWith(Arquillian.class)
+public class SeparateRouteBuilderIntegrationTest {
+    @Inject
+    TestRouteBuilder testRouteBuilder;
+
+    @Test
+    public void integrationTest() throws Exception {
+        assertNotNull("testRouteBuilder not injected!", testRouteBuilder);
+
+        testRouteBuilder.assertIsSatisfied();
+    }
+
+    @Deployment
+    @TargetsContainer("weld-ee-embedded-1.1")
+    public static JavaArchive createDeployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+                .addPackage(CdiCamelContext.class.getPackage())
+                .addPackage(CamelExtension.class.getPackage())
+                .addPackage(MyRoutes.class.getPackage())
+                .addPackage(TestRouteBuilder.class.getPackage())
+                .addPackage(SeparateRouteBuilderIntegrationTest.class.getPackage())
+                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+}

Added: camel/trunk/examples/camel-example-cdi/src/test/resources/arquillian.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/src/test/resources/arquillian.xml?rev=1392822&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cdi/src/test/resources/arquillian.xml (added)
+++ camel/trunk/examples/camel-example-cdi/src/test/resources/arquillian.xml Tue Oct  2 10:08:16 2012
@@ -0,0 +1,14 @@
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xmlns="http://jboss.org/schema/arquillian"
+            xsi:schemaLocation="http://jboss.org/schema/arquillian
+              http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+    <container qualifier="weld-ee-embedded-1.1"/>
+
+    <container qualifier="jbossas-managed">
+        <configuration>
+            <property name="jbossHome">target/jboss-as-7.1.1.Final</property>
+        </configuration>
+    </container>
+
+</arquillian>
\ No newline at end of file

Added: camel/trunk/examples/camel-example-cdi/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/src/test/resources/log4j.properties?rev=1392822&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cdi/src/test/resources/log4j.properties (added)
+++ camel/trunk/examples/camel-example-cdi/src/test/resources/log4j.properties Tue Oct  2 10:08:16 2012
@@ -0,0 +1,40 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, file
+
+#log4j.logger.org.apache.camel.component.cdi=DEBUG
+#log4j.logger.org.apache.openwebbeans=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+# MDC
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.file=target/camel-example-cdi-test.log
+log4j.appender.file.append=true
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+# MDC
+#log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n



Mime
View raw message