<?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>org.frankframework</groupId>
		<artifactId>frankframework-parent</artifactId>
		<version>10.1.0</version>
	</parent>

	<artifactId>frankframework-test</artifactId>
	<packaging>war</packaging>
	<name>Frank!Framework Test</name>

	<properties>
		<m2eclipse.wtp.contextRoot>iaf-test</m2eclipse.wtp.contextRoot>
		<failOnMissingWebXml>false</failOnMissingWebXml>
		<maven.build.timestamp.format>dd-MM-yyyy HH:mm</maven.build.timestamp.format>
	</properties>

	<dependencies>
		<!-- This dependency is here because of the IbisMetricsPipe -->
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-messaging</artifactId>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-nn-specials</artifactId>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-webapp</artifactId>
			<type>war</type>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-console-backend</artifactId>
		</dependency>

		<!-- provided scoped dependencies -->
		<dependency>
			<!-- This dependency is here because of the CustomHighDeliveryCountEsbJmsListener -->
			<groupId>jakarta.jms</groupId>
			<artifactId>jakarta.jms-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
		</dependency>
		<dependency>
			<groupId>jakarta.servlet</groupId>
			<artifactId>jakarta.servlet-api</artifactId>
		</dependency>

		<!-- these provided dependencies will be added to the executable (Spring) WAR -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-loader</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-tomcat</artifactId>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-ladybug-debugger</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.rabbitmq</groupId>
			<artifactId>amqp-client</artifactId>
			<version>${rabbitmq.driver.version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>com.rabbitmq.jms</groupId>
			<artifactId>rabbitmq-jms</artifactId>
			<version>${rabbitmq.jms.version}</version>
			<scope>runtime</scope>
		</dependency>

		<!-- these runtime dependencies are required for the Spring Boot runner, so they are on the local classpath -->
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-filesystem</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-larva</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-console-frontend</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-akamai</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-cmis</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-aws</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>frankframework-batch</artifactId>
			<scope>runtime</scope>
		</dependency>

		<!-- Test Scoped Dependencies -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-iostreams</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.testcontainers</groupId>
			<artifactId>testcontainers-junit-jupiter</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>io.github.wimdeblauwe</groupId>
			<artifactId>testcontainers-cypress</artifactId>
			<version>1.9.1</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>com.google.code.findbugs</groupId>
					<artifactId>jsr305</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<!-- Needed for IafTestInitializer -->
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<version>${h2.driver.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.activemq</groupId>
			<artifactId>artemis-jakarta-client</artifactId>
			<version>${artemis.driver.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.activemq</groupId>
			<artifactId>artemis-jakarta-server</artifactId>
			<version>${artemis.driver.version}</version>
			<scope>test</scope>
		</dependency>
		<!-- Required for Narayana -->
		<dependency>
			<groupId>org.jboss.logging</groupId>
			<artifactId>jboss-logging</artifactId>
			<version>${jboss-logging.version}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>com.github.dasniko</groupId>
			<artifactId>testcontainers-keycloak</artifactId>
			<version>3.9.0</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.frankframework</groupId>
			<artifactId>bootable-runner</artifactId>
			<scope>optional</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-frontend-to-TestClasses</id>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<phase>process-test-resources</phase>
						<configuration>
							<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
							<resources>
								<!-- Copy the Cypress tests and configuration to the test output directory -->
								<testResource>
									<directory>${iaf.rootdir}/console/frontend/src/main/frontend</directory>
									<filtering>false</filtering>
									<includes>
										<include>tsconfig.json</include>
										<include>cypress/**</include>
									</includes>
									<excludes>
										<exclude>cypress/node_modules/**</exclude>
										<exclude>cypress/test-results/**</exclude>
									</excludes>
									<targetPath>e2e</targetPath>
								</testResource>
								<!-- Copy scenarios -->
								<testResource>
									<directory>${project.basedir}/src/test/testtool</directory>
									<targetPath>${project.build.directory}/src/test/testtool</targetPath>
								</testResource>
								<!-- Copy Configurations -->
								<testResource>
									<directory>${project.basedir}/src/main/configurations</directory>
									<targetPath>${project.build.directory}/configurations</targetPath>
								</testResource>
							</resources>
							<!-- A bit hacky way to prevent this execution from running when tests execution is skipped. -->
							<skip>${maven.test.skip}</skip>
						</configuration>
					</execution>
					<execution>
						<id>copy-resources-and-configurations</id>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<phase>prepare-package</phase>
						<configuration>
							<outputDirectory>${project.build.directory}/full-configuration</outputDirectory>
							<resources>
								<resource>
									<directory>${project.basedir}/src/main/configurations</directory>
									<filtering>false</filtering>
									<targetPath>configurations</targetPath>
								</resource>
								<resource>
									<directory>${project.build.outputDirectory}</directory>
									<filtering>false</filtering>
								</resource>
								<resource>
									<directory>${project.build.sourceDirectory}</directory>
									<filtering>false</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- use maven-jar-plugin to make separate artifacts of context, configurations, resources and testscenarios, to inject them into WebSphere Docker deployment -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<executions>
					<execution>
						<id>zip-context</id>
						<goals>
							<goal>jar</goal>
						</goals>
						<phase>package</phase>
						<configuration>
							<classifier>context</classifier>
							<classesDirectory>src/main/webapp/META-INF</classesDirectory>
							<includes>context.xml</includes>
						</configuration>
					</execution>
					<execution>
						<id>zip-configurations</id>
						<goals>
							<goal>jar</goal>
						</goals>
						<phase>package</phase>
						<configuration>
							<classifier>configurations</classifier>
							<classesDirectory>src/main</classesDirectory>
							<includes>configurations/</includes>
						</configuration>
					</execution>
					<execution>
						<id>zip-resources</id>
						<goals>
							<goal>jar</goal>
						</goals>
						<phase>package</phase>
						<configuration>
							<classifier>resources</classifier>
							<classesDirectory>src/main/resources</classesDirectory>
						</configuration>
					</execution>
					<execution>
						<id>zip-scenarios</id>
						<goals>
							<goal>jar</goal>
						</goals>
						<phase>package</phase>
						<configuration>
							<classifier>scenarios</classifier>
							<classesDirectory>src/test/testtool</classesDirectory>
						</configuration>
					</execution>
					<execution>
						<id>zip-secrets</id>
						<goals>
							<goal>jar</goal>
						</goals>
						<phase>package</phase>
						<configuration>
							<classifier>secrets</classifier>
							<classesDirectory>src/main/secrets</classesDirectory>
						</configuration>
					</execution>
					<execution>
						<id>full-configuration</id>
						<goals>
							<goal>jar</goal>
						</goals>
						<phase>package</phase>
						<configuration>
							<classifier>full-configuration</classifier>
							<addDefaultExcludes>true</addDefaultExcludes>
							<classesDirectory>${project.build.directory}/full-configuration</classesDirectory>
							<archive>
								<manifestEntries>
									<IAF-Version>10.1.0</IAF-Version>
									<Maven-Version>${maven.version}</Maven-Version>
									<Creation-Time>${maven.build.timestamp}</Creation-Time>
									<Build-Version>${project.version}</Build-Version>
									<Build-Artifact>${project.artifactId}</Build-Artifact>
								</manifestEntries>
								<addMavenDescriptor>true</addMavenDescriptor>
							</archive>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<packagingExcludes>.gitignore</packagingExcludes>
					<failOnMissingWebXml>false</failOnMissingWebXml>
					<attachClasses>true</attachClasses>
					<archive>
						<manifestEntries>
							<IAF-Version>10.1.0</IAF-Version>
							<Maven-Version>${maven.version}</Maven-Version>
							<Creation-Time>${maven.build.timestamp}</Creation-Time>
							<Build-Version>${project.version}</Build-Version>
							<Build-Artifact>${project.artifactId}</Build-Artifact>
						</manifestEntries>
						<addMavenDescriptor>true</addMavenDescriptor>
					</archive>

					<webResources>
						<resource>
							<directory>${project.build.sourceDirectory}</directory>
							<targetPath>WEB-INF/classes</targetPath>
						</resource>
						<resource>
							<directory>src/main/configurations</directory>
							<targetPath>WEB-INF/classes/configurations</targetPath>
						</resource>
						<resource>
							<directory>src/test/testtool</directory>
							<targetPath>testtool</targetPath>
						</resource>
					</webResources>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<executions>
					<execution>
						<id>enforce-embed-tomcat-lib-ban</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<bannedDependencies>
									<excludes>
										<exclude>org.apache.tomcat.embed:*:*:jar:compile</exclude>
									</excludes>
									<message>Do not include embedded Tomcat</message>
								</bannedDependencies>
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<version>${javadoc-plugin.version}</version>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
		</plugins>
	</reporting>

	<profiles>
		<profile>
			<id>database-drivers</id>
			<activation>
				<property>
					<!-- IntelliJ could use ${idea.version} -->
					<!-- Eclipse could use ${m2e.version} -->
					<!-- but Maven limitations don't allow us to check multiple properties -->
					<name>m2e.version</name>
				</property>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.apache.tomcat</groupId>
					<artifactId>tomcat-dbcp</artifactId>
					<version>${tomcat.version}</version>
					<scope>provided</scope>
				</dependency>
				<dependency>
					<groupId>com.oracle.database.jdbc</groupId>
					<artifactId>ojdbc${oracle.driver.jdkversion}</artifactId>
					<version>${oracle.driver.version}</version>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>com.h2database</groupId>
					<artifactId>h2</artifactId>
					<version>${h2.driver.version}</version>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>com.microsoft.sqlserver</groupId>
					<artifactId>mssql-jdbc</artifactId>
					<version>${mssql.driver.version}</version>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>com.mysql</groupId>
					<artifactId>mysql-connector-j</artifactId>
					<version>${mysql.driver.version}</version>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>org.mariadb.jdbc</groupId>
					<artifactId>mariadb-java-client</artifactId>
					<version>${mariadb.driver.version}</version>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>org.postgresql</groupId>
					<artifactId>postgresql</artifactId>
					<version>${postgresql.driver.version}</version>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>com.ibm.db2</groupId>
					<artifactId>jcc</artifactId>
					<version>${db2.driver.version}</version>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>org.apache.activemq</groupId>
					<artifactId>artemis-jakarta-client</artifactId>
					<version>${artemis.driver.version}</version>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>org.apache.activemq</groupId>
					<artifactId>activemq-client</artifactId>
					<version>${activemq.driver.version}</version>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>com.rabbitmq</groupId>
					<artifactId>amqp-client</artifactId>
					<version>${rabbitmq.driver.version}</version>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>com.rabbitmq.jms</groupId>
					<artifactId>rabbitmq-jms</artifactId>
					<version>${rabbitmq.jms.version}</version>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>org.jboss.logging</groupId>
					<artifactId>jboss-logging</artifactId>
					<version>${jboss-logging.version}</version>
					<scope>runtime</scope>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>im-too-lazy-to-configure-my-classpath</id>
			<activation>
				<property>
					<name>idea.version</name>
				</property>
			</activation>
			<dependencies>
				<dependency>
					<groupId>jakarta.jms</groupId>
					<artifactId>jakarta.jms-api</artifactId>
					<scope>compile</scope>
				</dependency>
				<dependency>
					<groupId>jakarta.transaction</groupId>
					<artifactId>jakarta.transaction-api</artifactId>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>jakarta.activation</groupId>
					<artifactId>jakarta.activation-api</artifactId>
					<scope>runtime</scope>
				</dependency>
				<dependency>
					<groupId>jakarta.management.j2ee</groupId>
					<artifactId>jakarta.management.j2ee-api</artifactId>
					<version>1.1.4</version>
					<scope>runtime</scope>
				</dependency>
			</dependencies>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-enforcer-plugin</artifactId>
						<executions>
							<execution>
								<id>enforce-classpath-lib-ban</id>
								<configuration>
									<skip>true</skip>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>codecoverage</id>
			<build>
				<plugins>
					<plugin>
						<!--
							JaCoCo aggregation of cross-module coverage.
							Only needs to be done once in module running at end of the build.

							The test module depends on all other Java code so seems a good place to stick this.

							See also: https://www.baeldung.com/maven-jacoco-multi-module-project
						-->
						<groupId>org.jacoco</groupId>
						<artifactId>jacoco-maven-plugin</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>report-aggregate</goal>
								</goals>
								<phase>verify</phase>
								<configuration>
									<dataFileIncludes>
										<dataFileInclude>**/jacoco.exec</dataFileInclude>
									</dataFileIncludes>
									<outputDirectory>${project.reporting.outputDirectory}/jacoco-aggregate</outputDirectory>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
