<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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.mulesoft.modules</groupId>
    <artifactId>mule-wss-module</artifactId>
    <version>0.8.5</version>
    <packaging>mule-extension</packaging>

    <name>Web Service Security Module</name>
    <description>A Mule extension that provides functionality for applying security to Web Services</description>

    <parent>
        <groupId>org.mule.extensions</groupId>
        <artifactId>mule-ee-core-modules-parent</artifactId>
        <version>1.1.3</version>
    </parent>

    <properties>
        <licenseYear>2019</licenseYear>
        <commons.lang.version>3.8.1</commons.lang.version>
        <org.apache.santuario>2.1.2</org.apache.santuario>
        <wss4j.version>2.2.3</wss4j.version>
        <xml.beans.version>2.6.0</xml.beans.version>
        <spring.version>4.2.12.RELEASE</spring.version>

        <formatterConfigPath>formatter.xml</formatterConfigPath>

        <!-- Remove when a new parent version with MTF is available -->
        <munit.input.directory>src/test/munit</munit.input.directory>
        <munit.output.directory>${basedir}/target/test-mule/munit</munit.output.directory>
        <munit.extensions.maven.plugin.version>1.0.0</munit.extensions.maven.plugin.version>
        <munit.version>2.2.3</munit.version>

        <docker.maven.plugin.version>0.25.2</docker.maven.plugin.version>
        <docker.skip>${skipTests}</docker.skip>
        <powermock.version>1.7.4</powermock.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-ldap</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.santuario</groupId>
            <artifactId>xmlsec</artifactId>
            <version>${org.apache.santuario}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.wss4j</groupId>
            <artifactId>wss4j-ws-security-dom</artifactId>
            <version>${wss4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlbeans</groupId>
            <artifactId>xmlbeans</artifactId>
            <version>${xml.beans.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons.lang.version}</version>
        </dependency>

        <!--testing-->
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <distributionManagement>
        <repository>
            <id>mule-ee-releases</id>
            <name>Mule Release Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases-ee</url>
        </repository>
        <snapshotRepository>
            <id>mule-ee-snapshots</id>
            <name>Mule Snapshot Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-snapshots</url>
            <uniqueVersion>false</uniqueVersion>
        </snapshotRepository>
    </distributionManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${docker.maven.plugin.version}</version>
                <configuration>
                    <images>
                        <image>
                            <name>rroemhild/test-openldap</name>
                            <build>
                                <dockerFileDir>${project.basedir}</dockerFileDir>
                            </build>
                            <run>
                                <ports>
                                    <port>ldap.port:389</port>
                                </ports>
                                <log>
                                    <enabled>false</enabled>
                                </log>
                            </run>
                        </image>
                    </images>
                    <verbose>true</verbose>
                </configuration>
                <executions>
                    <execution>
                        <id>start</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>build</goal>
                            <goal>start</goal>
                        </goals>
                        <configuration>
                            <showLogs>false</showLogs>
                            <logStdout>false</logStdout>
                        </configuration>
                    </execution>
                    <!--https://github.com/fabric8io/docker-maven-plugin/issues/915, if tests fail, run docker stop <CONTAINER_ID>-->
                    <execution>
                        <id>stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-munit-resources</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${munit.output.directory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${munit.input.directory}</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.mulesoft.munit</groupId>
                <artifactId>munit-extensions-maven-plugin</artifactId>
                <version>${munit.extensions.maven.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>integration-test</phase>
                    </execution>
                </executions>
                <configuration>
                    <argLines>
                        <argLine>
                            -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${session.executionRootDirectory}/target/jacoco.exec
                        </argLine>
                    </argLines>
                    <runtimeConfiguration>
                        <discoverRuntimes>
                            <product>EE</product>
                            <includeSnapshots>true</includeSnapshots>
                        </discoverRuntimes>
                    </runtimeConfiguration>
                    <environmentVariables>
                        <LDAP_PORT>${ldap.port}</LDAP_PORT>
                    </environmentVariables>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.mulesoft.munit</groupId>
                        <artifactId>munit-runner</artifactId>
                        <version>${munit.version}</version>
                        <classifier>mule-plugin</classifier>
                    </dependency>
                    <dependency>
                        <groupId>com.mulesoft.munit</groupId>
                        <artifactId>munit-tools</artifactId>
                        <version>${munit.version}</version>
                        <classifier>mule-plugin</classifier>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>io.qameta.allure</groupId>
                <artifactId>allure-maven</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
