<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.

WSO2 Inc. licenses this file to you 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">
    <parent>
        <artifactId>org.wso2.carbon.am.integration.test</artifactId>
        <groupId>org.wso2.am</groupId>
        <version>4.1.0-m2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <name>WSO2 API Manager - Based on product benchmark Test Module</name>
    <artifactId>org.wso2.carbon.am.integration.benchmark.test</artifactId>
    <packaging>jar</packaging>

    <profiles>
        <profile>
            <!--The profile below will activate the profile by default or when the system property "integration" is specified with any value-->
            <!--mvn clean install -->
            <!--mvn clean install -DintegrationTests -->
            <id>integration</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>integrationTests</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>xml-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>transform</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <transformationSets>
                                <transformationSet>
                                    <includes>
                                        <include>automation.xml</include>
                                    </includes>
                                    <dir>src/test/resources/</dir>
                                    <stylesheet>
                                        src/test/resources/integration-test-host-config.xsl
                                    </stylesheet>
                                    <outputDir>src/test/resources</outputDir>
                                </transformationSet>
                            </transformationSets>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>3.0.0-M5</version>
                        <inherited>false</inherited>
                        <configuration>
                            <argLine>-Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m</argLine>
                            <suiteXmlFiles>
                                <suiteXmlFile>src/test/resources/testng-server-mgt.xml</suiteXmlFile>
                                <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                            </suiteXmlFiles>
                            <systemProperties>
                                <property>
                                    <name>maven.test.haltafterfailure</name>
                                    <value>false</value>
                                </property>
                                <property>
                                    <name>java.io.tmpdir</name>
                                    <value>${basedir}/target/</value>
                                </property>
                                <property>
                                    <name>carbon.zip</name>
                                    <value>
                                        ${basedir}/../../../distribution/product/target/wso2am-${project.version}.zip
                                    </value>
                                </property>
                                <property>
                                    <name>framework.resource.location</name>
                                    <value>
                                        ${basedir}/src/test/resources/
                                    </value>
                                </property>
                                <property>
                                    <name>usedefaultlisteners</name>
                                    <value>false</value>
                                </property>
                                <property>
                                    <name>org.apache.commons.logging.Log</name>
                                    <value>org.apache.commons.logging.impl.Log4JLogger</value>
                                </property>
                                <sec.verifier.dir>${basedir}/target/security-verifier/</sec.verifier.dir>
                                <instr.file>${basedir}/src/test/resources/instrumentation.txt</instr.file>
                                <filters.file>${basedir}/src/test/resources/filters.txt</filters.file>
                                <apim.server.version>${apimserver.version}</apim.server.version>
                                <startupScript>api-manager</startupScript>
                            </systemProperties>
                            <skipTests>${skipIntegrationTests}</skipTests>
                            <environmentVariables>
                                <SHARED_DATABASE_DRIVER>org.h2.Driver</SHARED_DATABASE_DRIVER>
                                <SHARED_DATABASE_URL>
                                    jdbc:h2:./repository/database/WSO2SHARED_DB;DB_CLOSE_ON_EXIT=FALSE
                                </SHARED_DATABASE_URL>
                                <SHARED_DATABASE_USERNAME>wso2carbon</SHARED_DATABASE_USERNAME>
                                <SHARED_DATABASE_PASSWORD>wso2carbon</SHARED_DATABASE_PASSWORD>
                                <SHARED_DATABASE_VALIDATION_QUERY>SELECT 1</SHARED_DATABASE_VALIDATION_QUERY>
                                <API_MANAGER_DATABASE_DRIVER>org.h2.Driver</API_MANAGER_DATABASE_DRIVER>
                                <API_MANAGER_DATABASE_URL>
                                    jdbc:h2:./repository/database/WSO2AM_DB;DB_CLOSE_ON_EXIT=FALSE
                                </API_MANAGER_DATABASE_URL>
                                <API_MANAGER_DATABASE_USERNAME>wso2carbon</API_MANAGER_DATABASE_USERNAME>
                                <API_MANAGER_DATABASE_PASSWORD>wso2carbon</API_MANAGER_DATABASE_PASSWORD>
                                <API_MANAGER_DATABASE_VALIDATION_QUERY>SELECT 1</API_MANAGER_DATABASE_VALIDATION_QUERY>
                            </environmentVariables>
                            <workingDirectory>${basedir}/target</workingDirectory>
                            <classpathDependencyExcludes>
                                <classpathDependencyExclude>org.ops4j.pax.logging</classpathDependencyExclude>
                            </classpathDependencyExcludes>
                            <systemPropertyVariables>
                                <okHttpLogs>true</okHttpLogs>
                                <disableVerification>true</disableVerification>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!--The profile below will activate the profile by default or when the system property "integration" is specified with any value-->
            <!--mvn clean install -->
            <!--mvn clean install -DintegrationTests -->
            <id>testgrid</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>testgrid</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>xml-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>transform</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <transformationSets>
                                <transformationSet>
                                    <includes>
                                        <include>automation.xml</include>
                                    </includes>
                                    <dir>src/test/resources/</dir>
                                    <stylesheet>
                                        src/test/resources/integration-test-host-config.xsl
                                    </stylesheet>
                                    <outputDir>src/test/resources</outputDir>
                                </transformationSet>
                            </transformationSets>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>net.sf.saxon</groupId>
                                <artifactId>saxon</artifactId>
                                <version>8.7</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <inherited>false</inherited>
                        <version>2.22.1</version>
                        <configuration>
                            <argLine>-Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m</argLine>
                            <suiteXmlFiles>
                                <suiteXmlFile>src/test/resources/testng-server-mgt.xml</suiteXmlFile>
                                <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                            </suiteXmlFiles>
                            <systemProperties>
                                <property>
                                    <name>maven.test.haltafterfailure</name>
                                    <value>false</value>
                                </property>
                                <property>
                                    <name>java.io.tmpdir</name>
                                    <value>${basedir}/target/</value>
                                </property>
                                <property>
                                    <name>carbon.zip</name>
                                    <value>
                                        ${basedir}/../../../distribution/product/target/wso2am-${project.version}.zip
                                    </value>
                                </property>
                                <property>
                                    <name>framework.resource.location</name>
                                    <value>
                                        ${basedir}/src/test/resources/
                                    </value>
                                </property>
                                <property>
                                    <name>usedefaultlisteners</name>
                                    <value>false</value>
                                </property>
                                <sec.verifier.dir>${basedir}/target/security-verifier/</sec.verifier.dir>
                                <instr.file>${basedir}/src/test/resources/instrumentation.txt</instr.file>
                                <filters.file>${basedir}/src/test/resources/filters.txt</filters.file>
                                <startupScript>api-manager</startupScript>
                                <apim.server.version>${apimserver.version}</apim.server.version>
                            </systemProperties>
                            <workingDirectory>${basedir}/target</workingDirectory>
                            <classpathDependencyExcludes>
                                <classpathDependencyExclude>org.ops4j.pax.logging</classpathDependencyExclude>
                            </classpathDependencyExcludes>
                            <systemPropertyVariables>
                                <okHttpLogs>true</okHttpLogs>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!--The profile below will activate the profile when the system property "platform" is specified with any value-->
            <!--mvn clean install -DplatformTests -->
            <id>platform</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>platformTests</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>xml-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>transform</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <transformationSets>
                                <transformationSet>
                                    <includes>
                                        <include>automation.xml</include>
                                    </includes>
                                    <dir>src/test/resources/</dir>
                                    <stylesheet>src/test/resources/platform-test-host-config.xsl
                                    </stylesheet>
                                    <outputDir>src/test/resources</outputDir>
                                </transformationSet>
                            </transformationSets>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>net.sf.saxon</groupId>
                                <artifactId>saxon</artifactId>
                                <version>8.7</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <inherited>false</inherited>
                        <version>2.22.1</version>
                        <configuration>
                            <argLine>-Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m</argLine>
                            <suiteXmlFiles>
                                <suiteXmlFile>src/test/resources/testng-server-mgt.xml</suiteXmlFile>
                                <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                            </suiteXmlFiles>
                            <systemProperties>
                                <property>
                                    <name>maven.test.haltafterfailure</name>
                                    <value>false</value>
                                </property>
                                <property>
                                    <name>java.io.tmpdir</name>
                                    <value>${basedir}/target/</value>
                                </property>
                                <property>
                                    <name>carbon.zip</name>
                                    <value>
                                        ${basedir}/../../../distribution/product/target/wso2am-${project.version}.zip
                                    </value>
                                </property>
                                <property>
                                    <name>framework.resource.location</name>
                                    <value>
                                        ${basedir}/src/test/resources/
                                    </value>
                                </property>
                                <property>
                                    <name>usedefaultlisteners</name>
                                    <value>false</value>
                                </property>
                                <sec.verifier.dir>${basedir}/target/security-verifier/</sec.verifier.dir>
                                <instr.file>${basedir}/src/test/resources/instrumentation.txt</instr.file>
                                <filters.file>${basedir}/src/test/resources/filters.txt</filters.file>
                                <startupScript>api-manager</startupScript>
                            </systemProperties>
                            <systemPropertyVariables>
                                <okHttpLogs>true</okHttpLogs>
                            </systemPropertyVariables>
                            <workingDirectory>${basedir}/target</workingDirectory>
                            <classpathDependencyExcludes>
                                <classpathDependencyExclude>org.ops4j.pax.logging</classpathDependencyExclude>
                            </classpathDependencyExcludes>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>

    </profiles>

    <build>
        <plugins>
<!--            <plugin>-->
<!--                <artifactId>maven-dependency-plugin</artifactId>-->
<!--                <executions>-->
<!--                    <execution>-->
<!--                        <id>copy-thirdparty-km-jar</id>-->
<!--                        <phase>compile</phase>-->
<!--                        <goals>-->
<!--                            <goal>copy-dependencies</goal>-->
<!--                        </goals>-->
<!--                        <configuration>-->
<!--                            <outputDirectory>${project.basedir}/src/test/resources/artifacts/AM/configFiles/idpjwt-->
<!--                            </outputDirectory>-->
<!--                            <includeTypes>jar</includeTypes>-->
<!--                            <includeArtifactIds>org.wso2.am.thirdparty.km</includeArtifactIds>-->
<!--                        </configuration>-->
<!--                    </execution>-->
<!--                </executions>-->
<!--            </plugin>-->
        </plugins>
        <resources>
            <resource>
                <directory>tests-benchmark/src/test/java</directory>
                <includes>
                    <include>*.properties</include>
                </includes>
            </resource>
        </resources>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.wso2.am</groupId>
            <artifactId>org.wso2.am.integration.test.extensions</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.am</groupId>
            <artifactId>org.wso2.am.integration.common.test.utils</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl-over-slf4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.ops4j.pax.logging</groupId>
                    <artifactId>pax-logging-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.ops4j.pax.logging</groupId>
                    <artifactId>pax-logging-log4j2</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-jdk14</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.automationutils</groupId>
            <artifactId>org.wso2.carbon.integration.common.utils</artifactId>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.am</groupId>
            <artifactId>org.wso2.am.thirdparty.km</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.wso2.carbon.apimgt</groupId>
                    <artifactId>org.wso2.carbon.apimgt.impl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wso2.am</groupId>
            <artifactId>org.wso2.carbon.am.integration.backend.test</artifactId>
            <version>4.1.0-m2</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
