<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~
  ~ Copyright 2021 Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>resteasy-microprofile-parent</artifactId>
        <groupId>org.jboss.resteasy.microprofile</groupId>
        <version>3.0.1.Final</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>testsuite</artifactId>
    <packaging>pom</packaging>
    <name>RESTEasy MicroProfile: Test Suite</name>
    <properties>
        <jvm.debug.args/>
        <dep.arquillian-bom.version>1.7.2.Final</dep.arquillian-bom.version>
        <version.resteasy.testsuite>${version.org.jboss.resteasy}</version.resteasy.testsuite>
        <version.resteasy.microprofile.testsuite>${project.version}</version.resteasy.microprofile.testsuite>
        <!-- Galleon -->
        <jboss.home>${project.build.directory}${file.separator}wildfly</jboss.home>

        <!-- Feature Packs -->
        <server.version/>
        <wildfly.feature.pack.groupId>org.wildfly</wildfly.feature.pack.groupId>
        <wildfly.feature.pack.artifactId>wildfly-galleon-pack</wildfly.feature.pack.artifactId>

        <wildfly.channel.manifest.groupId>org.wildfly.channels</wildfly.channel.manifest.groupId>
        <wildfly.channel.manifest.artifactId>wildfly</wildfly.channel.manifest.artifactId>

        <resteasy.channel.manifest.groupId>dev.resteasy.channels</resteasy.channel.manifest.groupId>
        <resteasy.channel.manifest.artifactId>resteasy-6.2</resteasy.channel.manifest.artifactId>
        <resteasy.channel.manifest.version>${version.org.jboss.resteasy}</resteasy.channel.manifest.version>

        <resteasy.mp.channel.manifest.groupId>dev.resteasy.channels</resteasy.mp.channel.manifest.groupId>
        <resteasy.mp.channel.manifest.artifactId>resteasy-microprofile-${channel.stream.version}</resteasy.mp.channel.manifest.artifactId>
        <resteasy.mp.channel.manifest.version>${project.version}</resteasy.mp.channel.manifest.version>
        <jboss.arguments/>
    </properties>
    <modules>
        <module>integration-tests</module>
        <module>microprofile-rest-client-tck</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>resteasy-microprofile-test-bom</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
            <testResource>
                <directory>src/test/resources/filtered</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>
        <plugins>
            <!-- Disable the dependency convergence for now in testing -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>dep-convergence</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <configuration>
                    <provisioning-dir>${jboss.home}</provisioning-dir>
                    <offline>${galleon.offline}</offline>
                    <feature-packs>
                        <feature-pack>
                            <groupId>${wildfly.feature.pack.groupId}</groupId>
                            <artifactId>${wildfly.feature.pack.artifactId}</artifactId>
                            <inherit-configs>false</inherit-configs>
                            <included-configs>
                                <config>
                                    <model>standalone</model>
                                    <name>standalone.xml</name>
                                </config>
                            </included-configs>
                            <excluded-packages>
                                <name>docs.schema</name>
                                <name>appclient</name>
                                <name>domain</name>
                            </excluded-packages>
                        </feature-pack>
                    </feature-packs>
                    <channels>
                        <!-- If the server.version is blank the newest version of WildFly will be used. Otherwise, be
                             explicit.
                         -->
                        <channel>
                            <manifest>
                                <groupId>${wildfly.channel.manifest.groupId}</groupId>
                                <artifactId>${wildfly.channel.manifest.artifactId}</artifactId>
                                <version>${server.version}</version>
                            </manifest>
                        </channel>
                        <channel>
                            <manifest>
                                <groupId>${resteasy.channel.manifest.groupId}</groupId>
                                <artifactId>${resteasy.channel.manifest.artifactId}</artifactId>
                                <version>${resteasy.channel.manifest.version}</version>
                            </manifest>
                        </channel>
                        <channel>
                            <manifest>
                                <groupId>${resteasy.mp.channel.manifest.groupId}</groupId>
                                <artifactId>${resteasy.mp.channel.manifest.artifactId}</artifactId>
                                <version>${resteasy.mp.channel.manifest.version}</version>
                            </manifest>
                        </channel>
                    </channels>
                    <galleon-options>
                        <jboss-fork-embedded>${galleon.fork.embedded}</jboss-fork-embedded>
                        <jboss-maven-dist/>
                    </galleon-options>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>debug</id>
            <activation>
                <property>
                    <name>debug</name>
                </property>
            </activation>
            <properties>
                <debug.port>8787</debug.port>
                <jvm.debug.args>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:${debug.port}</jvm.debug.args>
            </properties>
        </profile>

        <profile>
            <id>wildfly-java-11</id>
            <activation>
                <jdk>(,17)</jdk>
            </activation>
            <properties>
                <server.version>34.0.1.Final</server.version>
            </properties>
        </profile>

        <profile>
            <id>provided.server</id>
            <activation>
                <property>
                    <name>server.home</name>
                </property>
            </activation>
            <properties>
                <jboss.home>${server.home}</jboss.home>
            </properties>
        </profile>
        <profile>
            <id>provision.server</id>
            <activation>
                <property>
                    <name>!server.home</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.wildfly.plugins</groupId>
                        <artifactId>wildfly-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>mp-server-provisioning</id>
                                <goals>
                                    <goal>provision</goal>
                                </goals>
                                <phase>generate-resources</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>provision.preview.server</id>
            <activation>
                <property>
                    <name>provision.preview</name>
                </property>
            </activation>

            <properties>
                <!-- Galleon -->
                <wildfly.feature.pack.artifactId>wildfly-preview-feature-pack</wildfly.feature.pack.artifactId>
                <wildfly.channel.manifest.artifactId>wildfly-preview</wildfly.channel.manifest.artifactId>
            </properties>
        </profile>
        <profile>
            <id>security.manager</id>
            <activation>
                <property>
                    <name>security.manager</name>
                </property>
            </activation>
            <properties>
                <jboss.arguments>-secmgr</jboss.arguments>
            </properties>
        </profile>
    </profiles>

</project>