<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.rabbitmq</groupId>
  <artifactId>amqp-client-mqtt</artifactId>
  <version>3.8.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>RabbitMQ MQTT plugin dependencies list</name>
  <description>Fetches test dependencies only.</description>
  <url>https://www.rabbitmq.com</url>

  <properties>
    <paho.v5.version>[1.2.5,)</paho.v5.version>
    <paho.v3.version>[1.2.5,)</paho.v3.version>
    <amqp-client.version>5.22.0</amqp-client.version>
    <junit.version>5.11.3</junit.version>
    <assertj.version>3.26.3</assertj.version>
    <logback.version>1.2.13</logback.version>
    <maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
    <groovy-maven-plugin.version>2.1.1</groovy-maven-plugin.version>
    <groovy.version>2.4.21</groovy.version>
    <maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version>
    <spotless.version>2.43.0</spotless.version>
    <google-java-format.version>1.17.0</google-java-format.version>
    <test-keystore.ca>${project.build.directory}/ca.keystore</test-keystore.ca>
    <test-keystore.password>bunnychow</test-keystore.password>
    <groovy-scripts.dir>${basedir}/src/test/scripts</groovy-scripts.dir>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.eclipse.paho</groupId>
      <artifactId>org.eclipse.paho.mqttv5.client</artifactId>
      <version>${paho.v5.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.paho</groupId>
      <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
      <version>${paho.v3.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.rabbitmq</groupId>
      <artifactId>amqp-client</artifactId>
      <version>${amqp-client.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>${assertj.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven-surefire-plugin.version}</version>
          <configuration>
            <environmentVariables>
              <DEPS_DIR>${deps.dir}</DEPS_DIR>
            </environmentVariables>
            <systemPropertyVariables>
              <hostname>${hostname}</hostname>
              <certs.dir>${certs.dir}</certs.dir>
              <mqtt.ssl.port>${mqtt.ssl.port}</mqtt.ssl.port>
              <mqtt.port>${mqtt.port}</mqtt.port>
              <mqtt.port.2>${mqtt.port.2}</mqtt.port.2>
              <amqp.port>${amqp.port}</amqp.port>

              <test-keystore.ca>${test-keystore.ca}</test-keystore.ca>
              <test-keystore.password>${test-keystore.password}</test-keystore.password>
              <test-client-cert.path>${certs.dir}/client/keycert.p12</test-client-cert.path>
              <test-client-cert.password>bunnychow</test-client-cert.password>

            </systemPropertyVariables>
            <!--
              needed because of bug in OpenJDK 8 u181 on Debian distros
              see https://stackoverflow.com/questions/53010200/maven-surefire-could-not-find-forkedbooter-class
            -->
            <argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.codehaus.gmaven</groupId>
          <artifactId>groovy-maven-plugin</artifactId>
          <version>${groovy-maven-plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>org.codehaus.groovy</groupId>
              <artifactId>groovy-all</artifactId>
              <version>${groovy.version}</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
            <phase>generate-test-resources</phase>
            <id>remove-old-test-keystores</id>
            <goals>
              <goal>execute</goal>
            </goals>
            <configuration>
              <source>
                ${groovy-scripts.dir}/remove_old_test_keystores.groovy
              </source>
            </configuration>
          </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>keytool-maven-plugin</artifactId>
          <version>1.7</version>
          <executions>
            <execution>
              <id>generate-test-ca-keystore</id>
              <phase>generate-test-resources</phase>
              <goals>
                <goal>importCertificate</goal>
              </goals>
              <configuration>
                <file>${certs.dir}/testca/cacert.pem</file>
                <keystore>${test-keystore.ca}</keystore>
                <storepass>${test-keystore.password}</storepass>
                <noprompt>true</noprompt>
                <alias>server1</alias>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin.version}</version>
          <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <compilerArgs>
              <arg>-Xlint:deprecation</arg>
              <arg>-Xlint:unchecked</arg>
            </compilerArgs>
          </configuration>
        </plugin>

        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>${spotless.version}</version>
          <configuration>
            <java>
              <googleJavaFormat>
                <version>${google-java-format.version}</version>
                <style>GOOGLE</style>
              </googleJavaFormat>
            </java>
<!--                      <ratchetFrom>origin/main</ratchetFrom>-->
            <licenseHeader> <!-- specify either content or file, but not both -->
              <content>// This Source Code Form is subject to the terms of the Mozilla Public
                // License, v. 2.0. If a copy of the MPL was not distributed with this
                // file, You can obtain one at https://mozilla.org/MPL/2.0/.
                //
                //  Copyright (c) 2007-2024, Inc. or its affiliates. All rights reserved.
                //
              </content>
            </licenseHeader>
          </configuration>
        </plugin>

      </plugins>
  </build>
</project>
