<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2022, 2025 Contributors to the Eclipse Foundation.
    Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v. 2.0, which is available at
    http://www.eclipse.org/legal/epl-2.0.

    This Source Code may also be made available under the following Secondary
    Licenses when the conditions for such availability set forth in the
    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
    version 2 with the GNU Classpath Exception, which is available at
    https://www.gnu.org/software/classpath/license.html.

    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

-->

<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.eclipse.ee4j</groupId>
        <artifactId>project</artifactId>
        <version>1.0.9</version>
        <relativePath/>
    </parent>

    <groupId>org.eclipse.ee4j.security.tck</groupId>
    <artifactId>jakarta-security-tck</artifactId>
    <version>4.0.1</version>

    <packaging>pom</packaging>

    <name>Jakarta Security TCK - main</name>

    <!--
                M O D U L E S

                Each module represent a different test, with the exception of the "common"
                module which contains utility code.
<<<<<<< HEAD
                
                To print responses received by the tests (except those from the old TCK)
                
                execute with mvn ... -Dtck.log.response
                
=======

>>>>>>> refs/remotes/origin/3.x
    -->
    <modules>
        <module>common</module>

        <module>app-securitycontext</module>
        <module>app-securitycontext-auth</module>
        <module>app-securitycontext-customprincipal</module>

        <!-- app-[identity-store] -->
        <module>app-mem</module>
        <module>app-db</module>
        <module>app-ldap</module>
        <module>app-ldap2</module>
        <module>app-ldap3</module>
        <module>app-custom</module>
        <module>app-multiple-store</module>
        <module>app-multiple-store-backup</module>

        <!-- app-[authentication mechanism] (with build-in identity store) -->
        <module>app-openid</module>
        <module>app-openid2</module>
        <module>app-openid3</module>

        <!-- app-[identity-store]-[authentication mechanism] -->
        <module>app-mem-basic</module>
        <module>app-mem-basic-decorate</module>
        <module>app-mem-form</module>
        <module>app-mem-customform</module>

        <!-- app-[identity-store]-[service] -->
        <module>app-custom-session</module>
        <module>app-custom-rememberme</module>

        <module>app-custom-identity-store-handler</module>
        
        <!-- app-[authentication-mechanism]-[service] -->
        
        <!-- Overriding the default handler to delegate to two custom authentication 
             mechanisms 
        -->
        <module>app-custom-authentication-mechanism-handler</module>
        
        <!-- Overriding the default handler to delegate to three instances of the  
             basic authentication mechanisms 
        -->
        <module>app-custom-authentication-mechanism-handler2</module>

        
        <!-- Interaction with other technologies besides Servlet and CDI -->
        
        <!-- Securing Jakarta REST endpoints -->
        <module>app-jaxrs</module>
        
        <!-- Setting a Jakarta Authorization policy -->
        <module>app-mem-policy</module>
        <module>app-mem-policy2</module>
        
        <!-- 
            Runs a variety of tests using the old (javatest based) TCK.
            Historical note: the old TCK is actually partially newer than the new TCK.
            The project started with a series of Arquillian/JUnit based tests, but at the time
            the TCK process was not ready to adopt these. Javatest based tests were created
            based on these original Arquillian/JUnit tests and expanded upon.
         -->
        <module>old-tck</module>

        <!--
            Checks the API signature of the API module.
        -->
        <module>security-signaturetest</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        
        <maven.compiler.release>17</maven.compiler.release>
        
        <zipname>${project.artifactId}-${project.version}</zipname>
        <licenseFile>${project.basedir}/LICENSE_EFTL.md</licenseFile>
        <security-api.version>4.0.0</security-api.version>
        <arquillian.version>1.10.0.Final</arquillian.version>
        
        <buildDirectory>${project.basedir}/target</buildDirectory>

        <!-- Used for OpenID testing with Mitre -->
        <tomcat.version>9.0.108</tomcat.version>
        <tomcat.root>${project.build.directory}</tomcat.root>
        <tomcat.dir>${tomcat.root}/apache-tomcat-${tomcat.version}</tomcat.dir>
        <tomcat.pidfile>${tomcat.dir}/pidfile</tomcat.pidfile>
        <mitre.version>1.3.4</mitre.version>

        <!-- Below Servers need to be updated to their Jakarta.* versions and currently don't work -->
        <tomee.version>7.0.4</tomee.version>

        <!-- Note: Liberty 18.0.0.2+ has EE Security included -->
        <openliberty.version>18.0.0.1</openliberty.version>

        <jacc-provider.version>0.3</jacc-provider.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>${arquillian.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian.container</groupId>
                <artifactId>arquillian-container-test-api</artifactId>
                <version>${arquillian.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jboss.shrinkwrap.resolver</groupId>
                <artifactId>shrinkwrap-resolver-depchain</artifactId>
                <version>3.3.4</version>
                <scope>test</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>com.unboundid</groupId>
                <artifactId>unboundid-ldapsdk</artifactId>
                <version>7.0.2</version>
            </dependency>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <version>2.3.232</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>jakarta.security.enterprise</groupId>
            <artifactId>jakarta.security.enterprise-api</artifactId>
            <version>${security-api.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.authentication</groupId>
            <artifactId>jakarta.authentication-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.authorization</groupId>
            <artifactId>jakarta.authorization-api</artifactId>
            <version>3.0.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <version>6.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
            <version>4.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.interceptor</groupId>
            <artifactId>jakarta.interceptor-api</artifactId>
            <version>2.2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <version>3.1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>jakarta.el</groupId>
            <artifactId>jakarta.el-api</artifactId>
            <version>6.0.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <version>2.1.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <version>4.0.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.ejb</groupId>
            <artifactId>jakarta.ejb-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
            <version>4.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.faces</groupId>
            <artifactId>jakarta.faces-api</artifactId>
            <version>4.1.2</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>nimbus-jose-jwt</artifactId>
            <version>9.37.3</version>
        </dependency>




        <!-- Test dependencies which can be used in sub-modules -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.arquillian.protocol</groupId>
            <artifactId>arquillian-protocol-servlet</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.htmlunit</groupId>
            <artifactId>htmlunit</artifactId>
            <version>4.10.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.18.3</version><!--$NO-MVN-MAN-VER$-->
        </dependency>
    </dependencies>

    <build>
        <directory>${buildDirectory}</directory>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.4.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>3.5.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.21.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.8.6</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            
            <!-- Restricts the Java version to 17 -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.14.0</version>
                <configuration>
                    <release>17</release>
                    <compilerArgument>-Xlint:unchecked</compilerArgument>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <systemPropertyVariables>
                        <finalName>${project.build.finalName}</finalName>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>3.5.3</version>
                <executions>
                    <execution>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>failsafe-report-only</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>3.5.3</version>
                <configuration>
                    <skipSurefireReport>${skipSurefireReport}</skipSurefireReport>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

    <profiles>

        <!-- ### GlassFish ### -->

        <profile>
            <id>glassfish-ci-managed</id>

            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>

            <properties>
                <glassfish.version>8.0.0-SNAPSHOT</glassfish.version>
                <glassfish.arquillian.version>2.1.0</glassfish.arquillian.version>
                <glassfish.port>8080</glassfish.port>
                <glassfish.dirName>glassfish8</glassfish.dirName>
                <glassfish.root>${maven.multiModuleProjectDirectory}/target</glassfish.root>
                
                <glassfish.home>${glassfish.root}/${glassfish.dirName}</glassfish.home>
                <glassfish.javax.net.debug></glassfish.javax.net.debug>

                <trustStore.suffix>p12</trustStore.suffix>
                <trustStore.path>${glassfish.home}/glassfish/domains/domain1/config/cacerts.${trustStore.suffix}</trustStore.path>
                <trustStore.password>changeit</trustStore.password>
                
                <security.api.update>false</security.api.update>
                
                <soteria.update>false</soteria.update>
                <soteria.version>4.0.0</soteria.version>
                
                <!--
                    Exact artefact used by GlassFish that holds the API classes. The actual API
                    jar in the GlassFish root folder is installed to these coordinates below.
                    This is used by the signature test in module /security-signaturetest 
                -->
                <sigtest.api.groupId>jakarta.security</sigtest.api.groupId>
                <sigtest.api.artifactId>jakarta.security-vendor-api</sigtest.api.artifactId>
                <sigtest.api.version>${glassfish.version}</sigtest.api.version>
            </properties>

            <dependencies>
                <dependency>
                    <groupId>ee.omnifish.arquillian</groupId>
                    <artifactId>glassfish-client-ee10</artifactId>
                    <version>${glassfish.arquillian.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>ee.omnifish.arquillian</groupId>
                    <artifactId>arquillian-glassfish-server-managed</artifactId>
                    <version>${glassfish.arquillian.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.6.0</version>
                        <executions>
                            <execution>
                                <id>negate-prop</id>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>bsh-property</goal>
                                </goals>
                                <configuration>
                                    <source>
                                        soteria.noupdate = !${soteria.update};
                                        security.api.noupdate = !${security.api.update};
                                    </source>
                                    <properties>
                                        <property>soteria.noupdate</property>
                                        <property>security.api.noupdate</property>
                                    </properties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <skip>${skipITs}</skip>
                                    <outputDirectory>${glassfish.root}</outputDirectory>
                                    <markersDirectory>${glassfish.root}/dependency-maven-plugin-markers</markersDirectory>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.glassfish.main.distributions</groupId>
                                            <artifactId>glassfish</artifactId>
                                            <version>${glassfish.version}</version>
                                            <type>zip</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${glassfish.root}</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                            
                            <!-- Optionally update Security API jar in GlassFish -->
                            <execution>
                                <id>update-security-api</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <skip>${security.api.noupdate}</skip>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>jakarta.security.enterprise</groupId>
                                            <artifactId>jakarta.security.enterprise-api</artifactId>
                                            <version>${security-api.version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${glassfish.root}/glassfish8/glassfish/modules</outputDirectory>
                                            <destFileName>jakarta.security-api.jar</destFileName>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>

                            <!-- Optionally update Security IMPL (Soteria) jar in GlassFish -->
                            <execution>
                                <id>update-security-impl</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <skip>${soteria.noupdate}</skip>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.glassfish.soteria</groupId>
                                            <artifactId>soteria</artifactId>
                                            <version>${soteria.version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${glassfish.root}/glassfish8/glassfish/modules</outputDirectory>
                                            <destFileName>soteria.jar</destFileName>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.glassfish.soteria</groupId>
                                            <artifactId>soteria.spi.bean.decorator.weld</artifactId>
                                            <version>${soteria.version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${glassfish.root}/glassfish8/glassfish/modules</outputDirectory>
                                            <destFileName>soteria.spi.bean.decorator.weld.jar</destFileName>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <id>set-port</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <skip>${skipITs}</skip>
                                    <target>
                                        <echo level="info">Replacing in ${glassfish.home}</echo>
                                        <replace token="8080"
                                            value="${glassfish.port}"
                                            dir="${glassfish.home}/glassfish/domains/domain1/config/"
                                            summary="yes">
                                            <include name="domain.xml" />
                                        </replace>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    
                    <!--
                        Installs the jakarta.security.enterprise.jar from GF on the filesystem to the
                        coordinates expected by the signature test.
                    -->
                    <plugin>
                        <artifactId>maven-install-plugin</artifactId>
                        <version>3.1.3</version>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>install-file</goal>
                                </goals>
                                <configuration>
                                    <file>${glassfish.root}/glassfish8/glassfish/modules/jakarta.security.enterprise-api.jar</file>
                                    <groupId>${sigtest.api.groupId}</groupId>
                                    <artifactId>${sigtest.api.artifactId}</artifactId>
                                    <version>${sigtest.api.version}</version>
                                    <packaging>jar</packaging>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <glassfish.home>${glassfish.home}</glassfish.home>
                                <javax.net.ssl.trustStore>${trustStore.path}</javax.net.ssl.trustStore>
                                <javax.net.ssl.trustStorePassword>${trustStore.password}</javax.net.ssl.trustStorePassword>
                                <glassfish.systemProperties>
                                    javax.net.debug=${glassfish.javax.net.debug}
                                    javax.net.ssl.trustStorePassword=${trustStore.password}
                                </glassfish.systemProperties>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        
       
        <!-- ### Payara ### -->

        <profile>
            <id>payara-ci-managed</id>

            <properties>
                <payara.root>${maven.multiModuleProjectDirectory}/target</payara.root>
                <payara.version>6.2022.1</payara.version>
                <payara.arquillian.container.version>3.0.alpha7</payara.arquillian.container.version>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>fish.payara.arquillian</groupId>
                    <artifactId>arquillian-payara-server-managed</artifactId>
                    <version>${payara.arquillian.container.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>fish.payara.arquillian</groupId>
                    <artifactId>payara-client-ee9</artifactId>
                    <scope>test</scope>
                    <version>${payara.arquillian.container.version}</version>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${payara.root}</outputDirectory>
                                    <markersDirectory>${payara.root}/dependency-maven-plugin-markers</markersDirectory>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>fish.payara.distributions</groupId>
                                            <artifactId>payara</artifactId>
                                            <version>${payara.version}</version>
                                            <type>zip</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${payara.root}</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <payara.home>${payara.root}/payara6</payara.home>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>tomee</id>

            <repositories>
                <repository>
                    <id>apache.snapshots</id>
                    <url>https://repository.apache.org/content/repositories/snapshots/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>payara-patched-eclipse</id>
                    <url>https://raw.github.com/payara/Payara_PatchedProjects/eclipse/</url>
                </repository>
            </repositories>

            <dependencies>
                <dependency>
                    <groupId>org.apache.tomee</groupId>
                    <artifactId>apache-tomee</artifactId>
                    <version>${tomee.version}</version>
                    <type>zip</type>
                    <classifier>plus</classifier>
                    <scope>test</scope>
                </dependency>

                <dependency>
                    <groupId>org.apache.tomee</groupId>
                    <artifactId>arquillian-tomee-remote</artifactId>
                    <version>${tomee.version}</version>
                    <scope>test</scope>
                    <exclusions>
                        <exclusion>
                            <groupId>org.apache.tomee</groupId>
                            <artifactId>arquillian-openejb-transaction-provider</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <argLine>-DTOMEE_LOCK_FILE=${user.dir}/.tomee-ports.lock</argLine>
                            <systemPropertyVariables>
                                <tomee.stopPort>-1</tomee.stopPort>
                                <tomee.httpPort>-1</tomee.httpPort>
                                <tomee.httpsPort>-1</tomee.httpsPort>
                                <tomee.ajpPort>-1</tomee.ajpPort>

                                <tomee.dir>target/tomee/server</tomee.dir>
                                <tomee.appWorkingDir>target/tomee/arquillian</tomee.appWorkingDir>
                                <tomee.cleanOnStartUp>true</tomee.cleanOnStartUp>
                                <tomee.classifier>plus</tomee.classifier>
                                <tomee.properties>
                                    openejb.environment.default=true
                                    javax.security.jacc.policy.provider=org.omnifaces.jaccprovider.TestPolicy
                                    javax.security.jacc.PolicyConfigurationFactory.provider=org.omnifaces.jaccprovider.TestPolicyConfigurationFactory
                                </tomee.properties>
                                <!--<tomee.serverXml>../common/src/main/resources/tomee_server.xml</tomee.serverXml>-->
                                <tomee.conf>../common/src/main/resources/tomee</tomee.conf>
                                <tomee.additionalLibs>
                                    target/jacc-provider-tomee-bridge-0.3.jar
                                    target/jacc-provider-0.3.jar
                                    target/catalina.jar
                                </tomee.additionalLibs>
                                <tomee.cleanOnStartUp>false</tomee.cleanOnStartUp>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>Patch TomEE</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <!-- JACC Provider -->
                                        <artifactItem>
                                            <groupId>org.omnifaces</groupId>
                                            <artifactId>jacc-provider</artifactId>
                                            <version>${jacc-provider.version}</version>
                                            <type>jar</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                        </artifactItem>
                                        <!-- Patch some JACC issues -->
                                        <artifactItem>
                                            <groupId>org.omnifaces</groupId>
                                            <artifactId>jacc-provider-tomee-bridge</artifactId>
                                            <version>${jacc-provider.version}</version>
                                            <type>jar</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                        </artifactItem>
                                        <!-- Catalina patch for JASPIC issue -->
                                        <artifactItem>
                                            <groupId>org.apache.tomcat</groupId>
                                            <artifactId>tomcat-catalina</artifactId>
                                            <version>8.5-SNAPSHOT</version>
                                            <type>jar</type>
                                            <overWrite>false</overWrite>
                                            <destFileName>catalina.jar</destFileName>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>


        <profile>
            <id>openliberty</id>

            <dependencies>
                <dependency>
                    <groupId>io.openliberty.arquillian</groupId>
                    <artifactId>arquillian-liberty-managed</artifactId>
                    <version>1.0.8</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>io.openliberty</groupId>
                                            <artifactId>openliberty-runtime</artifactId>
                                            <version>${openliberty.version}</version>
                                            <type>zip</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.omnifaces</groupId>
                                            <artifactId>jacc-provider-liberty-bundle</artifactId>
                                            <version>${jacc-provider.version}</version>
                                            <type>jar</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}/jacc-provider-liberty-bundle</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.omnifaces</groupId>
                                            <artifactId>jacc-provider-liberty-bundle</artifactId>
                                            <version>0.2</version>
                                            <type>jar</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.1</version>
                        <executions>
                            <execution>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <!--  there has to be a better way... -->
                                        <echo>Configuring server</echo>
                                        <copy file="${project.build.directory}/jacc-provider-liberty-bundle/META-INF/testjacc.mf" tofile="${project.build.directory}/wlp/usr/extension/lib/features/testjacc.mf" />
                                        <copy file="${project.build.directory}/jacc-provider-liberty-bundle-${jacc-provider.version}.jar" tofile="${project.build.directory}/wlp/usr/extension/lib/testjacc.jar" />
                                        <copy file="../common/src/main/resources/server.xml" tofile="${project.build.directory}/wlp/templates/servers/defaultServer/server.xml" failOnError="false" />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.19.1</version>
                        <configuration>
                            <systemPropertyVariables>
                                <arquillian.server>liberty</arquillian.server>
                                <arquillian.launch>liberty</arquillian.launch>
                                <arquillian.liberty.wlpHome>${project.build.directory}/wlp</arquillian.liberty.wlpHome>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>payara-docker</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <version>0.39.1</version>
                        <configuration>
                            <images>
                                <image>
                                    <alias>payara</alias>
                                    <name>tck-samples/${project.artifactId}:payara</name>
                                    <build>
                                        <maintainer>Ivar Grimstad (ivar.grimstad@gmail.com)</maintainer>
                                        <from>payara/server-web:163</from>
                                        <assembly>
                                            <basedir>/opt/payara41/glassfish/domains/domain1/autodeploy/</basedir>
                                            <descriptorRef>artifact</descriptorRef>
                                        </assembly>
                                        <entryPoint>
                                            <arg>/opt/payara41/bin/asadmin</arg>
                                            <arg>start-domain</arg>
                                            <arg>-v</arg>
                                        </entryPoint>
                                    </build>
                                    <run>
                                        <ports>
                                            <port>8089:8080</port>
                                        </ports>
                                    </run>
                                </image>
                            </images>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
