<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>io.vertx</groupId>
    <artifactId>vertx-ext-parent</artifactId>
    <version>26</version>
  </parent>

  <artifactId>vertx-stomp</artifactId>
  <version>3.4.2</version>

  <name>Vert.x Stomp</name>
  <description>Stomp support for Vert.x 3</description>

  <properties>
    <stack.version>3.4.2</stack.version>
    <codegen.rxjava.deprecated>true</codegen.rxjava.deprecated>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-dependencies</artifactId>
        <version>${stack.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codegen</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-lang-groovy</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-lang-kotlin</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-lang-ruby</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-lang-js</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-docgen</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-rx-java</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codetrans</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-auth-common</artifactId>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-bridge-common</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.3.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-unit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.jayway.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <version>1.7.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.21</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-auth-shiro</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.projectodd.stilts</groupId>
      <artifactId>stilts-stomp-client</artifactId>
      <version>0.1.40</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>${project.basedir}/src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>*.txt</include>
        </includes>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>${project.basedir}/src/test/resources</directory>
        <filtering>true</filtering>
      </testResource>
    </testResources>

    <plugins>
      <!-- Copy resources after compilation phase as we generate JS in src/main/resources -->
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>default-resources</id>
            <phase>process-classes</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.19.1</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
            <configuration>
              <excludes>
                <exclude>**/*DockerIT.java</exclude>
              </excludes>
              <systemProperties>
                <vertx.disableDnsResolver>true</vertx.disableDnsResolver>
              </systemProperties>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <!--
      This profile checks the behavior of the stomp client against several stomp server started in docker
      containers.

      on mac:
      mvn clean verify -Pit-with-docker -Ddockerhost=(docker-machine ip dev)
      on linux:
      mvn clean verify -Pit-with-docker -Ddockerhost=localhost

       -->
      <id>it-with-docker</id>
      <properties>
        <dockerhost>localhost</dockerhost>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jolokia</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>0.13.8</version>
            <configuration>
              <images>
                <image>
                  <!-- ActiveMQ -->
                  <alias>activemq</alias>
                  <name>vertx-stomp/activemq-stomp</name>
                  <build>
                    <assembly>
                      <dockerFileDir>${project.basedir}/src/test/resources/integration/activemq</dockerFileDir>
                    </assembly>
                  </build>
                  <run>
                    <ports>
                      <port>61622:61612</port>
                      <port>61623:61613</port>
                      <port>61626:61616</port>
                      <port>8161:8161</port>
                    </ports>
                    <wait>
                      <tcp>
                        <ports>
                          <port>61612</port>
                          <port>61613</port>
                        </ports>
                      </tcp>
                      <time>40000</time>
                    </wait>
                  </run>
                </image>
                <image>
                  <!-- Artemis -->
                  <alias>artemis</alias>
                  <name>vertx-stomp/artemis-stomp</name>
                  <build>
                    <assembly>
                      <dockerFileDir>${project.basedir}/src/test/resources/integration/artemis</dockerFileDir>
                    </assembly>
                  </build>
                  <run>
                    <ports>
                      <port>61653:61613</port>
                      <port>61656:61616</port>
                      <port>5445:5445</port>
                    </ports>
                    <wait>
                      <tcp>
                        <ports>
                          <port>61616</port>
                          <port>61613</port>
                          <port>5445</port>
                        </ports>
                      </tcp>
                      <time>40000</time>
                    </wait>
                  </run>
                </image>
                <image>
                  <!-- Efrecon -->
                  <alias>efrecon</alias>
                  <name>vertx-stomp/efrecon-stomp</name>
                  <build>
                    <assembly>
                      <dockerFileDir>${project.basedir}/src/test/resources/integration/efrecon</dockerFileDir>
                    </assembly>
                  </build>
                  <run>
                    <ports>
                      <port>61633:61613</port>
                    </ports>
                    <wait>
                      <tcp>
                        <ports>
                          <port>61613</port>
                        </ports>
                      </tcp>
                      <time>40000</time>
                    </wait>
                  </run>
                </image>
                <image>
                  <!-- RabbitMQ -->
                  <alias>rabbitmq</alias>
                  <name>vertx-stomp/rabbitmq-stomp</name>
                  <build>
                    <assembly>
                      <dockerFileDir>${project.basedir}/src/test/resources/integration/rabbitmq</dockerFileDir>
                    </assembly>
                  </build>
                  <run>
                    <ports>
                      <port>61643:61613</port>
                    </ports>
                    <wait>
                      <tcp>
                        <ports>
                          <port>61613</port>
                        </ports>
                      </tcp>
                      <!-- rabbitmq is a bit longer to start -->
                      <time>40000</time>
                    </wait>
                  </run>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>build</goal>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.19.1</version>
            <executions>
              <execution>
                <id>docker-its</id>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <includes>
                    <include>**/*IT.java</include>
                  </includes>
                  <systemPropertyVariables>
                    <dockerhost>${dockerhost}</dockerhost>
                  </systemPropertyVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>

    </profile>
  </profiles>
</project>
