<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-testsuite</artifactId>
        <version>5.0.1.Final</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <properties>
        <maven.compiler.parameters>true</maven.compiler.parameters>
        <container.base.dir.managed>${project.build.directory}${file.separator}${container.qualifier.managed}</container.base.dir.managed>
        <container.base.dir.managed.encoding>${project.build.directory}${file.separator}${container.qualifier.managed.encoding}</container.base.dir.managed.encoding>
        <container.base.dir.manual.gzip>${project.build.directory}${file.separator}${container.qualifier.manual.gzip}</container.base.dir.manual.gzip>
        <container.base.dir.manual.tracing>${project.build.directory}${file.separator}${container.qualifier.manual.tracing}</container.base.dir.manual.tracing>
        <container.base.dir.manual.ssl>${project.build.directory}${file.separator}${container.qualifier.manual.ssl}</container.base.dir.manual.ssl>
        <container.base.dir.manual.ssl.wrong>${project.build.directory}${file.separator}${container.qualifier.manual.ssl.wrong}</container.base.dir.manual.ssl.wrong>
        <container.base.dir.manual.ssl.wildcard>${project.build.directory}${file.separator}${container.qualifier.manual.ssl.wildcard}</container.base.dir.manual.ssl.wildcard>
        <container.base.dir.manual.ssl.sni>${project.build.directory}${file.separator}${container.qualifier.manual.ssl.sni}</container.base.dir.manual.ssl.sni>
        <container.offset.managed>0</container.offset.managed>
        <container.offset.manual.gzip>1000</container.offset.manual.gzip>
        <container.offset.manual.tracing>2000</container.offset.manual.tracing>
        <container.offset.manual.ssl>3000</container.offset.manual.ssl>
        <container.offset.manual.ssl.wrong>4000</container.offset.manual.ssl.wrong>
        <container.offset.manual.ssl.wildcard>5000</container.offset.manual.ssl.wildcard>
        <container.offset.manual.ssl.sni>6000</container.offset.manual.ssl.sni>
        <container.offset.managed.encoding>7000</container.offset.managed.encoding>
        <container.management.port.managed>9990</container.management.port.managed><!-- keep in sync with port offset -->
        <container.management.port.manual.gzip>10990</container.management.port.manual.gzip><!-- keep in sync with port offset -->
        <container.management.port.manual.tracing>11990</container.management.port.manual.tracing><!-- keep in sync with port offset -->
        <container.management.port.manual.ssl>12990</container.management.port.manual.ssl><!-- keep in sync with port offset -->
        <container.management.port.manual.ssl.wrong>13990</container.management.port.manual.ssl.wrong><!-- keep in sync with port offset -->
        <container.management.port.manual.ssl.wildcard>14990</container.management.port.manual.ssl.wildcard><!-- keep in sync with port offset -->
        <container.management.port.manual.ssl.sni>15990</container.management.port.manual.ssl.sni><!-- keep in sync with port offset -->
        <container.management.port.managed.encoding>16990</container.management.port.managed.encoding><!-- keep in sync with port offset -->
        <container.qualifier.managed>jbossas-managed</container.qualifier.managed>
        <container.qualifier.managed.encoding>jbossas-managed-encoding</container.qualifier.managed.encoding>
        <container.qualifier.manual.gzip>jbossas-manual-gzip</container.qualifier.manual.gzip>
        <container.qualifier.manual.tracing>jbossas-manual-tracing</container.qualifier.manual.tracing>
        <container.qualifier.manual.ssl>jbossas-manual-ssl</container.qualifier.manual.ssl>
        <container.qualifier.manual.ssl.wrong>jbossas-manual-ssl-wrong</container.qualifier.manual.ssl.wrong>
        <container.qualifier.manual.ssl.wildcard>jbossas-manual-ssl-wildcard</container.qualifier.manual.ssl.wildcard>
        <container.qualifier.manual.ssl.sni>jbossas-manual-ssl-sni</container.qualifier.manual.ssl.sni>
    </properties>

    <artifactId>resteasy-integration-tests</artifactId>
    <name>RESTEasy Main testsuite: Integration tests</name>

    <profiles>
        <!--
        Name:  download
        Descr: Download WildFly
        -->
        <profile>
          <id>download</id>
          <activation>
            <property>
              <name>!server.home</name>
            </property>
          </activation>
          <properties>
              <jboss.home>${project.build.directory}${file.separator}wildfly</jboss.home>
          </properties>
          <build>
            <plugins>
                <plugin>
                    <groupId>org.jboss.galleon</groupId>
                    <artifactId>galleon-maven-plugin</artifactId>
                    <configuration>
                        <install-dir>${jboss.home}</install-dir>
                        <skip>${skipTests}</skip>
                        <record-state>false</record-state>
                        <log-time>${galleon.log.time}</log-time>
                        <offline>${galleon.offline}</offline>
                        <plugin-options>
                            <jboss-maven-dist/>
                            <jboss-fork-embedded>${galleon.fork.embedded}</jboss-fork-embedded>
                        </plugin-options>
                        <feature-packs>
                            <feature-pack>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>galleon-feature-pack</artifactId>
                                <version>${project.version}</version>
                                <inherit-configs>false</inherit-configs>
                                <included-configs>
                                    <config>
                                        <model>standalone</model>
                                        <name>standalone-full.xml</name>
                                    </config>
                                    <config>
                                        <model>standalone</model>
                                        <name>standalone.xml</name>
                                    </config>
                                </included-configs>
                                <excluded-packages>
                                    <name>product.conf</name>
                                    <name>docs.schema</name>
                                    <name>appclient</name>
                                    <name>domain</name>
                                </excluded-packages>
                            </feature-pack>
                        </feature-packs>
                    </configuration>
                    <executions>
                        <execution>
                            <id>server-provisioning</id>
                            <phase>generate-test-resources</phase>
                            <goals>
                                <goal>provision</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
          </build>
        </profile>
        <profile>
            <id>skip.tracing.tests</id>
            <activation>
                <property>
                    <name>skip.tracing.tests</name>
                </property>
            </activation>
            <properties>
                <additional.surefire.exclude.tracing.tests>,org.jboss.resteasy.category.TracingRequired</additional.surefire.exclude.tracing.tests>
            </properties>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
            </exclusions>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>arquillian-utils</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-core-spi</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-stats</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-validator-provider</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-multipart-provider</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson2-provider</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-json-p-provider</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-json-binding-provider</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-atom-provider</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-cdi</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-crypto</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-wadl</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jdk-http</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-netty4</artifactId>
            <version>${project.version}</version>
        </dependency>
        
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-wadl-undertow-connector</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-html</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-tracing-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.ejb</groupId>
            <artifactId>jakarta.ejb-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.jms</groupId>
            <artifactId>jakarta.jms-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.el</groupId>
            <artifactId>jakarta.el-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpasyncclient</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.extras.creaper</groupId>
            <artifactId>creaper-core</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss.as</groupId>
                    <artifactId>jboss-as-controller-client</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jboss.as</groupId>
                    <artifactId>jboss-as-cli</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.wildfly.extras.creaper</groupId>
            <artifactId>creaper-commands</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.wildfly</groupId>
                    <artifactId>wildfly-patching</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-cli</artifactId>
        </dependency>

        <dependency>
            <groupId>io.reactivex.rxjava2</groupId>
            <artifactId>rxjava</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-rxjava2</artifactId>
            <version>${version.resteasy.testsuite}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-annotations</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-path</artifactId>
        </dependency>
    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>arquillian.xml</include>
                </includes>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
                <excludes>
                    <exclude>arquillian.xml</exclude>
                </excludes>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <configuration>
                    <skip>${skipTests}</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>initialize-basedirs</id>
                        <phase>process-test-resources</phase>
                        <configuration>
                            <target>
                                <!-- Initialize basedir for tested container by copying
                                     the original into new place.
                                     This helps to isolate the multiple running instances.
                                     One copy per each container in arquillian.xml -->

                                <delete quiet="true" dir="${container.base.dir.managed}" />
                                <copy todir="${container.base.dir.managed}" overwrite="true" failonerror="true">
                                    <fileset dir="${jboss.home}/standalone"/>
                                </copy>

                                <delete quiet="true" dir="${container.base.dir.manual.gzip}" />
                                <copy todir="${container.base.dir.manual.gzip}" overwrite="true" failonerror="true">
                                    <fileset dir="${jboss.home}/standalone"/>
                                </copy>
                                <delete quiet="true" dir="${container.base.dir.managed.encoding}" />
                                <copy todir="${container.base.dir.managed.encoding}" overwrite="true" failonerror="true">
                                    <fileset dir="${jboss.home}/standalone"/>
                                </copy>

                                <delete quiet="true" dir="${container.base.dir.manual.tracing}" />
                                <copy todir="${container.base.dir.manual.tracing}" overwrite="true" failonerror="true">
                                    <fileset dir="${jboss.home}/standalone"/>
                                </copy>

                                <delete quiet="true" dir="${container.base.dir.manual.ssl}" />
                                <copy todir="${container.base.dir.manual.ssl}" overwrite="true" failonerror="true">
                                    <fileset dir="${jboss.home}/standalone"/>
                                </copy>

                                <delete quiet="true" dir="${container.base.dir.manual.ssl.wrong}" />
                                <copy todir="${container.base.dir.manual.ssl.wrong}" overwrite="true" failonerror="true">
                                    <fileset dir="${jboss.home}/standalone"/>
                                </copy>

                                <delete quiet="true" dir="${container.base.dir.manual.ssl.wildcard}" />
                                <copy todir="${container.base.dir.manual.ssl.wildcard}" overwrite="true" failonerror="true">
                                    <fileset dir="${jboss.home}/standalone"/>
                                </copy>

                                <delete quiet="true" dir="${container.base.dir.manual.ssl.sni}" />
                                <copy todir="${container.base.dir.manual.ssl.sni}" overwrite="true" failonerror="true">
                                    <fileset dir="${jboss.home}/standalone"/>
                                </copy>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>prepare-tracing-configuration</id>
                        <phase>process-test-classes</phase>
                        <configuration>
                            <target>
                                <!-- Prepare configuration with more verbose logging for tracing tests -->
                                <copy file="${container.base.dir.manual.tracing}/configuration/standalone.xml"
                                      tofile="${container.base.dir.manual.tracing}/configuration/standalone-tracing.xml"/>
                                <replace
                                        file="${container.base.dir.manual.tracing}/configuration/standalone-tracing.xml">
                                    <replacetoken><![CDATA[="INFO"]]></replacetoken>
                                    <replacevalue><![CDATA[="DEBUG"]]></replacevalue>
                                </replace>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enable-elytron-full-cli</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>execute-commands</goal>
                        </goals>
                        <configuration>
                            <skip>${skipTests}</skip>
                            <jboss-home>${jboss.home}</jboss-home>
                            <offline>true</offline>
                            <scripts>
                                <script>${basedir}/../config/enable-elytron-full.cli</script>
                            </scripts>
                            <stdout>${project.build.directory}/elytron-config.out</stdout>
                            <system-properties>
                                <jboss.server.config.file.name>${jboss.server.config.file.name}</jboss.server.config.file.name>
                            </system-properties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                    <executions>

                        <!-- Re-evaluate https://issues.jboss.org/browse/RESTEASY-1884 in case we find ourselves
                             in need of adding additional execution. -->

                        <!-- default test execution -->
                        <execution>
                            <id>default-test</id>
                            <phase>test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                            <configuration>
                                <excludes>
                                    <!-- Tests requires excluding JsonBindingProvider-->
                                    <exclude>**/JsonBindingAnnotationsJacksonTest.java</exclude>
                                    <exclude>**/SseJsonEventTest</exclude>
                                </excludes>
                            </configuration>
                        </execution>


                        <!-- execution with excluded JSON-B -->
                        <execution>
                            <id>disable-jsonb-client</id>
                            <phase>test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                            <configuration>
                                <includes>
                                    <include>**/JsonBindingAnnotationsJacksonTest.java</include>
                                    <include>**/SseJsonEventTest.java</include>
                                    <include>**/ValidationJaxbTest.java</include>
                                </includes>
                                <classpathDependencyExcludes>
                                    <classpathDependencyExclude>org.jboss.resteasy:resteasy-json-binding-provider</classpathDependencyExclude>
                                </classpathDependencyExcludes>

                            </configuration>
                        </execution>

                    </executions>
            </plugin>

            <!-- generate archive needed by project resteasy-quarkus-testsuite -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>assembly/assembly.xml</descriptor>
                    </descriptors>
                    <finalName>resteasy-integration-tests-${project.version}-sources</finalName>
                    <appendAssemblyId>false</appendAssemblyId>
                </configuration>
                <executions>
                    <execution>
                        <id>trigger-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <configuration>
                    <groupId>org.jboss.resteasy</groupId>
                    <artifactId>resteasy-integration-tests</artifactId>
                    <version>${project.version}</version>
                    <packaging>zip</packaging>
                    <classifier>sources</classifier>
                    <file>${project.build.directory}/resteasy-integration-tests-${project.version}-sources.zip</file>
                </configuration>
                <executions>
                    <execution>
                        <id>install-assembly-zip</id>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <phase>install</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <!-- Required for PicketBox, once this is removed from WildFly this can be removed -->
        <repository>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </snapshots>
            <id>jboss-enterprise-maven-repository</id>
            <name>JBoss Enterprise Maven Repository</name>
            <url>https://maven.repository.redhat.com/ga/</url>
            <layout>default</layout>
        </repository>
    </repositories>
</project>
