<?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>org.mule.tools.devkit</groupId>
        <artifactId>mule-devkit</artifactId>
        <version>3.0.2</version>
    </parent>

    <name>Mule DevKit Integration Tests</name>

    <artifactId>mule-devkit-integration-tests</artifactId>
    <packaging>jar</packaging>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <!-- here the phase you need -->
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/integration-tests</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>it</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>maven-replacer-plugin</artifactId>
                <version>1.3.7</version>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <include>target/integration-tests/**/pom.xml</include>
                        <include>target/test-classes/**/cloud-connector-archetype.properties</include>
                        <include>target/test-classes/**/transformer-archetype.properties</include>
                        <include>target/classes/**/*OAuth*</include>
                    </includes>
                    <replacements>
                        <replacement>
                            <token>@project.version@</token>
                            <value>${project.version}</value>
                        </replacement>
                        <replacement>
                            <token>@mule.version@</token>
                            <value>${mule.version}</value>
                        </replacement>
                        <replacement>
                            <token>@http.port@</token>
                            <value>${env.http.port}</value>
                        </replacement>
                    </replacements>
                </configuration>
            </plugin>
            <plugin> <!-- We are adding this explicitly because the maven-archetype lifecycle doesn't have it :( -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <executions>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.7.2</version>
                <configuration>
                    <forkMode>none</forkMode>
                    <systemPropertyVariables>
                        <archetypeVersion>${project.version}</archetypeVersion>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>verify</id>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.7.1</version>
                <configuration>
                    <excludes>
                        <exclude>**/it/*Test*</exclude>
                        <exclude>**/Test*</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <filtering>true</filtering>
                <directory>src/test/resources</directory>
            </resource>
        </resources>
    </build>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.8.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-verifier</artifactId>
            <version>1.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.dsl</groupId>
            <artifactId>dsl-api</artifactId>
            <version>0.7</version>
            <exclusions>
                <exclusion>
                    <groupId>org.mule</groupId>
                    <artifactId>core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
</project>