<?xml version="1.0" encoding="UTF-8"?>

<!--
  Codehaus Cargo, copyright 2004-2011 Vincent Massol, 2012-2025 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-maven3</artifactId>
    <version>1.10.25</version>
  </parent>
  <artifactId>cargo-sample-maven3-websphere-test</artifactId>
  <name>Cargo Samples - Maven 3 - WebSphere test</name>
  <packaging>jar</packaging>
  <description>Sample application that will be used to test the WebSphere container</description>

  <!--
   The WebSphere container works best as an existing configuration, so reuse port number as
   they're configured in WebSphere itself.
   -->
  <properties>
    <cargo.samples.servlet.port>9080</cargo.samples.servlet.port>
    <cargo.websphere.profile>AppSrv01</cargo.websphere.profile>
    <cargo.websphere.node>virtualbox-xpNode01</cargo.websphere.node>
    <cargo.websphere.cell>virtualbox-xpNode01Cell</cargo.websphere.cell>
    <cargo.websphere.server>server1</cargo.websphere.server>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>classpath-war</artifactId>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>simple-ear</artifactId>
      <type>ear</type>
    </dependency>
    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>simple-jar</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>simple-war</artifactId>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>datasource-war</artifactId>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>jms-queue-war</artifactId>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>authentication-war</artifactId>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>systemproperty-war</artifactId>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
    </dependency>
  </dependencies>

  <profiles>
    <!-- WebSphere 8.5.x -->
    <profile>
      <id>websphere85x</id>
      <activation>
        <property>
          <name>cargo.websphere85x.home</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <configuration>
              <skip>false</skip>
              <container>
                <containerId>websphere85x</containerId>
                <home>${cargo.websphere85x.home}</home>
              </container>
              <configuration>
                <properties>
                  <cargo.java.home>${cargo.websphere85x.home}/java/jre</cargo.java.home>
                </properties>
              </configuration>
            </configuration>
          </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>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- WebSphere 9.x -->
    <profile>
      <id>websphere9x</id>
      <activation>
        <property>
          <name>cargo.websphere9x.home</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <configuration>
              <skip>false</skip>
              <container>
                <containerId>websphere9x</containerId>
                <home>${cargo.websphere9x.home}</home>
              </container>
              <configuration>
                <properties>
                  <cargo.java.home>${cargo.websphere9x.home}/java/jre</cargo.java.home>
                </properties>
              </configuration>
            </configuration>
          </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>
                </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>
          <systemPropertyVariables>
            <http.port>${cargo.samples.servlet.port}</http.port>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven3-plugin</artifactId>
        <version>${project.version}</version>
        <configuration>
          <skip>true</skip>
          <container>
            <type>installed</type>
            <dependencies>
              <dependency>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>simple-jar</artifactId>
              </dependency>
              <dependency>
                <groupId>org.apache.derby</groupId>
                <artifactId>derby</artifactId>
              </dependency>
            </dependencies>
            <systemProperties>
              <cargo.system.property>CargoSystemProp</cargo.system.property>
            </systemProperties>
          </container>
          <configuration>
            <type>standalone</type>
            <properties>
              <cargo.servlet.port>${cargo.samples.servlet.port}</cargo.servlet.port>
              <cargo.servlet.users>someone:p@ssw0rd:cargo</cargo.servlet.users>
              <cargo.datasource.datasource.derby>
                cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource|
                cargo.datasource.url=jdbc:derby:derbyDB;create=true|
                cargo.datasource.jndi=jdbc/CargoDS|
                cargo.datasource.username=sa|
                cargo.datasource.password=|
                cargo.datasource.id=derbyDB|
                cargo.datasource.properties=createDatabase=create;databaseName=derbyDB
              </cargo.datasource.datasource.derby>
              <cargo.resource.resource.jms.cf>
                cargo.resource.name=jms/cf/MyCf|
                cargo.resource.type=javax.jms.ConnectionFactory|
                cargo.resource.id=MyCf
              </cargo.resource.resource.jms.cf>
              <cargo.resource.resource.jms.queue>
                cargo.resource.name=jms/MyQueue|
                cargo.resource.type=javax.jms.Queue|
                cargo.resource.id=MyQueue
              </cargo.resource.resource.jms.queue>
              <cargo.websphere.server>${cargo.websphere.server}</cargo.websphere.server>
              <cargo.websphere.classloader.mode>PARENT_LAST</cargo.websphere.classloader.mode>
              <cargo.websphere.war.classloader.policy>SINGLE</cargo.websphere.war.classloader.policy>
            </properties>
          </configuration>
          <deployables>
            <deployable>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>classpath-war</artifactId>
              <type>war</type>
            </deployable>
            <deployable>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>simple-ear</artifactId>
              <type>ear</type>
            </deployable>
            <deployable>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>simple-war</artifactId>
              <type>war</type>
            </deployable>
            <deployable>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>datasource-war</artifactId>
              <type>war</type>
            </deployable>
            <deployable>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>jms-queue-war</artifactId>
              <type>war</type>
            </deployable>
            <deployable>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>authentication-war</artifactId>
              <type>war</type>
            </deployable>
            <deployable>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>systemproperty-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>
    </plugins>
  </build>
</project>
