<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  Wildfly Camel Patch
  %%
  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%
  --><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>

    <parent>
        <groupId>org.wildfly.camel</groupId>
        <artifactId>wildfly-camel-example</artifactId>
        <version>2.2.0.redhat-620133</version>
    </parent>

    <name>Wildfly Camel :: Example :: Projects</name>

    <artifactId>wildfly-camel-example-projects</artifactId>
	<packaging>pom</packaging>

	<!-- Modules -->
	<modules>
        <module>camel-activemq</module>
        <module>camel-cxf</module>
        <module>camel-cdi</module>
        <module>camel-mail</module>
        <module>camel-jaxws</module>
        <module>camel-jms</module>
        <module>camel-jpa</module>
        <module>camel-rest</module>
        <module>camel-transacted-jms</module>
	</modules>

    <!-- Properties -->
    <properties>
        <jboss.home>${project.build.directory}/jboss-eap-6.4</jboss.home>
        <jboss.data.dir>${jboss.home}/standalone/data</jboss.data.dir>
        <server.config>standalone-camel-examples.xml</server.config>
        <jvmArgs>-Xmx1G -XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=true</jvmArgs>
        <jvmDebugArgs>-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n</jvmDebugArgs>
    </properties>

    <!-- Dependencies -->
    <dependencies>
        <dependency>
            <groupId>com.icegreen</groupId>
            <artifactId>greenmail-webapp</artifactId>
            <version>${version.greenmail}</version>
            <type>war</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.wildfly.camel</groupId>
            <artifactId>wildfly-camel-itests-common</artifactId>
            <version>2.2.0.redhat-620133</version>
            <scope>test</scope>
        </dependency>
        <!-- [TODO] Remove explicit xnio override -->
        <dependency>
            <groupId>org.jboss.xnio</groupId>
            <artifactId>xnio-api</artifactId>
            <version>${version.jboss.xnio}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.xnio</groupId>
            <artifactId>xnio-nio</artifactId>
            <version>${version.jboss.xnio}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
	<!-- Build -->
	<build>
		<plugins>
	        <plugin>
	            <groupId>org.apache.maven.plugins</groupId>
	            <artifactId>maven-surefire-plugin</artifactId>
	            <configuration>
	                <skip>true</skip>
	            </configuration>
	        </plugin>
		</plugins>
	</build>
	
	<!-- Profiles -->
	<profiles>
		<profile>
			<id>ts.all</id>
			<activation>
				<property>
					<name>ts.all</name>
				</property>
			</activation>
			<build>
				<plugins>
		            <plugin>
		                <groupId>org.apache.maven.plugins</groupId>
		                <artifactId>maven-dependency-plugin</artifactId>
		                <executions>
                            <execution>
                                <id>unpack-distro</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <!-- distro unpacking not inherited -->
                                <inherited>false</inherited>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly.camel</groupId>
                                            <artifactId>wildfly-camel-example-distro</artifactId>
                                            <version>${project.version}</version>
                                            <type>tar</type>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
		                </executions>
		            </plugin>
		            <plugin>
		                <groupId>org.wildfly.plugins</groupId>
		                <artifactId>wildfly-maven-plugin</artifactId>
		                <configuration>
		                    <jbossHome>${jboss.home}</jbossHome>
		                    <serverConfig>${server.config}</serverConfig>
		                    <port>9999</port>
		                </configuration>
		                <executions>
		                    <execution>
		                        <id>wildfly-start</id>
		                        <phase>pre-integration-test</phase>
		                        <goals>
		                            <goal>start</goal>
		                        </goals>
                                <!-- wildfly startup not inherited -->
			              		<inherited>false</inherited>
        		                <configuration>
                                    <jbossHome>${jboss.home}</jbossHome>
                                    <serverConfig>${server.config}</serverConfig>
                                    <jvmArgs>${jvmArgs} ${jvmDebugArgs}</jvmArgs>
        		                </configuration>
		                    </execution>
                            <execution>
                                <id>greenmail-deploy</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>deploy-artifact</goal>
                                </goals>
                                <!-- greenmail deployment not inherited -->
                                <inherited>false</inherited>
                                <configuration>
                                    <groupId>com.icegreen</groupId>
                                    <artifactId>greenmail-webapp</artifactId>
                                    <version>${version.greenmail}</version>
                                    <type>war</type>
                                    <artifactId>greenmail-webapp</artifactId>
                                </configuration>
                            </execution>
		                </executions>
		            </plugin>
			        <plugin>
			            <groupId>org.apache.maven.plugins</groupId>
			            <artifactId>maven-surefire-plugin</artifactId>
			            <executions>
			                <execution>
			                    <phase>integration-test</phase>
			                    <goals>
			                        <goal>test</goal>
			                    </goals>
			                    <configuration>
			                        <skip>false</skip>
                                    <systemPropertyVariables>
                                        <jboss.data.dir>${jboss.data.dir}</jboss.data.dir>
                                    </systemPropertyVariables>
			                    </configuration>
			                </execution>
			            </executions>
			        </plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>no.ts.all</id>
			<activation>
				<property>
					<name>!ts.all</name>
				</property>
			</activation>
			<build>
				<plugins>
		            <plugin>
		                <groupId>org.apache.maven.plugins</groupId>
		                <artifactId>maven-dependency-plugin</artifactId>
		                <executions>
                            <execution>
                                <id>unpack-distro</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly.camel</groupId>
                                            <artifactId>wildfly-camel-example-distro</artifactId>
                                            <version>${project.version}</version>
                                            <type>tar</type>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
		                </executions>
		            </plugin>
		            <plugin>
		                <groupId>org.wildfly.plugins</groupId>
		                <artifactId>wildfly-maven-plugin</artifactId>
		                <configuration>
		                    <jbossHome>${jboss.home}</jbossHome>
		                    <serverConfig>${server.config}</serverConfig>
		                    <port>9999</port>
		                </configuration>
		                <executions>
		                    <execution>
		                        <id>wildfly-start</id>
		                        <phase>pre-integration-test</phase>
		                        <goals>
		                            <goal>start</goal>
		                        </goals>
                                <configuration>
                                    <jbossHome>${jboss.home}</jbossHome>
                                    <serverConfig>${server.config}</serverConfig>
                                    <jvmArgs>${jvmArgs} ${jvmDebugArgs}</jvmArgs>
                                </configuration>
		                    </execution>
                            <execution>
                                <id>greenmail-deploy</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>deploy-artifact</goal>
                                </goals>
                                <configuration>
                                    <groupId>com.icegreen</groupId>
                                    <artifactId>greenmail-webapp</artifactId>
                                    <version>${version.greenmail}</version>
                                    <type>war</type>
                                    <artifactId>greenmail-webapp</artifactId>
                                </configuration>
                            </execution>
		                </executions>
		            </plugin>
			        <plugin>
			            <groupId>org.apache.maven.plugins</groupId>
			            <artifactId>maven-surefire-plugin</artifactId>
			            <executions>
			                <execution>
			                    <phase>integration-test</phase>
			                    <goals>
			                        <goal>test</goal>
			                    </goals>
			                    <configuration>
			                        <skip>false</skip>
                                    <systemPropertyVariables>
                                        <jboss.data.dir>${jboss.data.dir}</jboss.data.dir>
                                    </systemPropertyVariables>
			                    </configuration>
			                </execution>
			            </executions>
			        </plugin>
				</plugins>
			</build>
		</profile>
    </profiles>
</project>
