<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2023 Johns Hopkins University
  ~
  ~ 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="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.pass</groupId>
    <artifactId>pass-support</artifactId>
    <version>1.2.0</version>
  </parent>

  <groupId>org.eclipse.pass</groupId>
  <artifactId>pass-grant-loader</artifactId>
  <packaging>pom</packaging>

  <modules>
    <module>pass-grant-cli</module>
    <module>pass-grant-data</module>
  </modules>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <scp.port>22</scp.port>
    <args4j.version>2.33</args4j.version>
    <commons-beanutils.version>1.9.4</commons-beanutils.version>
    <commons-codec.version>1.14</commons-codec.version>
    <commons.csv.version>1.8</commons.csv.version>
    <poi.version>4.1.2</poi.version>
    <greenmail.version>1.5.13</greenmail.version>
    <javax.mail.version>1.6.2</javax.mail.version>
    <ojdbc10.version>19.18.0.0</ojdbc10.version>
    <openpojo.version>0.8.13</openpojo.version>
    <unitils.version>3.4.6</unitils.version>
    <pass.core.port>8080</pass.core.port>
    <pass.core.url>http://localhost:8080</pass.core.url>
    <pass.core.user>backend</pass.core.user>
    <pass.core.password>backend</pass.core.password>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.eclipse.pass</groupId>
        <artifactId>pass-data-client</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>args4j</groupId>
        <artifactId>args4j</artifactId>
        <version>${args4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-csv</artifactId>
        <version>${commons.csv.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>${poi.version}</version>
      </dependency>
      <dependency>
        <groupId>com.icegreen</groupId>
        <artifactId>greenmail</artifactId>
        <version>${greenmail.version}</version>
      </dependency>
      <dependency>
        <groupId>com.oracle.database.jdbc</groupId>
        <artifactId>ojdbc10</artifactId>
        <version>${ojdbc10.version}</version>
      </dependency>
      <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>${commons-codec.version}</version>
      </dependency>
      <dependency>
        <groupId>com.sun.mail</groupId>
        <artifactId>javax.mail</artifactId>
        <version>${javax.mail.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${logback.version}</version>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.unitils</groupId>
        <artifactId>unitils-core</artifactId>
        <version>${unitils.version}</version>
        <scope>test</scope>
        <exclusions>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>${commons-beanutils.version}</version>
        <exclusions>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>com.openpojo</groupId>
        <artifactId>openpojo</artifactId>
        <version>${openpojo.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${build-helper-maven-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven-dependency-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${maven-failsafe-plugin.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <systemPropertyVariables>
              <pass.core.url>${pass.core.url}</pass.core.url>
              <pass.core.user>${pass.core.user}</pass.core.user>
              <pass.core.password>${pass.core.password}</pass.core.password>
            </systemPropertyVariables>
          </configuration>
        </plugin>

        <plugin>
          <groupId>io.fabric8</groupId>
          <artifactId>docker-maven-plugin</artifactId>
          <executions>
            <execution>
              <id>start</id>
              <phase>pre-integration-test</phase>
              <goals>
                <goal>start</goal>
              </goals>
            </execution>
            <execution>
              <id>stop</id>
              <phase>post-integration-test</phase>
              <goals>
                <goal>stop</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <images>
              <image>
                <name>ghcr.io/eclipse-pass/pass-core-main:%v</name>
                <run>
                  <env>
                    <PASS_CORE_BASE_URL>${pass.core.url}</PASS_CORE_BASE_URL>
                    <PASS_CORE_BACKEND_USER>${pass.core.user}</PASS_CORE_BACKEND_USER>
                    <PASS_CORE_BACKEND_PASSWORD>${pass.core.password}</PASS_CORE_BACKEND_PASSWORD>
                  </env>
                  <wait>
                    <http>
                      <url>
                        ${pass.core.url}/data/grant
                      </url>
                      <status>401</status>
                    </http>
                    <time>60000</time>
                  </wait>
                  <ports>
                    <port>${pass.core.port}:${pass.core.port}</port>
                  </ports>
                </run>
              </image>
            </images>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>
