<?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.munit.tests</groupId>
        <artifactId>munit-tests</artifactId>
        <version>2.3.8</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>integration</artifactId>
    <packaging>mule-application</packaging>

    <name>MUnit :: Integration Tests</name>
    <description>Integration Test for Munit Project</description>

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

        <formatterConfigPath>../../formatter.xml</formatterConfigPath>
        <checkStyleConfigPath>../../munit_check.xml</checkStyleConfigPath>
        <licensePath>../../LICENSE_HEADER.txt</licensePath>
    </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>
        <plugins>
            <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-maven-plugin</artifactId>
                <version>${mule.maven.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <sharedLibraries>
                        <sharedLibrary>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring-core</artifactId>
                        </sharedLibrary>
                        <sharedLibrary>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring-beans</artifactId>
                        </sharedLibrary>
                        <sharedLibrary>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring-context</artifactId>
                        </sharedLibrary>
                        <sharedLibrary>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring-aop</artifactId>
                        </sharedLibrary>
                        <sharedLibrary>
                            <groupId>org.springframework.security</groupId>
                            <artifactId>spring-security-core</artifactId>
                        </sharedLibrary>
                        <sharedLibrary>
                            <groupId>org.springframework.security</groupId>
                            <artifactId>spring-security-config</artifactId>
                        </sharedLibrary>
                    </sharedLibraries>
                </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>
                    <execution>
                        <id>generate-coverage-reports</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>coverage-report</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <randomFailMessages>true</randomFailMessages>
                    <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>
                        <property.with.null.value>${property.not.set}</property.with.null.value>
                    </systemPropertyVariables>
                    <environmentVariables>
                        <MY_ENV>envVar</MY_ENV>
                    </environmentVariables>
                    <argLines>
                        <argLine>-Djava.library.path=lib/</argLine>
                        <argLine>-Xmx8192m</argLine>
                        <argLine>-XX:-UseGCOverheadLimit</argLine>
                        <argLine>-Dmule.verbose.exceptions=true</argLine>
                        <!--<argLine>-verbose:class</argLine>-->
                    </argLines>
                    <coverage>
                        <runCoverage>true</runCoverage>
                        <failBuild>false</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>${javaVersion}</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>${javaVersion}</targetJdk>
                </configuration>
            </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>
            <plugin>
                <groupId>com.mulesoft.munit.tools</groupId>
                <artifactId>munit-maven-plugin</artifactId>
            </plugin>
        </plugins>

    </reporting>

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

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

        <!--Connectors definition section-->
        <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.module</groupId>
            <artifactId>mule-java-module</artifactId>
            <version>${mule.java.module.version}</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-spring-module</artifactId>
            <version>${mule.spring.module.version}</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-scripting-module</artifactId>
            <version>${mule.scripting.module.version}</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-file-connector</artifactId>
            <version>${mule.file.connector.version}</version>
            <classifier>mule-plugin</classifier>
        </dependency>

        <!-- Required to use spring beans-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring.security.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring.security.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>debug</id>
            <properties>
                <munit.debug>-agentlib:jdwp=transport=dt_socket,server=y,address=8002,suspend=y</munit.debug>
            </properties>
        </profile>
        <profile>
            <id>4.x</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <munit.test>(core/.*)</munit.test>
            </properties>
        </profile>
        <profile>
            <id>fullIntegration</id>
            <properties>
                <!--TODO Remove this when all suites are passing-->
                <munit.test>
                    (core/.*|extended/.*)
                </munit.test>
                <munit.tags>fullIntegration,core,extension</munit.tags>
            </properties>
        </profile>
        <profile>
            <id>cloudhub</id>
            <properties>
                <munit.test>
                    (^((?!(embedded\/)).)*$)
                </munit.test>
            </properties>
        </profile>
    </profiles>
</project>
