<?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</artifactId>
        <version>2.3.0</version>
    </parent>

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

    <artifactId>wildfly-camel-example</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}/wildfly-${version.wildfly}</jboss.home>
        <jboss.data.dir>${jboss.home}/standalone/data</jboss.data.dir>
        <server.config>standalone-full-camel.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>
        <log4j.configuration>file://${basedir}/src/test/resources/logging.properties</log4j.configuration>
    </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>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
    <!-- Repositories -->
    <repositories>
        <repository>
            <id>jboss-public-repository</id>
            <url>http://repository.jboss.org/nexus/content/groups/public/</url>
        </repository>
    </repositories>
    
    <!-- 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>
                        <!-- unpacking not inherited -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-wildfly</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <inherited>false</inherited>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly</groupId>
                                            <artifactId>wildfly-dist</artifactId>
                                            <version>${version.wildfly}</version>
                                            <type>zip</type>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                            <overWrite>false</overWrite>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                            <execution>
                                <id>unpack-patch</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <inherited>false</inherited>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly.camel</groupId>
                                            <artifactId>wildfly-camel-patch</artifactId>
                                            <version>${project.version}</version>
                                            <type>tar.gz</type>
                                            <outputDirectory>${jboss.home}</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <!-- wildfly startup and deployment not inherited -->
                        <groupId>org.wildfly.plugins</groupId>
                        <artifactId>wildfly-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>wildfly-start</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                                <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>
                                <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>
                                        <log4j.configuration>${log4j.configuration}</log4j.configuration>
                                    </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-wildfly</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly</groupId>
                                            <artifactId>wildfly-dist</artifactId>
                                            <version>${version.wildfly}</version>
                                            <type>zip</type>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                            <overWrite>false</overWrite>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                            <execution>
                                <id>unpack-patch</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly.camel</groupId>
                                            <artifactId>wildfly-camel-patch</artifactId>
                                            <version>${project.version}</version>
                                            <type>tar.gz</type>
                                            <outputDirectory>${jboss.home}</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.wildfly.plugins</groupId>
                        <artifactId>wildfly-maven-plugin</artifactId>
                        <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>
                                        <log4j.configuration>${log4j.configuration}</log4j.configuration>
                                    </systemPropertyVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
