<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.flywaydb.flyway-test-extensions</groupId>
		<artifactId>parent</artifactId>
		<version>4.2.0</version>
		<relativePath>../parent/pom.xml</relativePath>
	</parent>

    <artifactId>flyway-spring3-test</artifactId>

    <name>${project.artifactId}</name>
	<packaging>jar</packaging>

	<properties>
        <maven.compiler.source>1.5</maven.compiler.source>
        <maven.compiler.target>1.5</maven.compiler.target>
    </properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${version.spring3}</version>
			<scope>compile</scope>
		</dependency>
        <dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${version.spring3}</version>
			<scope>compile</scope>
		</dependency>
        <dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${version.spring3}</version>
			<scope>compile</scope>
		</dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <scope>compile</scope>
        </dependency>
    </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-source</id>
                                <goals><goal>unpack</goal></goals>
                                <phase>generate-sources</phase>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>flyway-spring-test</artifactId>
                                            <version>${project.version}</version>
                                            <classifier>sources</classifier>
                                            <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy-test-source</id>
                                <goals><goal>unpack</goal></goals>
                                <phase>generate-test-sources</phase>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>flyway-spring-test</artifactId>
                                            <version>${project.version}</version>
                                            <classifier>test-sources</classifier>
                                            <outputDirectory>${project.build.directory}/generated-test-sources</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>1.8</version>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <id>add-sources</id>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>${project.build.directory}/generated-sources</source>
                                    </sources>
                                </configuration>
                            </execution>
                            <execution>
                                <id>add-test-sources</id>
                                <phase>generate-test-sources</phase>
                                <goals>
                                    <goal>add-test-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>${project.build.directory}/generated-test-sources</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>2.6</version>
                        <executions>
                            <execution>
                                <id>copy-class-resources</id>
                                <goals><goal>copy-resources</goal></goals>
                                <phase>test-compile</phase>
                                <configuration>
                                    <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${project.build.directory}/generated-sources</directory>
                                            <filtering>false</filtering>
                                            <excludes>
                                                <exclude>org/**</exclude>
                                                <exclude>META-INF/**</exclude>
                                            </excludes>
                                            <includes>
                                                <include>**</include>
                                            </includes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy-test-class-resources</id>
                                <goals><goal>copy-resources</goal></goals>
                                <phase>test-compile</phase>
                                <configuration>
                                    <outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${project.build.directory}/generated-test-sources</directory>
                                            <filtering>false</filtering>
                                            <excludes>
                                                <exclude>org/**</exclude>
                                                <exclude>META-INF/**</exclude>
                                            </excludes>
                                            <includes>
                                                <include>**</include>
                                            </includes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>


	<profiles>
		<profile>
			<id>h2-test</id>
			<activation><activeByDefault>true</activeByDefault></activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<configuration>
							<systemPropertyVariables>
								<jdbc.driver>org.h2.Driver</jdbc.driver>
								<jdbc.url>jdbc:h2:nio:${project.build.directory}/db/flywaytest.db</jdbc.url>
								<jdbc.username>h2_test</jdbc.username>
								<jdbc.password>h2_test</jdbc.password>
								<flyway.locations>/basetest</flyway.locations>
                                <flyway.driver>org.h2.Driver</flyway.driver>
                                <flyway.url>jdbc:h2:nio:${project.build.directory}/db/flywaytest.db</flyway.url>
                                <flyway.user>h2_test</flyway.user>
                                <flyway.password>h2_test</flyway.password>

                            </systemPropertyVariables>
							<includes>
								<include>**/*JUnitTest.java</include>
							</includes>
							<threadCount>1</threadCount>
							<runOrder>alphabetical</runOrder>
							<perCoreThreadCount>false</perCoreThreadCount>
							<redirectTestOutputToFile>false</redirectTestOutputToFile>
						</configuration>
						<goals>
							<goal>test</goal>
						</goals>
						<executions>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>oracle-test</id>
           <dependencies>
               <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ojdbc5</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
			<build>
 				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<configuration>
							<systemPropertyVariables>
								<jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
								<jdbc.url>jdbc:oracle:thin:@localhost:1521/XE</jdbc.url>
								<jdbc.username>OC_TEST</jdbc.username>	
								<jdbc.password>OC_TEST</jdbc.password>
								<flyway.locations>basetest</flyway.locations>
                                <flyway.driver>oracle.jdbc.driver.OracleDriver</flyway.driver>
                                <flyway.url>jdbc:oracle:thin:@localhost:1521/XE</flyway.url>
                                <flyway.user>OC_TEST</flyway.user>
                                <flyway.password>OC_TEST</flyway.password>
                            </systemPropertyVariables>
							<includes>
								<include>**/*JUnitTest.java</include>
							</includes>
							<threadCount>1</threadCount>
							<runOrder>alphabetical</runOrder>
							<perCoreThreadCount>false</perCoreThreadCount>
							<redirectTestOutputToFile>false</redirectTestOutputToFile>
						</configuration>
						<goals>
							<goal>test</goal>
						</goals>
						<executions>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
