<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>db-test-utils</artifactId>
	<version>0.22.0</version>

	<parent>
		<groupId>de.hs-heilbronn.mi</groupId>
		<artifactId>rwh-pom</artifactId>
		<version>0.24.0</version>
	</parent>

	<name>db-test-utils</name>
	<description>Utility library for writing database integration tests with PostgreSQL and Liquibase for JUnit 4</description>
	<url>https://github.com/hhund/db-test-utils</url>

	<licenses>
		<license>
			<name>Apache License, Version 2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<organization>
		<name>Heilbronn University of Applied Sciences, Faculty of Informatics</name>
		<url>https://www.hs-heilbronn.de/it</url>
	</organization>

	<developers>
		<developer>
			<id>hhund</id>
			<name>Hauke Hund</name>
			<roles>
				<role>developer</role>
			</roles>
			<email>hauke.hund@hs-heilbronn.de</email>
			<organization>Heilbronn University of Applied Sciences, Faculty of Informatics</organization>
			<organizationUrl>https://www.hs-heilbronn.de/hauke.hund</organizationUrl>
		</developer>
	</developers>

	<distributionManagement>
		<snapshotRepository>
			<id>ossrh</id>
			<name>Sonatype Nexus snapshot repository</name>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
		</snapshotRepository>
		<repository>
			<id>ossrh</id>
			<name>Sonatype Nexus release repository</name>
			<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
		</repository>
	</distributionManagement>

	<scm>
		<connection>scm:git:git://github.com/hhund/db-test-utils.git</connection>
		<developerConnection>scm:git:git@github.com:hhund/db-test-utils.git</developerConnection>
		<url>https://github.com/hhund/db-test-utils</url>
	</scm>

	<dependencies>
		<dependency>
			<groupId>javax.xml.bind</groupId>
			<artifactId>jaxb-api</artifactId>
			<version>2.3.1</version>
		</dependency>

		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-dbcp2</artifactId>
			<version>2.9.0</version>
		</dependency>
		<dependency>
			<groupId>org.liquibase</groupId>
			<artifactId>liquibase-core</artifactId>
			<version>4.23.1</version>
		</dependency>
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<version>42.6.0</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jul-to-slf4j</artifactId>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
		</dependency>

		<dependency>
			<groupId>de.hs-heilbronn.mi</groupId>
			<artifactId>log4j2-utils</artifactId>
			<version>0.15.0</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-gpg-plugin</artifactId>
				<executions>
					<execution>
						<id>sign-artifacts</id>
						<phase>verify</phase>
						<goals>
							<goal>sign</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<excludedGroups>de.rwh.utils.test.DockerTest</excludedGroups>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
				<configuration>
					<includes>
						<include>**/*</include>
					</includes>
					<groups>de.rwh.utils.test.DockerTest</groups>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>integration-test</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>io.fabric8</groupId>
				<artifactId>docker-maven-plugin</artifactId>
				<version>0.41.0</version>
				<extensions>true</extensions>

				<executions>
					<execution>
						<id>start-postgres</id>
						<phase>pre-integration-test</phase>
						<goals>
							<goal>start</goal>
						</goals>
						<configuration>
							<images>
								<image>
									<name>postgres:15</name>
									<run>
										<ports>
											<port>127.0.0.1:54321:5432</port>
										</ports>
										<env>
											<TZ>Europe/Berlin</TZ>
											<POSTGRES_USER>postgres</POSTGRES_USER>
											<POSTGRES_PASSWORD>password</POSTGRES_PASSWORD>
											<POSTGRES_DB>db</POSTGRES_DB>
										</env>
										<wait>
											<!-- <log>(?s)database system is ready to accept connections.*database system is ready to accept connections</log> -->
											<time>2500</time>
										</wait>
									</run>
								</image>
							</images>
						</configuration>
					</execution>
					<execution>
						<id>stop-postgres</id>
						<phase>post-integration-test</phase>
						<goals>
							<goal>stop</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>