<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2011-2022 Lime Mojito Pty Ltd
  ~
  ~    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>

    <groupId>com.limemojito.oss.test</groupId>
    <artifactId>test-utilities</artifactId>
    <version>10.0.1</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>com.limemojito.oss.standards</groupId>
        <artifactId>jar-development</artifactId>
        <version>2.7.9</version>
        <relativePath />
    </parent>

    <properties>
        <bitbucket.url>https://bitbucket.org/limemojito/test-utilities</bitbucket.url>
        <git.url>git@bitbucket.org:limemojito/test-utilities.git</git.url>

        <!-- tests where appropriate, cover in released projects -->
        <coverage.line.ratio>0</coverage.line.ratio>
    </properties>

    <name>Lime Mojito Test utilities</name>
    <description>
        Test utilities for various development work. Json, reflection, getter/setter testing, DTO, Canonical form, etc. AWS support for Dyanamo DB,
        SQS, SNS, S3. Prometheus metrics reader and asserter. Synthetic S3 Event generation.
    </description>

    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <!-- Note this means that the aws-utilities framework can NOT depend on the test-framework -->
            <groupId>com.limemojito.oss.spring-boot</groupId>
            <artifactId>aws-utilities</artifactId>
            <version>10.0.2</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- Prefer AssertJ over Hamcrest -->
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-parameter-names</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jdk8</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webflux</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.github.tomakehurst</groupId>
            <artifactId>wiremock</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-dynamodb</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>io.awspring.cloud</groupId>
            <artifactId>spring-cloud-starter-aws-messaging</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>Start Localstack</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <configuration>
                                <target unless="${skipTests}">
                                    <echo level="info">Starting Localstack</echo>
                                    <exec executable="docker-compose" dir="${project.basedir}/src/test/docker" searchpath="true" spawn="true">
                                        <arg value="up" />
                                    </exec>
                                    <echo level="info">Waiting for combined services available</echo>
                                    <waitfor maxwait="2" maxwaitunit="minute">
                                        <http url="http://localhost:4566" errorsBeginAt="405" />
                                    </waitfor>
                                    <!--<echo level="info">Waiting for Elastisearch available</echo>
                                    <waitfor maxwait="2" maxwaitunit="minute">
                                        <http url="http://localhost:4571" errorsBeginAt="405" />
                                    </waitfor>-->
                                </target>
                            </configuration>
                        </execution>
                        <execution>
                            <id>Stop Localstack</id>
                            <!-- We run this slightly later so boot shuts down before docker -->
                            <phase>install</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <configuration>
                                <target unless="${skipTests}">
                                    <echo level="info">Stopping Localstack</echo>
                                    <exec executable="docker-compose" dir="${project.basedir}/src/test/docker" searchpath="true">
                                        <arg value="down" />
                                    </exec>
                                </target>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <!--
                 Spring Boot Support Example
                 <plugin>
                       <groupId>org.springframework.boot</groupId>
                       <artifactId>spring-boot-maven-plugin</artifactId>
                       <executions>
                           <execution>
                               <id>start-boot</id>
                               <phase>pre-integration-test</phase>
                               <goals>
                                   <goal>start</goal>
                               </goals>
                               <configuration>
                                   <profiles>integration-test</profiles>
                               </configuration>
                           </execution>
                           <execution>
                               <id>stop-boot</id>
                               <phase>post-integration-test</phase>
                               <goals>
                                   <goal>stop</goal>
                               </goals>
                           </execution>
                       </executions>
                   </plugin>-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <executions>
                        <execution>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>integration-test</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

  <scm>
    <tag>test-utilities-10.0.1</tag>
  </scm>
</project>
