<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2018 Radoslav Husár
  ~
  ~ 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/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>clusterbench</artifactId>
        <groupId>org.jboss.test</groupId>
        <version>3.0.0.Final</version>
    </parent>

    <artifactId>clusterbench-ee8-ear</artifactId>
    <version>3.0.0.Final</version>
    <packaging>ear</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <finalName>clusterbench-ee8</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <!-- Define executions since 'ear' packaging skips test compilation -->
                <executions>
                    <execution>
                        <id>testCompile</id>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>3.0.1</version>
                <configuration>
                    <version>8</version>
                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                    <modules>
                        <ejbModule>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>clusterbench-ee8-ejb</artifactId>
                            <bundleFileName>clusterbench-ee8-ejb.jar</bundleFileName>
                        </ejbModule>
                        <webModule>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>clusterbench-ee8-web</artifactId>
                            <classifier>default</classifier>
                            <contextRoot>/clusterbench</contextRoot>
                            <bundleFileName>clusterbench-ee8-web.war</bundleFileName>
                        </webModule>
                        <webModule>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>clusterbench-ee8-web</artifactId>
                            <classifier>passivating</classifier>
                            <contextRoot>/clusterbench-passivating</contextRoot>
                            <bundleFileName>clusterbench-ee8-web-passivating.war</bundleFileName>
                        </webModule>
                        <webModule>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>clusterbench-ee8-web</artifactId>
                            <classifier>granular</classifier>
                            <contextRoot>/clusterbench-granular</contextRoot>
                            <bundleFileName>clusterbench-ee8-web-granular.war</bundleFileName>
                        </webModule>
                    </modules>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M3</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit4</artifactId>
                        <version>3.0.0-M3</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>clusterbench-ee8-ejb</artifactId>
            <version>${project.version}</version>
            <type>ejb</type>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>clusterbench-ee8-web</artifactId>
            <version>${project.version}</version>
            <classifier>default</classifier>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>clusterbench-ee8-web</artifactId>
            <version>${project.version}</version>
            <classifier>passivating</classifier>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>clusterbench-ee8-web</artifactId>
            <version>${project.version}</version>
            <classifier>granular</classifier>
            <type>war</type>
        </dependency>
        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.6</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>integration</id>
            <activation>
                <property>
                    <name>!skipTests</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.wildfly.plugins</groupId>
                        <artifactId>wildfly-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>integration-test-wildfly-deploy</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start</goal>
                                    <goal>execute-commands</goal>
                                    <goal>deploy</goal>
                                </goals>
                                <configuration>
                                    <scripts>
                                        <script>remote-cache-container.cli</script>
                                    </scripts>
                                    <version>${version.org.wildfly}</version>
                                    <server-args>
                                        <server-arg>--server-config=standalone-full-ha.xml</server-arg>
                                        <server-arg>-Djboss.node.name=clusterbench-1</server-arg>
                                    </server-args>
                                </configuration>
                            </execution>
                            <execution>
                                <id>integration-test-wildfly-undeploy</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>undeploy</goal>
                                    <goal>shutdown</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- shortens name of bundled JARs and WARs -->
            <id>short-names</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-ear-plugin</artifactId>
                        <version>3.0.1</version>
                        <configuration>
                            <version>8</version>
                            <defaultLibBundleDir>lib</defaultLibBundleDir>
                            <modules>
                                <ejbModule>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>clusterbench-ee8-ejb</artifactId>
                                    <bundleFileName>clusterbench-ejb.jar</bundleFileName>
                                </ejbModule>
                                <webModule>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>clusterbench-ee8-web</artifactId>
                                    <classifier>default</classifier>
                                    <contextRoot>/clusterbench</contextRoot>
                                    <bundleFileName>a.war</bundleFileName>
                                </webModule>
                                <webModule>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>clusterbench-ee8-web</artifactId>
                                    <classifier>passivating</classifier>
                                    <contextRoot>/clusterbench-passivating</contextRoot>
                                    <bundleFileName>b.war</bundleFileName>
                                </webModule>
                                <webModule>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>clusterbench-ee8-web</artifactId>
                                    <classifier>granular</classifier>
                                    <contextRoot>/clusterbench-granular</contextRoot>
                                    <bundleFileName>c.war</bundleFileName>
                                </webModule>
                            </modules>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- mvn clean install -P ee8,singleton-deployment-specific-descriptor -->
            <id>singleton-deployment-specific-descriptor</id>
            <build>
                <finalName>clusterbench-ee8</finalName>
                <plugins>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>copy-resources</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${basedir}/target/${project.build.finalName}/META-INF</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>src/main/singleton-deployment-specific-descriptor/META-INF</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- mvn clean install -P ee8,singleton-deployment-jboss-all -->
            <id>singleton-deployment-jboss-all</id>
            <build>
                <finalName>clusterbench-ee8</finalName>
                <plugins>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>copy-resources</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${basedir}/target/${project.build.finalName}/META-INF</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>src/main/singleton-deployment-jboss-all/META-INF</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- mvn clean install -P ee8,shared-sessions -->
            <id>shared-sessions</id>
            <build>
                <finalName>clusterbench-ee8</finalName>
                <plugins>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>copy-resources</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${basedir}/target/${project.build.finalName}/META-INF</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>src/main/shared-sessions/META-INF</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-ear-plugin</artifactId>
                        <version>3.0.1</version>
                        <configuration>
                            <version>8</version>
                            <defaultLibBundleDir>lib</defaultLibBundleDir>
                            <modules>
                                <ejbModule>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>clusterbench-ee8-ejb</artifactId>
                                </ejbModule>
                                <webModule>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>clusterbench-ee8-web</artifactId>
                                    <classifier>default</classifier>
                                    <bundleFileName>clusterbench-ee8-web-default.war</bundleFileName>
                                    <contextRoot>/clusterbench</contextRoot>
                                </webModule>
                                <webModule>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>clusterbench-ee8-web</artifactId>
                                    <classifier>default</classifier>
                                    <bundleFileName>clusterbench-ee8-web-default-1.war</bundleFileName>
                                    <contextRoot>/clusterbench-shared-sessions-1</contextRoot>
                                </webModule>
                                <webModule>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>clusterbench-ee8-web</artifactId>
                                    <classifier>default</classifier>
                                    <bundleFileName>clusterbench-ee8-web-default-2.war</bundleFileName>
                                    <contextRoot>/clusterbench-shared-sessions-2</contextRoot>
                                </webModule>
                                <webModule>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>clusterbench-ee8-web</artifactId>
                                    <classifier>passivating</classifier>
                                    <contextRoot>/clusterbench-passivating</contextRoot>
                                </webModule>
                                <webModule>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>clusterbench-ee8-web</artifactId>
                                    <classifier>granular</classifier>
                                    <contextRoot>/clusterbench-granular</contextRoot>
                                </webModule>
                            </modules>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- mvn clean install -P ee8,sso-form -->
            <id>sso-form</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-ear-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>clusterbench-sso-1</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>generate-application-xml</goal>
                                    <goal>ear</goal>
                                </goals>
                                <configuration>
                                    <finalName>${project.build.finalName}-1</finalName>
                                    <workDirectory>${project.build.directory}/${project.build.finalName}-1</workDirectory>
                                    <generatedDescriptorLocation>${project.build.directory}/${project.build.finalName}-1-tmp</generatedDescriptorLocation>
                                    <version>8</version>
                                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                                    <modules>
                                        <ejbModule>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>clusterbench-ee8-ejb</artifactId>
                                        </ejbModule>
                                        <webModule>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>clusterbench-ee8-web</artifactId>
                                            <classifier>default</classifier>
                                            <contextRoot>/clusterbench-sso-1</contextRoot>
                                        </webModule>
                                        <webModule>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>clusterbench-ee8-web</artifactId>
                                            <classifier>passivating</classifier>
                                            <contextRoot>/clusterbench-passivating1</contextRoot>
                                        </webModule>
                                        <webModule>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>clusterbench-ee8-web</artifactId>
                                            <classifier>granular</classifier>
                                            <contextRoot>/clusterbench-granular1</contextRoot>
                                        </webModule>
                                    </modules>
                                </configuration>
                            </execution>
                            <execution>
                                <id>clusterbench-sso-2</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>generate-application-xml</goal>
                                    <goal>ear</goal>
                                </goals>
                                <configuration>
                                    <finalName>${project.build.finalName}-2</finalName>
                                    <workDirectory>${project.build.directory}/${project.build.finalName}-2</workDirectory>
                                    <generatedDescriptorLocation>${project.build.directory}/${project.build.finalName}-2-tmp</generatedDescriptorLocation>
                                    <version>8</version>
                                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                                    <modules>
                                        <ejbModule>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>clusterbench-ee8-ejb</artifactId>
                                        </ejbModule>
                                        <webModule>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>clusterbench-ee8-web</artifactId>
                                            <classifier>default</classifier>
                                            <contextRoot>/clusterbench-sso-2</contextRoot>
                                        </webModule>
                                        <webModule>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>clusterbench-ee8-web</artifactId>
                                            <classifier>passivating</classifier>
                                            <contextRoot>/clusterbench-passivating2</contextRoot>
                                        </webModule>
                                        <webModule>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>clusterbench-ee8-web</artifactId>
                                            <classifier>granular</classifier>
                                            <contextRoot>/clusterbench-granular2</contextRoot>
                                        </webModule>
                                    </modules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
