<?xml version="1.0" encoding="UTF-8"?>
<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>com.mulesoft.anypoint</groupId>
        <artifactId>api-gateway-tests</artifactId>
        <version>4.7.2</version>
    </parent>

    <artifactId>api-gateway-tests-integration</artifactId>
    <name>API Gateway Integration Tests</name>
    <packaging>pom</packaging>

    <modules>
        <module>test-dependencies</module>
        <module>analytics</module>
        <module>core-extensions</module>
        <module>policy-engine</module>
        <module>zero-downtime</module>
    </modules>

    <properties>
        <formatterConfigPath>../../formatter.xml</formatterConfigPath>
        <mockito.version>2.23.4</mockito.version> <!-- the other mockito version `mockitoVersion` makes the test fail -->
        <apiGatewayTitaArtifactsVersion>1.4.5</apiGatewayTitaArtifactsVersion>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-functional</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-runner</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.anypoint</groupId>
            <artifactId>tita-unit</artifactId>
            <version>${apiGatewayTitaVersion}</version>
            <scope>test</scope>
            <exclusions>
                <!-- Runtime artifacts need to come from api-gateway-tests-infrastructure -->
                <exclusion>
                    <groupId>org.mule.runtime</groupId>
                    <artifactId>mule-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.mulesoft.anypoint</groupId>
                    <artifactId>api-gateway-api</artifactId>
                </exclusion>
                <!-- This dependency messes up the logs -->
                <exclusion>
                    <groupId>com.github.valfirst</groupId>
                    <artifactId>slf4j-test</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- Jackson explicitly defined to resolve conflict between multiple versions from multiple dependencies. -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson2Version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
            <version>${jackson2Version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.jaxrs</groupId>
            <artifactId>jackson-jaxrs-json-provider</artifactId>
            <version>${jackson2Version}</version>
            <scope>test</scope>
        </dependency>


        <!-- Gateway dependencies -->
        <dependency>
            <groupId>com.mulesoft.anypoint</groupId>
            <artifactId>api-gateway-tests-infrastructure</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.mule.connectors</groupId>
                    <artifactId>mule-http-connector</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mockito</groupId>
                    <artifactId>mockito-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.mulesoft.mule.distributions</groupId>
                    <artifactId>mule-services-all</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.mulesoft.anypoint</groupId>
                    <artifactId>api-gateway-contract-service</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.mulesoft.anypoint</groupId>
                    <artifactId>api-gateway-events-collector-service</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.anypoint.tita</groupId>
            <artifactId>test-dependencies</artifactId>
            <version>${apiGatewayTitaArtifactsVersion}</version>
            <scope>test</scope>
        </dependency>

        <!-- MULE Dependencies -->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-deployment-model-impl</artifactId>
            <version>${muleVersion}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <!-- Other libs -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>fluent-hc</artifactId>
            <version>${httpclientVersion}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.apache.commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-junit4</artifactId>
            <version>${allureJunitVersion}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <reuseForks>false</reuseForks>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>integration-tests-as-cloudhub</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.mulesoft.anypoint</groupId>
                    <artifactId>s3-service-provider-gw</artifactId>
                    <version>${project.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

</project>
