<!--
  #%L
  Fuse Patch :: Distro
  %%
  Copyright (C) 2015 Private
  %%
  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.extras.patch</groupId>
        <artifactId>fuse-patch-itests</artifactId>
        <version>1.6.2</version>
    </parent>

    <name>Fuse Patch :: Integration Tests :: Standalone</name>

    <artifactId>fuse-patch-itests-standalone</artifactId>

    <!-- Properties -->
    <properties>
        <fusepatch.home>${project.build.directory}/fuse-patch-${project.version}</fusepatch.home>
        <jboss.home>${project.build.directory}/wildfly-${version.wildfly}</jboss.home>
        <jvmArgs>-Xmx1G -XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=true</jvmArgs>
        <jvmDebugArgs>-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n</jvmDebugArgs>
        <server.config>standalone.xml</server.config>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>org.wildfly.extras.patch</groupId>
            <artifactId>fuse-patch-config</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.wildfly.extras.patch</groupId>
            <artifactId>fuse-patch-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.gravia</groupId>
            <artifactId>gravia-resource</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wildfly.arquillian</groupId>
            <artifactId>wildfly-arquillian-container-managed</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>arquillian.xml</include>
                </includes>
            </testResource>
        </testResources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <systemPropertyVariables>
                            <jboss.home>${jboss.home}</jboss.home>
                        </systemPropertyVariables>
                        <redirectTestOutputToFile>false</redirectTestOutputToFile>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    
    <!-- Profiles -->
    <profiles>
    
        <!-- Test installer based Runtime (default) -->
        <profile>
            <id>no.fpack</id>
            <activation>
                <property>
                    <name>!fpack</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-wildfly</id>
                                <phase>process-test-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>copy-fuse-patch</id>
                                <phase>process-test-resources</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly.extras.patch</groupId>
                                            <artifactId>fuse-patch-installer</artifactId>
                                            <version>${project.version}</version>
                                            <outputDirectory>${jboss.home}</outputDirectory>
                                            <destFileName>fuse-patch-installer.jar</destFileName>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>install-fuse-patch</id>
                                <phase>process-test-resources</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>java</executable>
                                    <arguments>
                                        <argument>-jar</argument>
                                        <argument>${jboss.home}/fuse-patch-installer.jar</argument>
                                        <argument>${jboss.home}</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        
        <!-- Test feature-pack based Runtime -->
        <profile>
            <id>fpack</id>
            <activation>
                <property>
                    <name>fpack</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.wildfly.build</groupId>
                        <artifactId>wildfly-server-provisioning-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>server-provisioning</id>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <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.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
