<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~
  ~  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  ~
  ~  Copyright (c) 2022-2025 Payara Foundation and/or its affiliates. All rights reserved.
  ~
  ~  The contents of this file are subject to the terms of either the GNU
  ~  General Public License Version 2 only ("GPL") or the Common Development
  ~  and Distribution License("CDDL") (collectively, the "License").  You
  ~  may not use this file except in compliance with the License.  You can
  ~  obtain a copy of the License at
  ~  https://github.com/payara/Payara/blob/master/LICENSE.txt
  ~  See the License for the specific
  ~  language governing permissions and limitations under the License.
  ~
  ~  When distributing the software, include this License Header Notice in each
  ~  file and include the License file at glassfish/legal/LICENSE.txt.
  ~
  ~  GPL Classpath Exception:
  ~  The Payara Foundation designates this particular file as subject to the "Classpath"
  ~  exception as provided by the Payara Foundation in the GPL Version 2 section of the License
  ~  file that accompanied this code.
  ~
  ~  Modifications:
  ~  If applicable, add the following below the License Header, with the fields
  ~  enclosed by brackets [] replaced by your own identifying information:
  ~  "Portions Copyright [year] [name of copyright owner]"
  ~
  ~  Contributor(s):
  ~  If you wish your version of this file to be governed by only the CDDL or
  ~  only the GPL Version 2, indicate your decision by adding "[Contributor]
  ~  elects to include this software in this distribution under the [CDDL or GPL
  ~  Version 2] license."  If you don't indicate a single choice of license, a
  ~  recipient has the option to distribute your version of this file under
  ~  either the CDDL, the GPL Version 2 or to extend the choice of license to
  ~  its licensees as provided above.  However, if you add GPL Version 2 code
  ~  and therefore, elected the GPL Version 2 license, then the option applies
  ~  only if the new code is made subject to such option by the copyright
  ~  holder.
  ~
  -->

<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">
    <parent>
        <artifactId>security-connectors-parent</artifactId>
        <groupId>fish.payara.security.connectors</groupId>
        <version>4.0.0.Alpha2</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>openid-standalone-it</artifactId>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>fish.payara.api</groupId>
                <artifactId>payara-bom</artifactId>
                <version>${payara.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit-bom.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>${arquillian-bom.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>fish.payara.security.connectors</groupId>
            <artifactId>security-connectors-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>fish.payara.security.connectors</groupId>
            <artifactId>openid-standalone</artifactId>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

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


        <dependency>
            <groupId>jakarta.platform</groupId>
            <artifactId>jakarta.jakartaee-web-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>nimbus-jose-jwt</artifactId>
            <version>${nimbus-jose-jwt.version}</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.parsson</groupId>
            <artifactId>parsson</artifactId>
            <version>${parsson.version}</version>
        </dependency>
        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.security.enterprise</groupId>
            <artifactId>jakarta.security.enterprise-api</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-api-maven</artifactId>
            <version>${shrinkwrap-resolver.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-spi</artifactId>
            <version>${shrinkwrap-resolver.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-api-maven</artifactId>
            <version>${shrinkwrap-resolver.version}</version> <!-- Or the latest version -->
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
            <version>${shrinkwrap-resolver.version}</version> <!-- Or the latest version -->
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${maven-failsafe-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>payara-server-remote</id>
            <dependencies>
                <dependency>
                    <groupId>fish.payara.arquillian</groupId>
                    <artifactId>arquillian-payara-server-remote</artifactId>
                    <scope>test</scope>
                </dependency>

                <dependency>
                    <groupId>jakarta.xml.bind</groupId>
                    <artifactId>jakarta.xml.bind-api</artifactId>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>payara-server-managed</id>
            <dependencies>
                <dependency>
                    <groupId>fish.payara.arquillian</groupId>
                    <artifactId>arquillian-payara-server-managed</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <!-- download and unpack payara server -->
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${session.executionRootDirectory}/target</outputDirectory>
                                    <markersDirectory>
                                        ${session.executionRootDirectory}/target/dependency-maven-plugin-markers
                                    </markersDirectory>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>fish.payara.distributions</groupId>
                                            <artifactId>payara</artifactId>
                                            <type>zip</type>
                                            <version>${payara.version}</version>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${session.executionRootDirectory}/target</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- pass server location to test -->
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <!-- Pass location of server installation to arquillian container -->
                                <payara.home>${session.executionRootDirectory}/target/payara6</payara.home>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>payara-micro-managed</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>

                <dependency>
                    <groupId>fish.payara.arquillian</groupId>
                    <artifactId>arquillian-payara-micro-managed</artifactId>
                    <scope>test</scope>
                </dependency>

                <dependency>
                    <groupId>fish.payara.extras</groupId>
                    <artifactId>payara-micro</artifactId>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>payara-micro-remote</id>
            <dependencies>
                <dependency>
                    <groupId>fish.payara.arquillian</groupId>
                    <artifactId>arquillian-payara-micro-remote</artifactId>
                    <scope>test</scope>
                </dependency>

                <dependency>
                    <groupId>fish.payara.arquillian</groupId>
                    <artifactId>payara-micro-deployer</artifactId>
                    <scope>test</scope>
                    <type>war</type>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>deployer-for-tests</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>fish.payara.arquillian</groupId>
                                            <artifactId>payara-micro-deployer</artifactId>
                                            <type>war</type>
                                        </artifactItem>
                                    </artifactItems>
                                    <stripVersion>true</stripVersion>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>fish.payara.maven.plugins</groupId>
                        <artifactId>payara-micro-maven-plugin</artifactId>
                        <version>${payara-micro-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>start-test-instance</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                                <configuration>
                                    <daemon>true</daemon>
                                    <deployWar>false</deployWar>
                                    <commandLineOptions>
                                        <option>
                                            <key>--deploy</key>
                                            <value>${project.build.directory}/dependency/payara-micro-deployer.war
                                            </value>
                                        </option>
                                        <option>
                                            <key>--nocluster</key>
                                        </option>
                                        <option>
                                            <key>--logToFile</key>
                                            <value>${project.build.directory}/payara-micro.log</value>
                                        </option>
                                    </commandLineOptions>
                                </configuration>
                            </execution>
                            <execution>
                                <id>stop-test-instance</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <payaraVersion>${version.payara}</payaraVersion>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>