<!-- ****************************************************** -->
<!-- ** Experimental Maven build - use at your own risk! ** -->
<!-- ****************************************************** -->

<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>
    <artifactId>alfresco-wdr-deployment</artifactId>
    <name>Alfresco WDR Deployment</name>
    <parent>
        <artifactId>alfresco-parent</artifactId>
        <groupId>org.alfresco</groupId>
        <version>5.0.a</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-repository</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-deployment</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-repository</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.14</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
           <plugin>
               <artifactId>maven-surefire-plugin</artifactId>
               <executions>
                  <execution>
                     <id>default-test</id>
                     <!-- There's also surefire configuration in the integration-tests profile -->
                     <configuration>
                          <includes>
                              <include>**/org/alfresco/deployment/impl/AllUnitTestsSuite.java</include>
                          </includes>
                     </configuration>
                  </execution>
               </executions>
            </plugin>
        </plugins>
    </build>
   <profiles>
        <profile>
            <id>integration-tests</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <!-- Wipe the database before starting tests -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>sql-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>wipe-database</id>
                                <phase>pre-clean</phase>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <configuration>
                                    <sqlCommand>drop database if exists alfresco</sqlCommand>
                                </configuration>
                            </execution>
                            <execution>
                                <id>create-database</id>
                                <phase>pre-clean</phase>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <configuration>
                                    <sqlCommand>create database alfresco</sqlCommand>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                           <execution>
                              <id>integration-tests</id>
                              <goals>
                                 <goal>test</goal>
                              </goals>
                              <configuration>
                                <excludes>
                                    <exclude>**/org/alfresco/deployment/impl/AllUnitTestsSuite.java</exclude>
                                </excludes>
                              </configuration>
                           </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
   </profiles>
</project>
