<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>

  <artifactId>eximeebpms-qa-integration-tests-webapps-root</artifactId>
  <name>EximeeBPMS - QA Integration Tests - Webapps Root</name>

  <packaging>pom</packaging>

  <parent>
    <groupId>org.eximeebpms.bpm.qa</groupId>
    <artifactId>eximeebpms-qa</artifactId>
    <version>1.1.2</version>
  </parent>

  <properties>
    <cargo.timeout>120000</cargo.timeout>
    <cargo.deploy.timeout>60000</cargo.deploy.timeout>

    <!-- Fixed for WildFly 26 -->
    <cargo.wildfly26.container.id>wildfly26x</cargo.wildfly26.container.id>
    <!-- Needs to be adjusted with every WildFly update -->
    <cargo.wildfly.container.id>wildfly35x</cargo.wildfly.container.id>

    <redirect.test.output>true</redirect.test.output>

    <http.ctx-path.webapp>eximeebpms/</http.ctx-path.webapp>
    <http.ctx-path.rest>engine-rest/</http.ctx-path.rest>

    <version.chromedriver>135.0.7049.52</version.chromedriver>

    <!-- default os -->
    <os.type>linux64</os.type>
  </properties>

  <modules>
    <module>integration-tests</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.shrinkwrap.resolver</groupId>
        <artifactId>shrinkwrap-resolver-bom</artifactId>
        <version>${version.shrinkwrap.resolvers}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>${version.arquillian}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>

      <dependency>
        <groupId>org.apache.httpcomponents.client5</groupId>
        <artifactId>httpclient5</artifactId>
        <version>${version.httpclient5}</version>
      </dependency>
	  
      <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>${version.selenium}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- set shrinkwrap artifacts -->
    <dependency>
      <groupId>org.jboss.shrinkwrap.resolver</groupId>
      <artifactId>shrinkwrap-resolver-depchain</artifactId>
      <exclusions>
        <exclusion>
          <!-- conflicts with the version pulled in transitively via selenium-java  -->
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-lang</groupId>
          <artifactId>commons-lang</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-lang3</artifactId>
        </exclusion>
      </exclusions>
      <scope>test</scope>
      <type>pom</type>
    </dependency>

    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.protocol</groupId>
      <artifactId>arquillian-protocol-servlet</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.spec</groupId>
      <artifactId>jboss-javaee-6.0</artifactId>
      <type>pom</type>
      <scope>provided</scope>
      <exclusions>
        <exclusion>
          <artifactId>xalan</artifactId>
          <groupId>org.apache.xalan</groupId>
        </exclusion>
      </exclusions>
    </dependency>

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

    <dependency>
      <groupId>xml-apis</groupId>
      <artifactId>xml-apis</artifactId>
      <version>2.0.2</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.httpcomponents.client5</groupId>
      <artifactId>httpclient5</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>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <scope>test</scope>
    </dependency>

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

    <dependency>
      <groupId>org.eximeebpms.commons</groupId>
      <artifactId>eximeebpms-commons-logging</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.eximeebpms.bpm.example</groupId>
      <artifactId>eximeebpms-example-invoice</artifactId>
      <version>${project.version}</version>
      <type>war</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.eximeebpms.bpm</groupId>
      <artifactId>eximeebpms-engine-rest</artifactId>
      <type>jar</type>
      <classifier>classes</classifier>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <!-- build & deploy artifacts -->
      <id>distro</id>

      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

      <modules>
        <module>shared-engine</module>
      </modules>
    </profile>

    <profile>
      <id>webapps-integration</id>
      <modules>
        <module>shared-engine</module>
      </modules>
    </profile>

    <profile>
      <id>chromedriver-windows</id>
      <activation>
        <os>
          <family>windows</family>
        </os>
      </activation>
      <properties>
        <os.type>win32</os.type>
      </properties>
    </profile>

    <profile>
      <id>chromedriver-osx</id>
      <activation>
        <os>
          <family>mac</family>
        </os>
      </activation>
      <properties>
        <os.type>mac64</os.type>
      </properties>
    </profile>
  </profiles>

  <build>
    <plugins>
      <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>

</project>
