<?xml version="1.0" encoding="UTF-8"?>
<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">
    <parent>
        <artifactId>weld-core-parent</artifactId>
        <groupId>org.jboss.weld</groupId>
        <version>3.1.1.Final</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>weld-jboss-runner-tck</artifactId>
    <name>CDI TCK runner (2.0) for Weld (WildFly)</name>
    <description>Aggregates dependencies and runs the CDI TCK (both standalone and on WildFly)</description>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <distribution>repo</distribution>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
        </license>
    </licenses>
    <url>http://weld.cdi-spec.org</url>

    <properties>
        <htmlunit.version>2.9</htmlunit.version>
        <shrinkwrap.version>1.0.1</shrinkwrap.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.weld</groupId>
            <artifactId>weld-core-impl</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.testng</groupId>
                    <artifactId>testng</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jboss.spec.javax.el</groupId>
                    <artifactId>jboss-el-api_3.0_spec</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.jboss.weld.module</groupId>
            <artifactId>weld-jsf</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.testng</groupId>
                    <artifactId>testng</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.jboss.weld.module</groupId>
            <artifactId>weld-ejb</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.weld</groupId>
            <artifactId>weld-porting-package-tck</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.cdi.tck</groupId>
            <artifactId>cdi-tck-api</artifactId>
            <version>${cdi.tck.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>el-api</artifactId>
                    <groupId>javax.el</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.jboss.cdi.tck</groupId>
            <artifactId>cdi-tck-impl</artifactId>
            <version>${cdi.tck.version}</version>
            <type>xml</type>
            <classifier>suite</classifier>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>el-api</artifactId>
                    <groupId>javax.el</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jsf-api</artifactId>
                    <groupId>javax.faces</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>container-se-api</artifactId>
                    <groupId>org.jboss.arquillian.container</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.jboss.cdi.tck</groupId>
            <artifactId>cdi-tck-impl</artifactId>
            <version>${cdi.tck.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>el-api</artifactId>
                    <groupId>javax.el</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jsf-api</artifactId>
                    <groupId>javax.faces</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>container-se-api</artifactId>
                    <groupId>org.jboss.arquillian.container</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.el</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.spec.javax.faces</groupId>
            <artifactId>jboss-jsf-api_2.3_spec</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-weld-dependencies</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeGroupIds>org.jboss.weld</includeGroupIds>
                            <includeArtifactIds>weld-porting-package-tck</includeArtifactIds>
                            <stripVersion>true</stripVersion>
                            <overWriteReleases>true</overWriteReleases>
                            <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4425695 -->
                    <argLine>-Xmx768m -Dsun.zip.disableMemoryMapping=true ${surefire.plugin.jdk9.args}</argLine>
                    <forkMode>once</forkMode>
                    <properties>
                        <property>
                            <name>usedefaultlisteners</name>
                            <value>false</value>
                        </property>
                    </properties>
                    <!-- https://issues.apache.org/jira/browse/SUREFIRE-569 -->
                    <dependenciesToScan>
                        <dependency>org.jboss.cdi.tck:cdi-tck-impl</dependency>
                    </dependenciesToScan>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-test-report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report-only</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <outputDirectory>${project.build.directory}/surefire-reports</outputDirectory>
                    <outputName>test-report</outputName>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>src/main/assembly/assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <!-- Disable annotation processor for test sources -->
                    <testCompilerArgument>-proc:none</testCompilerArgument>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>tck12</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>tck12</name>
                </property>
            </activation>
            <properties>
                <cdi.tck.version>${cdi.tck-1-2.version}</cdi.tck.version>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>src/test/tck12/tck-tests.xml</suiteXmlFile>
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>tck20</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>!tck12</name>
                </property>
            </activation>
            <properties>
                <cdi.tck.version>${cdi.tck-2-0.version}</cdi.tck.version>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>src/test/tck20/tck-tests.xml</suiteXmlFile>
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Run the TCK in standalone mode -->
        <profile>
            <id>weld-embedded</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>!incontainer</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-weld-embedded</artifactId>
                    <scope>test</scope>
                    <exclusions>
                        <exclusion>
                            <groupId>org.jboss.arquillian.core</groupId>
                            <artifactId>arquillian-core-spi</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.jboss.arquillian.container</groupId>
                            <artifactId>arquillian-container-test-spi</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.jboss.arquillian.core</groupId>
                            <artifactId>arquillian-core-api</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>javax.validation</groupId>
                    <artifactId>validation-api</artifactId>
                </dependency>
                <!-- Because we need this to compile the exception transformer and resource manager -->
                <dependency>
                    <groupId>org.wildfly.arquillian</groupId>
                    <artifactId>wildfly-arquillian-common</artifactId>
                </dependency>
            </dependencies>
            <build>
                <resources>
                    <resource>
                        <directory>src/test/resources</directory>
                    </resource>
                    <resource>
                        <directory>src/test/weld-embedded</directory>
                    </resource>
                </resources>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludedGroups>integration,javaee-full,se</excludedGroups>
                            <systemPropertyVariables>
                                <arquillian.launch>weld</arquillian.launch>
                                <!-- Specified system properties are not
                                    available during in-container test execution -->
                                <org.jboss.cdi.tck.libraryDirectory>target/dependency/lib</org.jboss.cdi.tck.libraryDirectory>
                                <org.jboss.cdi.tck.testDataSource>java:jboss/datasources/ExampleDS</org.jboss.cdi.tck.testDataSource>
                                <!-- Travis CI build workaround -->
                                <argLine>${travis.surefire.argLine}</argLine>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Run the TCK in the managed container (full Java EE platform) -->
        <profile>
            <id>incontainer</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>incontainer</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <excluded.groups>se</excluded.groups>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly.arquillian</groupId>
                    <artifactId>wildfly-arquillian-container-managed</artifactId>
                    <scope>test</scope>
                    <exclusions>
                        <exclusion>
                            <groupId>org.jboss.arquillian.core</groupId>
                            <artifactId>arquillian-core-spi</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.jboss.arquillian.core</groupId>
                            <artifactId>arquillian-core-api</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.jboss.logmanager</groupId>
                            <artifactId>log4j-jboss-logmanager</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.jboss.arquillian.protocol</groupId>
                    <artifactId>arquillian-protocol-servlet</artifactId>
                    <version>${arquillian.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </dependency>
            </dependencies>
            <build>
                <resources>
                    <resource>
                        <directory>src/test/resources</directory>
                    </resource>
                    <resource>
                        <directory>src/test/wildfly8</directory>
                    </resource>
                </resources>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludedGroups>${excluded.groups}</excludedGroups>
                            <systemPropertyVariables>
                                <!-- Silencing the broken code in getActiveConfiguration(),
                                    see https://github.com/arquillian/arquillian/blob/master/impl-base/src/main/java/org/jboss/arquillian/impl/client/container/ContainerRegistryCreator.java -->
                                <arquillian.launch>wildfly-8</arquillian.launch>
                                <!-- Specified system properties are not
                                    available during in-container test execution -->
                                <org.jboss.cdi.tck.libraryDirectory>target/dependency/lib</org.jboss.cdi.tck.libraryDirectory>
                                <org.jboss.cdi.tck.testDataSource>java:jboss/datasources/ExampleDS</org.jboss.cdi.tck.testDataSource>
                            </systemPropertyVariables>
                            <systemProperties>
                                <jacoco.agent>${jacoco.agent}</jacoco.agent>
                                <additional.vm.args>${additional.vm.args}</additional.vm.args>
                                <illegal.access.option>${surefire.plugin.jdk9.args}</illegal.access.option>
                            </systemProperties>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>weld-se</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>incontainer</name>
                    <value>se</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly.arquillian</groupId>
                    <artifactId>wildfly-arquillian-common</artifactId>
                </dependency>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>container-se-managed</artifactId>
                </dependency>
                <dependency>
                    <groupId>org.jboss.weld.se</groupId>
                    <artifactId>weld-se-shaded</artifactId>
                </dependency>
            </dependencies>

            <build>
                <resources>
                    <resource>
                        <directory>src/test/resources</directory>
                    </resource>
                    <resource>
                        <directory>src/test/weld-se</directory>
                    </resource>
                </resources>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-cdi-dependencies</id>
                                <phase>test-compile</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <stripVersion>true</stripVersion>
                                    <overWriteReleases>true</overWriteReleases>
                                    <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                    <includeGroupIds>org.jboss.weld.se</includeGroupIds>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <!-- arquillian group is workaround for ARQ-127 -->
                            <groups>se,arquillian</groups>
                            <systemPropertyVariables>
                                <arquillian.launch>weld-se</arquillian.launch>
                                <libPath>${project.build.outputDirectory}</libPath>
                                <surefire.plugin.jdk9.args>${surefire.plugin.jdk9.args}</surefire.plugin.jdk9.args>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Run only web profile tests -->
        <profile>
            <id>webprofile</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>webprofile</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <excluded.groups>javaee-full,se</excluded.groups>
            </properties>
        </profile>

        <profile>
            <id>jacoco</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>jacoco</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <exclude>org.jboss.cdi.tck.*</exclude>
                            </excludes>
                            <propertyName>jacoco.agent</propertyName>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!--This should probably be inside TCK itself in the future, remove if present there-->
        <profile>
            <!-- auto-activated profile for any JDK 9+ -->
            <id>jdk9+</id>
            <activation>
                <jdk>[9,)</jdk>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>javax.xml.ws</groupId>
                    <artifactId>jaxws-api</artifactId>
                    <version>${jax.artifacts.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.ws</groupId>
                    <artifactId>jaxws-ri</artifactId>
                    <version>${jax.artifacts.version}</version>
                    <type>zip</type>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-ri</artifactId>
                    <version>${jax.artifacts.version}</version>
                    <type>zip</type>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>javax.activation</groupId>
                    <artifactId>activation</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

</project>
