<?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">
    <parent>
        <artifactId>mule-ee-embedded</artifactId>
        <groupId>com.mulesoft.mule.distributions</groupId>
        <version>4.7.4</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>embedded-jpms-test</artifactId>

    <properties>
        <javaModuleName>com.mulesoft.mule.distribution.embedded.jpms.test</javaModuleName>
        <formatterConfigPath>../../formatter.xml</formatterConfigPath>

        <skipMuleModuleMojos>true</skipMuleModuleMojos>

        <settingsFile>${java.io.tmpdir}/effective-settings.xml</settingsFile>
        <packagerVersion>4.2.0</packagerVersion>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-help-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>process-test-resources</phase>
                        <id>copy-settings</id>
                        <goals>
                            <goal>effective-settings</goal>
                        </goals>
                        <configuration>
                            <output>${settingsFile}</output>
                            <showPasswords>true</showPasswords>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-test-jar</id>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>-Dfile.encoding=UTF-8 -Xmx1024m -Xms256m -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectjVersion}/aspectjweaver-${aspectjVersion}.jar -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile='${session.executionRootDirectory}/target/jacoco.exec'</argLine>
                    <workingDirectory>${project.build.directory}</workingDirectory>
                    <properties>
                        <property>
                            <name>listener</name>
                            <value>io.qameta.allure.junit4.AllureJunit4</value>
                        </property>
                    </properties>
                    <systemProperties>
                        <property>
                            <name>allure.results.directory</name>
                            <value>${project.build.directory}/allure-results</value>
                        </property>
                    </systemProperties>
                    <systemPropertyVariables>
                        <settings.file>${settingsFile}</settings.file>
                        <maven.home>${maven.home}</maven.home>
                        <mule.version>${project.version}</mule.version>
                    </systemPropertyVariables>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectjVersion}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
        <testResources>
            <testResource>
                <!-- EE-5931: Workaround to only filter/replace maven properties in the pom.xml of the apps
                     and not in the app configs or other files -->
                <directory>src/test/resources/</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/pom.xml</include>
                    <include>**/mule-artifact.json</include>
                </includes>
            </testResource>
            <testResource>
                <directory>src/test/resources/</directory>
            </testResource>
        </testResources>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-artifact</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-unit</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-infrastructure</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Allure annotations -->
        <dependency>
            <groupId>com.mulesoft.mule.tests</groupId>
            <artifactId>mule-tests-allure</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>fluent-hc</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>
