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

	<parent>
		<groupId>com.atlassian.rm</groupId>
		<artifactId>jira-portfolio-main</artifactId>
		<version>1001.13.0-D20170529T041959</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<artifactId>portfolio-2</artifactId>
	<modelVersion>4.0.0</modelVersion>
	<packaging>pom</packaging>

	<name>Portfolio for JIRA 2 [Parent]</name>

	<modules>

		<module>common</module>
		<module>team-management</module>
		<module>portfolio</module>
		<module>roadmaps</module>

	</modules>

	<properties>

		<!-- for db integration tests -->
		<configuredTestSourceDirectory>src/test</configuredTestSourceDirectory>

		<dbScriptDir>${project.basedir}/../../../devutils/database</dbScriptDir>

		<guava.querydsl.compatibility.version>18.0</guava.querydsl.compatibility.version>

		<ao.querydsl.compatibility.version>1.1.5</ao.querydsl.compatibility.version>

		<sql.maven.version>1.5</sql.maven.version>

		<jdbc.host>localhost</jdbc.host>
		<jdbc.database>jpoit</jdbc.database>
		<jdbc.user/>
		<jdbc.password />
		<jdbc.schema>PUBLIC</jdbc.schema>
		<jdbc.url />

		<jpo.base.path>.</jpo.base.path>

		<postgres.jdbc.version>9.3-1101-jdbc4</postgres.jdbc.version> <!-- is overridden by build plans! -->
		<postgres.groupid>org.postgresql</postgres.groupid> <!-- is overridden by build plans! -->


		<wired.test.directory>src/test-wired/java</wired.test.directory>

		<!-- client build -->
		<!-- relevant to all sub-sub modules - not correct for "this" module itself -->
		<path.to.common.client>../../common/common-client</path.to.common.client>
		<path.to.node.folder>../../../target/node</path.to.node.folder>
		<path.to.node.executable>${path.to.node.folder}/${node.executable}</path.to.node.executable>
		<path.to.npm.executable>${path.to.node.folder}/${npm.executable}</path.to.npm.executable>

	</properties>

	<build>

		<testSourceDirectory>${configuredTestSourceDirectory}/java</testSourceDirectory>
		<testResources>
			<testResource>
				<directory>${configuredTestSourceDirectory}/resources</directory>
			</testResource>
		</testResources>

	</build>

	<profiles>

		<profile>
			<id>volt-it</id>

			<activation>
				<property>
					<name>volt-it</name>
				</property>
			</activation>

			<modules>
				<module>volt-tests</module>
			</modules>

		</profile>

		<profile>

			<id>integration-test</id>

			<activation>
				<property>
					<name>integration-test</name>
				</property>
			</activation>

			<properties>

				<configuredTestSourceDirectory>src/test-it</configuredTestSourceDirectory>
				<guava.version>${guava.querydsl.compatibility.version}</guava.version>
				<ao.version>${ao.querydsl.compatibility.version}</ao.version>

			</properties>

			<build>

				<plugins>

					<plugin>

						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-failsafe-plugin</artifactId>
						<version>2.18.1</version>

						<executions>
							<execution>
								<goals>
									<goal>integration-test</goal>
								</goals>
							</execution>
						</executions>

						<configuration>

							<skipTests>false</skipTests>

							<systemPropertyVariables>
								<jdbc.url>${jdbc.url}</jdbc.url>
								<jdbc.user>${jdbc.user}</jdbc.user>
								<jdbc.password>${jdbc.password}</jdbc.password>
								<jdbc.schema>${jdbc.schema}</jdbc.schema>
								<jpo.base.path>${jpo.base.path}</jpo.base.path>
							</systemPropertyVariables>

							<includes>
								<include>**/*Test*.java</include>
								<include>**/*Test.java</include>
								<include>**/*Tests.java</include>
							</includes>

							<classpathDependencyExcludes>
								<classpathDependencyExcludes>com.atlassian.annotations:atlassian-annotations</classpathDependencyExcludes>
							</classpathDependencyExcludes>
						</configuration>

					</plugin>

					<plugin>

						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<version>2.18.1</version>

						<configuration>
							<skipTests>true</skipTests>
						</configuration>

					</plugin>

				</plugins>

			</build>

		</profile>

		<!-- DB INTEGRATION TEST PROFILES / SETUP -->
		<!-- Postgres -->
		<profile>
			<id>integration-postgres</id>
			<activation>
				<property>
					<name>db-postgres</name>
				</property>
			</activation>

			<dependencies>

				<dependency>
					<groupId>${postgres.groupid}</groupId>
					<artifactId>postgresql</artifactId>
					<version>${postgres.jdbc.version}</version>
				</dependency>

			</dependencies>

			<properties>

				<jdbc.user>postgres</jdbc.user>
				<jdbc.password>postgres</jdbc.password>
				<jdbc.schema></jdbc.schema>

				<db.version>9.5</db.version> <!-- may be overridden -->

				<jdbc.port>15432</jdbc.port> <!-- should be different from standard port -->

				<jdbc.url>jdbc:postgresql://${jdbc.host}:${jdbc.port}/${jdbc.database}</jdbc.url>

			</properties>


			<build>
				<plugins>

					<plugin>
						<groupId>io.fabric8</groupId>
						<artifactId>docker-maven-plugin</artifactId>
						<version>0.15.7</version>

						<configuration>
							<autoPull>always</autoPull>
							<removeVolumes>true</removeVolumes>
							<images>
								<image>
									<alias>postgres-db</alias>
									<name>postgres:${db.version}</name>
									<run>
										<env>
											<POSTGRES_USER>${jdbc.user}</POSTGRES_USER>
											<POSTGRES_PASSWORD>${jdbc.password}</POSTGRES_PASSWORD>
											<POSTGRES_DB>${jdbc.database}</POSTGRES_DB>
										</env>
										<ports>
											<port>${jdbc.port}:5432</port>
										</ports>
										<wait>
											<log>database system is ready to accept connections</log>
											<time>100000</time>
											<kill>5000</kill>
											<shutdown>2000</shutdown>
										</wait>
									</run>
								</image>
							</images>
						</configuration>

						<executions>
							<execution>
								<id>start</id>
								<phase>none</phase>
								<goals>
									<goal>start</goal>
								</goals>
							</execution>
							<execution>
								<id>stop</id>
								<phase>none</phase>
								<goals>
									<goal>stop</goal>
									<goal>remove</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

				</plugins>
			</build>
		</profile>

	</profiles>

</project>