<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ Codehaus CARGO, copyright 2004-2011 Vincent Massol, 2012-2020 Ali Tokmen.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-samples-maven2</artifactId>
    <version>1.7.10</version>
  </parent>
  <artifactId>cargo-sample-maven2-users-test</artifactId>
  <name>Cargo Samples - Maven 2 - Users test</name>
  <packaging>jar</packaging>
  <description>Sample application that will be used to test configuration of users and roles.</description>

  <dependencies>
    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-sample-java</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>authentication-war</artifactId>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>run-its</id>
      <activation>
        <property>
          <name>skipTests</name>
          <value>!true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>${project.version}</version>
            <configuration>
              <container>
                <containerId>tomcat8x</containerId>
                <artifactInstaller>
                  <groupId>org.apache.tomcat</groupId>
                  <artifactId>tomcat</artifactId>
                  <version>8.5.50</version>
                </artifactInstaller>
              </container>
              <configuration>
                <properties>
                  <cargo.servlet.port>${cargo.samples.servlet.port}</cargo.servlet.port>
                  <cargo.servlet.users>someone:passw0rd:cargo</cargo.servlet.users>
                </properties>
                <users>
                  <user>
                    <name>elementUser</name>
                    <password>pass</password>
                    <roles>
                      <role>cargo</role>
                    </roles>
                  </user>
                </users>
              </configuration>
              <deployables>
                <deployable>
                  <groupId>org.codehaus.cargo</groupId>
                  <artifactId>authentication-war</artifactId>
                  <type>war</type>
                </deployable>
              </deployables>
            </configuration>
            <executions>
              <execution>
                <id>start</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>surefire-it</id>
                <phase>integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <skip>false</skip>
                  <systemProperties>
                    <property>
                      <name>http.port</name>
                      <value>${cargo.samples.servlet.port}</value>
                    </property>
                  </systemProperties>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
