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

	<parent>
		<groupId>fish.focus.uvms.docker</groupId>
		<artifactId>uvms-docker</artifactId>
		<version>4.2.7</version>
		<relativePath>../pom.xml</relativePath>
	</parent>
	
	<artifactId>uvms-unionvms-test</artifactId>
	<packaging>jar</packaging>
	<name>uvms-unionvms-test</name>

	<properties>
		<docker.skip>${skipITs}</docker.skip>
		<docker.frontend.test.suite>UnionVMSTestCaseG2</docker.frontend.test.suite>
		<uvms.commons.version>4.1.12</uvms.commons.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>fish.focus.uvms.movement</groupId>
			<artifactId>movement-model</artifactId>
			<version>${unionvms.project.movement.module}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.movement-rules</groupId>
			<artifactId>movement-rules-model</artifactId>
			<version>${unionvms.project.movementrules.module}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.activemq</groupId>
			<artifactId>artemis-jms-client</artifactId>
			<version>2.20.0</version>
			<exclusions>
				<exclusion>
					<groupId>org.apache.geronimo.specs</groupId>
					<artifactId>geronimo-json_1.0_spec</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.apache.johnzon</groupId>
					<artifactId>johnzon-core</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.exchange</groupId>
			<artifactId>exchange-model</artifactId>
			<version>${unionvms.project.exchange.module}</version>
		</dependency>		
		<dependency>
			<groupId>fish.focus.uvms.asset</groupId>
			<artifactId>asset-model</artifactId>
			<version>${unionvms.project.asset.module}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.asset</groupId>
			<artifactId>asset-client</artifactId>
			<version>${unionvms.project.asset.module}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.user</groupId>
			<artifactId>user-model</artifactId>
			<version>${unionvms.project.user.module}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.incident</groupId>
			<artifactId>incident-model</artifactId>
			<version>${unionvms.project.incident.module}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.commons</groupId>
			<artifactId>uvms-commons-date</artifactId>
			<version>${uvms.commons.version}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.commons</groupId>
			<artifactId>uvms-commons-message</artifactId>
			<version>${uvms.commons.version}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.commons</groupId>
			<artifactId>uvms-commons-rest</artifactId>
			<version>${uvms.commons.version}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.reporting</groupId>
			<artifactId>reporting-module</artifactId>
			<version>${unionvms.project.reporting.module}</version>
			<classifier>classes</classifier>
			<exclusions>
				<exclusion>
					<groupId>*</groupId>
					<artifactId>*</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.config</groupId>
			<artifactId>config-model</artifactId>
			<version>${unionvms.project.config.module}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.audit</groupId>
			<artifactId>audit-model</artifactId>
			<version>${unionvms.project.audit.module}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.spatial</groupId>
			<artifactId>spatial-model</artifactId>
			<version>${unionvms.project.spatial.module}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.activity</groupId>
			<artifactId>client-model</artifactId>
			<version>${unionvms.project.activity.module}</version>
			<exclusions>
                <exclusion>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mapstruct</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>fish.focus.uvms.maven</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
		</dependency>
		<dependency>
            <groupId>fish.focus.uvms.plugins.flux.movement</groupId>
            <artifactId>flux-movement-plugin-model</artifactId>
            <version>${unionvms.project.plugins.flux}</version>
        </dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.13.2</version>		
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<version>2.0.6</version>
		</dependency>
		<dependency> <!-- Mute jboss-logging -->
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-core</artifactId>
			<version>2.19.0</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.resteasy</groupId>
			<artifactId>resteasy-client</artifactId>
			<version>5.0.1.Final</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.resteasy</groupId>
			<artifactId>resteasy-json-binding-provider</artifactId>
			<version>5.0.1.Final</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.resteasy</groupId>
			<artifactId>resteasy-multipart-provider</artifactId>
			<version>5.0.1.Final</version>
		</dependency>
		<dependency>
			<groupId>org.databene</groupId>
			<artifactId>contiperf</artifactId>
			<version>2.4.4</version>			
		</dependency>
		<dependency>
			<groupId>com.peertopark.java</groupId>
			<artifactId>geocalc</artifactId>
			<version>1.1.0</version>
		</dependency>
		<dependency>
		    <groupId>org.eclipse.jetty</groupId>
		    <artifactId>jetty-servlet</artifactId>
		    <version>11.0.13</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.maven</groupId>
			<artifactId>uvms-pom-java11-deps</artifactId>
			<version>3.18</version>
			<type>pom</type>
		</dependency>
		<dependency>
			<groupId>com.sun.xml.ws</groupId>
			<artifactId>rt</artifactId>
			<version>2.3.3</version>
		</dependency>
		<dependency>
			<groupId>org.eclipse</groupId>
			<artifactId>yasson</artifactId>
			<version>1.0.10</version>
		</dependency>
		<dependency>
			<groupId>org.locationtech.jts</groupId>
			<artifactId>jts-core</artifactId>
			<version>1.16.1</version>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-csv</artifactId>
			<version>1.9.0</version>
		</dependency>
		<dependency>
			<groupId>com.codeborne</groupId>
			<artifactId>selenide</artifactId>
			<version>6.11.0</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>io.fabric8</groupId>
					<artifactId>docker-maven-plugin</artifactId>
					<version>0.39.1</version>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>integration-test</goal>
							<goal>verify</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>io.fabric8</groupId>
				<artifactId>docker-maven-plugin</artifactId>
				<extensions>true</extensions>
				<executions>
					<execution>
						<id>verifyallstopped</id>
						<phase>validate</phase>
						<goals>
							<goal>stop</goal>
						</goals>
						<configuration>
							<allContainers>true</allContainers>
						</configuration>
					</execution>
					<execution>
						<id>start</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>start</goal>
						</goals>
					</execution>
					<execution>
						<id>stop</id>
						<phase>post-integration-test</phase>
						<goals>
							<goal>stop</goal>
						</goals>
						<configuration>
							<allContainers>true</allContainers>
						</configuration>
					</execution>
				</executions>
				<configuration>
					<skip>${docker.skip}</skip>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>3.2.2</version>
				<executions>
					<execution>
					<goals>
						<goal>test-jar</goal>
					</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<profiles>
		<profile>
			<id>standalone</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>io.fabric8</groupId>
						<artifactId>docker-maven-plugin</artifactId>
						<configuration>
							<images>
								<image>
								<alias>postgres</alias>
								<name>uvms/postgres-release:${project.version}</name>
								<run>
									<net>bridge</net>
									<namingStrategy>none</namingStrategy>
									<ports>
										<port>25432:5432</port>
									</ports>
									<log>
										<enabled>true</enabled>
										<color>green</color>
									</log>
									<hostname>postgres</hostname>
								</run>
							</image>
								<image>
									<alias>wildfly</alias>
									<name>uvms/wildfly-unionvms:${project.version}</name>
									<run>
										<net>bridge</net>
										<namingStrategy>none</namingStrategy>
										<links>
											<link>postgres:postgres</link>
										</links>
										<ports>
											<port>29990:9990</port>
											<port>28787:8787</port>
											<port>28080:8080</port>
											<port>28443:8443</port>
											<port>5445:5445</port>
											<port>5455:5455</port>
										</ports>
										<wait>
											<http>
												<url>http://admin:Wildfly4ever!@localhost:29990/management</url>
												<method>GET</method>
												<status>200</status>
											</http>
											<time>900000</time>
											<kill>15000</kill>
											<shutdown>15000</shutdown>
										</wait>
										<dependsOn>
											<container>postgres</container>
										</dependsOn>
										<log>
											<enabled>true</enabled>
											<color>blue</color>
										</log>
										<hostname>wildfly</hostname>
									</run>
								</image>
							</images>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>frontend-test-rules</id>
			<properties>
				<docker.frontend.test.suite>UnionVMSTestCaseRulesG2</docker.frontend.test.suite>
			</properties>
		</profile>
		<profile>
			<id>frontend-test-realtime-map</id>
			<properties>
				<docker.frontend.test.suite>UnionVMSTestCaseRealTimeMap</docker.frontend.test.suite>
			</properties>
		</profile>
		<profile>
			<id>frontend-test-mtchannels</id>
			<properties>
				<docker.frontend.test.suite>UnionVMSTestCaseMobileTerminalChannelsG2</docker.frontend.test.suite>
			</properties>
		</profile>
		<profile>
			<id>frontend-test</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<version>1.8</version>
						<executions>
							<execution>
								<id>downloadRegressionSuite</id>
								<phase>test</phase>
								<configuration>
									<tasks>
										<!-- Get the regression-suite-selenium front-end -->
										<get src="https://github.com/UnionVMS/UVMS-SeleniumTests/raw/swe-dev/UVMS-SeleniumRegressionTestsG2.zip" dest="target/UVMS-SeleniumRegressionTestsG2.zip" verbose="true" usetimestamp="true" />
										<unzip src="target/UVMS-SeleniumRegressionTestsG2.zip" dest="target/" />
										<move file="target/DockerUnionVMSparametersG2.py" tofile="target/UnionVMSparametersG2.py" />
									</tasks>
								</configuration>
								<goals>
									<goal>run</goal>
								</goals>
							</execution>
							<execution>
								<id>python-build</id>
								<phase>pre-integration-test</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<tasks>									
										<exec dir="${project.basedir}/target/" executable="${python.runtime}">
										 	<redirector output="target/Python-regression-suite-seleniumG2.log" alwayslog="true" /> 
											<arg value="-u" />
											<arg value="-m" />
											<arg value="unittest" />
											<arg value="-v" />
											<arg value="Python-regression-suite-seleniumG2.${docker.frontend.test.suite}" />
									  </exec>
									</tasks>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>selenium-test</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-scm-plugin</artifactId>
						<version>1.13.0</version>
						<configuration>
							<connectionType>git</connectionType>
							<developerConnectionUrl>scm:git:https://github.com/UnionVMS/VMS-Test.git</developerConnectionUrl>
							<scmVersion>master</scmVersion>
							<scmVersionType>branch</scmVersionType>
						</configuration>
						<executions>
							<execution>
								<phase>generate-sources</phase>
								<goals>
									<goal>checkout</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>3.1.0</version>
						<executions>
							<execution>
								<phase>generate-sources</phase>
									<goals>
										<goal>exec</goal>
									</goals>
								<configuration>
									<executable>mvn</executable>
									<workingDirectory>${project.basedir}/target/checkout</workingDirectory>
									<arguments>
										<argument>test</argument>
										<argument>-Dci=true</argument>
										<argument>-Pbase-suite</argument>
									</arguments>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>postman-test</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>3.1.0</version>
						<executions>
							<execution>
								<id>postman-test2</id>
								<phase>integration-test</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
									<executable>newman</executable>
									<workingDirectory>${project.basedir}</workingDirectory>
									<arguments>
										<argument>run</argument>
										<argument>${project.basedir}${file.separator}src${file.separator}test${file.separator}resources${file.separator}SpatialIntegrationTest.postman_collection.json</argument>
										<argument>--environment</argument>
										<argument>${project.basedir}${file.separator}src${file.separator}test${file.separator}resources${file.separator}test_environment</argument>
										<argument>--color</argument>
										<argument>--reporters</argument>
										<argument>junit,cli,html</argument>
										<argument>--reporter-junit-export</argument>
										<argument>${project.basedir}${file.separator}target${file.separator}failsafe-reports${file.separator}SpatialIntegrationTest.xml</argument>
										<argument>--reporter-html-export</argument>
										<argument>${project.basedir}${file.separator}target${file.separator}failsafe-reports${file.separator}SpatialIntegrationTest.html</argument>
									</arguments>
									<successCodes>
										<successCode>0</successCode>
										<successCode>1</successCode>
										<successCode>2</successCode>
									</successCodes>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
