<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.apache.tomee</groupId>
    <artifactId>microprofile-tck</artifactId>
    <version>10.1.5</version>
  </parent>

  <artifactId>microprofile-openapi-tck</artifactId>
  <name>TomEE :: TCK :: MicroProfile Open API TCK</name>

  <build>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
      </testResource>
    </testResources>

    <plugins>
      <!-- we can't just set httpPort=-1 in arquillian.xml because we need to know the URL below to set as a system property
           so instead let's rely on build-helper plugin to reserve an actually free port for us -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>

        <executions>
          <execution>
            <id>reserve-tomee-port</id>

            <phase>generate-test-resources</phase>
            <goals>
              <goal>reserve-network-port</goal>
            </goals>

            <configuration>
              <portNames>
                <name>tomee.port</name>
              </portNames>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <!-- Updated version to fix hanging text -->
        <version>3.5.3</version>
        <configuration>
          <dependenciesToScan>
            <dependency>org.eclipse.microprofile.openapi:microprofile-openapi-tck</dependency>
          </dependenciesToScan>
          <systemPropertyVariables>
            <test.url>http://localhost:${tomee.port}</test.url>
          </systemPropertyVariables>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>mp-tck-all</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>tomee-plus</id>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <systemPropertyVariables>
                    <arquillian.launch>tomee-plus</arquillian.launch>
                  </systemPropertyVariables>
                </configuration>
              </execution>
              <execution>
                <id>tomee-plume</id>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <systemPropertyVariables>
                    <arquillian.launch>tomee-plume</arquillian.launch>
                  </systemPropertyVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>org.eclipse.microprofile.openapi</groupId>
      <artifactId>microprofile-openapi-api</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.eclipse.microprofile.openapi</groupId>
      <artifactId>microprofile-openapi-tck</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>jakarta.ws.rs</groupId>
          <artifactId>jakarta.ws.rs-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>apache-tomee</artifactId>
      <version>${project.version}</version>
      <type>zip</type>
      <classifier>microprofile</classifier>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>7.5.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <version>1.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tomee</groupId>
      <artifactId>ziplock</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.testng</groupId>
      <artifactId>arquillian-testng-container</artifactId>
      <version>1.10.1.Final</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.tomee</groupId>
      <artifactId>mp-common</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>arquillian-tomee-remote</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

</project>
