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

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.wildfly.camel</groupId>
        <artifactId>wildfly-camel-itests</artifactId>
        <version>5.0.0</version>
    </parent>

    <name>Wildfly Camel :: Testsuite :: Standalone</name>

    <artifactId>wildfly-camel-itests-standalone</artifactId>
    <packaging>pom</packaging>

    <!-- Properties -->
    <properties>
        <jboss.home>${project.build.directory}/wildfly-${version.wildfly}</jboss.home>
        <jvmArgs>-Xmx1G -XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=true -Djava.security.egd=file:/dev/./urandom</jvmArgs>
        <jvmDebugArgs>-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n</jvmDebugArgs>
    </properties>
    
    <!-- Dependencies -->
    <dependencies>
        <dependency>
            <groupId>org.wildfly.camel</groupId>
            <artifactId>wildfly-camel-itests-common</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.wildfly.camel</groupId>
            <artifactId>wildfly-camel-testenricher</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-depchain</artifactId>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.wildfly.arquillian</groupId>
            <artifactId>wildfly-arquillian-container-managed</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
    </dependencies>
    
    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>false</filtering>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>arquillian.xml</include>
                </includes>
            </testResource>
        </testResources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.wildfly.build</groupId>
                    <artifactId>wildfly-server-provisioning-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>server-provisioning</id>
                            <phase>generate-test-resources</phase>
                            <goals>
                                <goal>build</goal>
                            </goals>
                            <configuration>
                                <config-file>src/test/resources/server-provisioning.xml</config-file>
                                <server-name>wildfly-${version.wildfly}</server-name>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>run-fuseconfig</id>
                            <phase>generate-test-resources</phase>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                            <configuration>
                                <executable>java</executable>
                                <environmentVariables>
                                    <JBOSS_HOME>${jboss.home}</JBOSS_HOME>
                                </environmentVariables>
                                <commandlineArgs>-jar ${jboss.home}/jboss-modules.jar -mp ${jboss.home}/modules org.wildfly.extras.config --configs camel --enable</commandlineArgs>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <environmentVariables>
                        <JBOSS_HOME>${jboss.home}</JBOSS_HOME>
                    </environmentVariables>
                    <systemPropertyVariables>
                        <jboss.home.dir>${jboss.home}</jboss.home.dir>
                        <derby.stream.error.file>${project.build.directory}/derby.log</derby.stream.error.file>
                    </systemPropertyVariables>
                    <redirectTestOutputToFile>false</redirectTestOutputToFile>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    <!-- Profiles -->
    <profiles>
        <profile>
            <id>debug</id>
            <activation>
                <property>
                    <name>debug</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>process-test-resources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <target>
                                        <echo message="Setting log level to DEBUG" />
                                        <replaceregexp file="${jboss.home}/standalone/configuration/${server.config}" match="INFO" replace="DEBUG" byline="true" />
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Requires DOCKER_HOST -->
            <id>docker</id>
            <activation>
                <property>
                    <name>docker</name>
                </property>
            </activation>
            <modules>
                <module>docker</module>
            </modules>
        </profile>
        <profile>
            <id>no.ts.smoke</id>
            <activation>
                <property>
                    <name>!no.ts.smoke</name>
                </property>
            </activation>
            <modules>
                <module>smoke</module>
            </modules>
        </profile>
        <profile>
            <id>ts.basic</id>
            <activation>
                <property>
                    <name>ts.basic</name>
                </property>
            </activation>
            <modules>
                <module>basic</module>
            </modules>
        </profile>
        <profile>
            <id>ts.extra</id>
            <activation>
                <property>
                    <name>ts.extra</name>
                </property>
            </activation>
            <modules>
                <module>extra</module>
            </modules>
        </profile>
        <profile>
            <id>ts.all</id>
            <activation>
                <property>
                    <name>ts.all</name>
                </property>
            </activation>
            <modules>
                <module>smoke</module>
                <module>basic</module>
                <module>extra</module>
                <module>docker</module>
            </modules>
        </profile>
    </profiles>
</project>
