<?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.finos.fluxnova.bpm.springboot.project</groupId>
    <artifactId>qa-webapp</artifactId>
    <version>2.0.3</version>
  </parent>

  <artifactId>qa-webapp-ce-runtime</artifactId>
  <name>Fluxnova Platform - Spring Boot Starter - QA - Webapps Runtime</name>

  <properties>
    <version.jersey-json>1.15</version.jersey-json>
    <version.h2>1.4.199</version.h2>
    <version.jaxb-api>2.3.1</version.jaxb-api>
    <version.jersey-apache-client>1.15</version.jersey-apache-client>
    <version.junit>4.12</version.junit>
    <version.chromedriver>141.0.7390.54</version.chromedriver>

    <host.chromedriver>https://storage.googleapis.com/chrome-for-testing-public</host.chromedriver>

    <http.port>58080</http.port>
    <http.ctx-path.webapp>fluxnova/</http.ctx-path.webapp>
    <http.ctx-path.rest>engine-rest/</http.ctx-path.rest>
  </properties>

  <profiles>
    <profile>
      <id>integration-test-spring-boot-starter</id>

      <dependencies>

        <!-- Web Applications -->
        <dependency>
          <groupId>org.finos.fluxnova.bpm.springboot</groupId>
          <artifactId>fluxnova-bpm-spring-boot-starter-webapp</artifactId>
          <version>${project.version}</version>
        </dependency>

        <!-- REST API -->
        <dependency>
          <groupId>org.finos.fluxnova.bpm.springboot</groupId>
          <artifactId>fluxnova-bpm-spring-boot-starter-rest</artifactId>
          <version>${project.version}</version>
        </dependency>

        <dependency>
          <groupId>org.finos.fluxnova.bpm.qa</groupId>
          <artifactId>fluxnova-qa-integration-tests-webapps</artifactId>
          <version>${project.version}</version>
          <scope>test</scope>
        </dependency>

        <dependency>
          <groupId>org.finos.fluxnova.bpm.springboot.project</groupId>
          <artifactId>qa-webapp-invoice-example</artifactId>
          <version>${project.version}</version>
        </dependency>

        <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
        </dependency>

        <dependency>
          <groupId>org.glassfish.jaxb</groupId>
          <artifactId>jaxb-runtime</artifactId>
        </dependency>

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

        <dependency>
          <groupId>org.apache.httpcomponents.client5</groupId>
          <artifactId>httpclient5</artifactId>
          <scope>test</scope>
        </dependency>

        <dependency>
          <groupId>org.seleniumhq.selenium</groupId>
          <artifactId>selenium-java</artifactId>
          <version>${version.selenium}</version>
        </dependency>

        <dependency>
          <groupId>org.graalvm.js</groupId>
          <artifactId>js</artifactId>
          <version>${version.graal.js}</version>
        </dependency>

        <dependency>
          <groupId>org.graalvm.js</groupId>
          <artifactId>js-scriptengine</artifactId>
          <version>${version.graal.js}</version>
        </dependency>

        <dependency>
          <groupId>javax.xml.bind</groupId>
          <artifactId>jaxb-api</artifactId>
          <version>${version.jaxb-api}</version>
          <scope>test</scope>
        </dependency>

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

      <build>
        <plugins>
          <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>${version.spring-boot}</version>
            <configuration>
              <mainClass>org.camunda.bpm.qa.Application</mainClass>
            </configuration>
            <executions>
              <execution>
                <id>pre-integration-test</id>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>post-integration-test</id>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M3</version>
            <configuration>
              <dependenciesToScan>
                <dependency>org.finos.fluxnova.bpm.qa:fluxnova-qa-integration-tests-webapps</dependency>
              </dependenciesToScan>
              <skipTests>false</skipTests>
            </configuration>
            <executions>
              <execution>
                <id>default-test</id>
                <configuration>
                  <skip>true</skip>
                </configuration>
              </execution>
              <execution>
                <id>integration-tests</id>
                <phase>integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <includes>
                    <include>**/*IT.*</include>
                  </includes>

                  <excludes>
                    <exclude>**/ErrorPageIT.*</exclude>
                  </excludes>
                </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>${host.chromedriver}/${version.chromedriver}/${os.type}/chromedriver-${os.type}.zip</url>
                  <outputFileName>chromedriver.zip</outputFileName>
                  <unpack>true</unpack>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>

        <testResources>
          <testResource>
            <directory>src/test/resources</directory>
            <filtering>true</filtering>
          </testResource>
        </testResources>
      </build>
    </profile>
  </profiles>

</project>
