<?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>org.eximeebpms.bpm.run</groupId>
    <artifactId>eximeebpms-bpm-run-qa</artifactId>
    <version>1.1.2</version>
    <relativePath>..</relativePath>
  </parent>

  <artifactId>eximeebpms-bpm-run-qa-runtime</artifactId>
  <name>EximeeBPMS - Run - QA - Runtime</name>
  <packaging>jar</packaging>

  <properties>
    <run-home>${project.build.directory}/run/eximeebpms-bpm-run-distro</run-home>
    <example-plugin-home>${project.build.directory}/run/example-plugin</example-plugin-home>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.eximeebpms.bpm.run</groupId>
      <artifactId>eximeebpms-bpm-run</artifactId>
      <version>${project.version}</version>
      <type>zip</type>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <!-- exclude transitive artifacts so that they don't
              conflict with the qa runtime versions. -->
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.eximeebpms.bpm.run</groupId>
      <artifactId>eximeebpms-bpm-run-qa-integration-tests</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
      <classifier>tests</classifier>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- JNA needed for Managed Container -->
    <dependency>
      <groupId>net.java.dev.jna</groupId>
      <artifactId>jna</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>net.java.dev.jna</groupId>
      <artifactId>jna-platform</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- REST -->
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-lang3</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- Webapps -->
    <dependency>
      <groupId>org.eximeebpms.bpm.qa</groupId>
      <artifactId>eximeebpms-qa-integration-tests-webapps</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.eximeebpms.bpm.model</groupId>
      <artifactId>eximeebpms-bpmn-model</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-java</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.httpcomponents.client5</groupId>
      <artifactId>httpclient5</artifactId>
      <version>${version.httpclient5}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.konghq</groupId>
      <artifactId>unirest-java</artifactId>
      <version>${version.unirest-java}</version>
      <classifier>standalone</classifier>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <profiles>
    <profile>
      <id>integration-test-eximeebpms-run</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.16</version>
            <configuration>
              <redirectTestOutputToFile>true</redirectTestOutputToFile>
              <dependenciesToScan>
                <dependenciesToScan>org.eximeebpms.bpm.run:eximeebpms-bpm-run-qa-integration-tests</dependenciesToScan>
              </dependenciesToScan>
              <systemPropertyVariables>
                <eximeebpms.run.home>${run-home}</eximeebpms.run.home>
                <example.plugin.home>${example-plugin-home}</example.plugin.home>
                <selenium.screenshot.directory>${project.build.directory}/selenium-screenshots</selenium.screenshot.directory>
              </systemPropertyVariables>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-run-distro</id>
                <goals>
                  <goal>unpack-dependencies</goal>
                </goals>
                <phase>generate-test-resources</phase>
                <configuration>
                  <includeArtifactIds>eximeebpms-bpm-run</includeArtifactIds>
                  <overWriteSnapshots>true</overWriteSnapshots>
                  <excludeTransitive>true</excludeTransitive>
                  <outputDirectory>${run-home}</outputDirectory>
                  <excludes>configuration/default.yml,configuration/production.yml</excludes>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-plugin</id>
                <goals>
                  <goal>copy</goal>
                </goals>
                <phase>generate-test-resources</phase>
                <configuration>
                  <artifact>org.eximeebpms.bpm.run:eximeebpms-bpm-run-example-plugin:${project.version}</artifact>
                  <overWriteSnapshots>true</overWriteSnapshots>
                  <stripVersion>true</stripVersion>
                  <outputDirectory>${example-plugin-home}</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.googlecode.maven-download-plugin</groupId>
            <artifactId>download-maven-plugin</artifactId>
            <version>1.3.0</version>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <goals>
                  <goal>wget</goal>
                </goals>
                <configuration>
                  <url>https://storage.googleapis.com/chrome-for-testing-public/${version.chromedriver}/${os.type}/chromedriver-${os.type}.zip</url>
                  <outputFileName>chromedriver.zip</outputFileName>
                  <unpack>true</unpack>
                  <outputDirectory>${project.build.directory}/chromedriver</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target>
                    <move todir="${project.build.directory}/chromedriver">
                      <fileset dir="${project.build.directory}/chromedriver/chromedriver-${os.type}" />
                    </move>
                    <delete dir="${project.build.directory}/chromedriver/chromedriver-${os.type}" />
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>windows</id>
      <activation>
        <os>
          <family>windows</family>
        </os>
      </activation>
      <properties>
        <os.type>win32</os.type>
      </properties>
    </profile>
    <profile>
      <id>mac</id>
      <activation>
        <os>
          <family>mac</family>
        </os>
      </activation>
      <properties>
        <os.type>mac64</os.type>
      </properties>
    </profile>
  </profiles>

</project>
