<?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">

    <modelVersion>4.0.0</modelVersion>
    <groupId>org.mule.tools.cargo.integration-tests</groupId>
    <artifactId>installed</artifactId>

    <parent>
        <groupId>org.mule.tools.cargo</groupId>
        <artifactId>integration-tests</artifactId>
        <version>3.4-M3</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.mule.examples</groupId>
            <artifactId>mule-example-echo</artifactId>
            <version>${muleVersion}</version>
            <type>zip</type>
        </dependency>
    </dependencies>

    <name>Installed container integration test</name>

    <properties>
        <mule.distribution>${project.build.directory}</mule.distribution>
        <mule.home>${mule.distribution}/mule-standalone-${muleVersion}</mule.home>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.mule.distributions</groupId>
                                    <artifactId>mule-standalone</artifactId>
                                    <version>${muleVersion}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${mule.distribution}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                            <overWriteReleases>true</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>${cargoVersion}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.mule.tools.cargo</groupId>
                        <artifactId>container</artifactId>
                        <version>${project.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <wait>false</wait>
                    <container>
                        <containerId>mule3x</containerId>
                        <home>${mule.home}</home>
                    </container>
                    <deployer>
                        <type>installed</type>
                    </deployer>
                    <deployables>
                        <deployable>
                            <groupId>org.mule.examples</groupId>
                            <artifactId>mule-example-echo</artifactId>
                            <type>zip</type>
                        </deployable>
                    </deployables>
                </configuration>
                <executions>
                    <execution>
                        <id>start-container</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-container</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>undeploy</goal>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
