<?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/maven-v4_0_0.xsd">
    <parent>
        <groupId>com.mulesoft</groupId>
        <artifactId>munit</artifactId>
        <version>2.0.0-BETA</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mulesoft.munit</groupId>
    <artifactId>munit-integration-tests</artifactId>
    <packaging>mule-application</packaging>
    <name>Integration Tests</name>
    <description>Integration Test for Munit Project</description>

    <properties>
        <mule.maven.plugin.version>3.0.0-BETA</mule.maven.plugin.version>

        <xmlunit.version>1.6</xmlunit.version>

        <mule.wsc.connector.version>0.8.0-BETA.3</mule.wsc.connector.version>
        <mule.http.connector.version>0.8.0-BETA.3</mule.http.connector.version>
        <mule.validation.module.version>0.8.0-BETA.3</mule.validation.module.version>

        <skipTests>${skipIntegrationTests}</skipTests>
        <skipMunitTests>${skipIntegrationTests}</skipMunitTests>

        <licensePath>../LICENSE_HEADER.txt</licensePath>
        <formatterConfigPath>../formatter.xml</formatterConfigPath>
        <debugger.argline>-Dfake.property=true</debugger.argline>
    </properties>

    <repositories>
        <repository>
            <id>mule-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>https://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>mule-snapshots</id>
            <name>MuleSoft Snapshots Repository</name>
            <url>https://repository.mulesoft.org/snapshots/</url>
            <layout>default</layout>
        </repository>
    </repositories>

    <build>
        <pluginManagement>
            <plugins>
                <!--<plugin>-->
                <!--<groupId>org.apache.maven.plugins</groupId>-->
                <!--<artifactId>maven-install-plugin</artifactId>-->
                <!--<version>2.3.1</version>-->
                <!--</plugin>-->
            </plugins>
        </pluginManagement>


        <plugins>
            <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-maven-plugin</artifactId>
                <version>${mule.maven.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.mulesoft.munit.tools</groupId>
                <artifactId>munit-maven-plugin</artifactId>
                <version>${project.version}</version>
                <executions>
                    <execution>
                        <id>test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <randomFailMessages>true</randomFailMessages>
                    <dynamicPorts>
                        <dynamicPort>a.dynamic.port</dynamicPort>
                        <dynamicPort>mock.inbounds.test.port</dynamicPort>
                        <dynamicPort>http.extension.test.port</dynamicPort>
                    </dynamicPorts>
                    <systemPropertyVariables>
                        <fake.prop>fake-value</fake.prop>
                        <mule.classloading.verbose>true</mule.classloading.verbose>
                        <a.property.to.be.replaced>replaced-value</a.property.to.be.replaced>
                    </systemPropertyVariables>
                    <environmentVariables>
                        <MY_ENV>envVar</MY_ENV>
                    </environmentVariables>
                    <argLines>
                        <argLine>${debugger.argline}</argLine>
                        <argLine>-Djava.library.path=lib/</argLine>
                        <argLine>-Xmx8192m</argLine>
                        <argLine>-XX:-UseGCOverheadLimit</argLine>
                        <argLine>-Dmule.verbose.exceptions=true</argLine>
                        <!--<argLine>-verbose:class</argLine>-->
                    </argLines>
                    <additionalClasspathElements>
                        <additionalClasspathElement>${project.basedir}/lib/echo.jar</additionalClasspathElement>
                    </additionalClasspathElements>
                    <!--<classpathDependencyExcludes>-->
                    <!--<classpathDependencyExclude>org.jdom:jdom2:*:*</classpathDependencyExclude>-->
                    <!--<classpathDependencyExclude>org.jdom:jdom2</classpathDependencyExclude>-->
                    <!--</classpathDependencyExcludes>-->
                    <coverage>
                        <runCoverage>false</runCoverage>
                        <failBuild>true</failBuild>

                        <requiredApplicationCoverage>0</requiredApplicationCoverage>
                        <requiredResourceCoverage>0</requiredResourceCoverage>
                        <requiredFlowCoverage>0</requiredFlowCoverage>

                        <formats>
                            <format>console</format>
                            <format>html</format>
                        </formats>
                    </coverage>
                    <munitTest>${munit.test}</munitTest>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <source>${jdk.version}</source>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <configuration>
                    <configLocation>http://mulesoft.org/download/attachments/92/checkstyle.xml?version=1
                    </configLocation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <configuration>
                    <targetJdk>${jdk.version}</targetJdk>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>taglist-maven-plugin</artifactId>
                <configuration>
                    <tags>
                        <tag>TODO</tag>
                        <tag>@todo</tag>
                        <tag>FIXME</tag>
                        <tag>@fixme</tag>
                        <tag>@deprecated</tag>
                    </tags>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <links>
                        <link>http://java.sun.com/j2ee/1.4/docs/api</link>
                        <link>http://java.sun.com/j2se/1.4.2/docs/api</link>
                        <link>http://java.sun.com/j2se/1.5.0/docs/api</link>
                    </links>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jdepend-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
            </plugin>
        </plugins>

    </reporting>

    <dependencies>
        <!--<dependency>-->
        <!--<groupId>org.mule.runtime</groupId>-->
        <!--<artifactId>mule-runtime-api-bom</artifactId>-->
        <!--<version>${mule.version}</version>-->
        <!--<type>pom</type>-->
        <!--</dependency>-->

        <!--<dependency>-->
        <!--<groupId>com.mulesoft.munit</groupId>-->
        <!--<artifactId>munit-runtime</artifactId>-->
        <!--<version>${project.version}</version>-->
        <!--<scope>test</scope>-->
        <!--<type>pom</type>-->
        <!--</dependency>-->

        <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-runner</artifactId>
            <version>${project.version}</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-tools</artifactId>
            <version>${project.version}</version>
            <classifier>mule-plugin</classifier>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>xmlunit</groupId>
            <artifactId>xmlunit</artifactId>
            <version>${xmlunit.version}</version>
        </dependency>

        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-http-connector</artifactId>
            <version>${mule.http.connector.version}</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-wsc-connector</artifactId>
            <version>${mule.wsc.connector.version}</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-validation-module</artifactId>
            <version>${mule.validation.module.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>

        <!-- Required to implement a custom assertion-->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-api</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- For Jar Hell issues -->
        <!--<dependency>-->
        <!--<groupId>org.jhades</groupId>-->
        <!--<artifactId>jhades</artifactId>-->
        <!--<version>1.0.4</version>-->
        <!--</dependency>-->
    </dependencies>

    <profiles>
        <profile>
            <id>debug</id>
            <properties>
                <debugger.argline>-agentlib:jdwp=transport=dt_socket,server=y,address=8002,suspend=y</debugger.argline>
            </properties>
        </profile>
        <profile>
            <id>4.x</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <mule.version>4.0.0-BETA.3</mule.version>
                <munit.test>
                    (assertion-test.xml|maven-plugin-configuration.xml|before-and-after-test.xml|general-test.xml|http-extension-test.xml|tag-test.xml|mp-mocking-test.xml|failure-expectations-test.xml|async-execution-test.xml|disable-sources-test.xml|suite-with-no-tests.xml|suite-with-all-tests-ignored.xml|empty-test-flows.xml|set-event-test.xml|ee-transform-test.xml)
                </munit.test>
            </properties>
            <build>
                <plugins>
                    <!-- TODO why not default this?? -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.12.4</version>
                        <configuration>
                            <argLine>-Dmule.env=dev</argLine>
                            <argLine>-Dmule.version.for.test=${mule.version}</argLine>
                            <argLine>-Dmaven.test.skip=true</argLine>
                            <redirectTestOutputToFile>true</redirectTestOutputToFile>
                            <excludesFile>*/src/main/java*</excludesFile>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>fullIntegration</id>
            <properties>
                <mule.version>4.0.0-BETA.3</mule.version>
                <!--TODO Remove this when all suites are passing-->
                <munit.test>
                    (assertion-test.xml|maven-plugin-configuration.xml|before-and-after-test.xml|general-test.xml|
                    http-extension-test.xml|tag-test.xml|mp-mocking-test.xml|failure-expectations-test.xml|async-execution-test.xml|
                    disable-sources-test.xml|assertThat-test-suite.xml|disable-single-source-test-suite.xml|empty-test-flows.xml|
                    disable-multiple-sources-test-suite.xml|disable-all-sources-test-suite.xml|enable-single-source-test-suite.xml|
                    enable-all-sources-test-suite.xml|enable-multiple-sources-test-suite.xml|suite-with-no-tests.xml|suite-with-all-tests-ignored.xml|
                    validation-module-test.xml|set-event-test.xml|set-event-test-suite.xml|flow-and-subflows-test.xml|variables-and-mocks-test.xml|
                    global-exception-strategy-test.xml|mule-app-properties.xml|namespace-handler-test.xml|placeholder-test.xml|ee-transform-test.xml|
                    spring-util-test.xml|ws-consumer-test.xml|mock-test-suite.xml|mule-artifact-properties-test.xml|mel-evaluation-test.xml)
                </munit.test>
                <munit.tags>fullIntegration,core,extension</munit.tags>
            </properties>
        </profile>
    </profiles>
</project>
