<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ 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">

    <parent>
        <groupId>org.wso2.carbon.identity.gateway</groupId>
        <artifactId>org.wso2.carbon.identity.gateway.tests</artifactId>
        <relativePath>../pom.xml</relativePath>
        <version>0.1.2</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>identity-gateway-module-tests</artifactId>
    <name>WSO2 Carbon Identity Gateway Module - OSGi Tests</name>
    <description>OSGi Tests for Carbon Identity Inbound Provisioning SCIM2</description>
    <url>http://wso2.com</url>

    <dependencies>

        <!-- Carbon Dependencies-->

        <dependency>
            <groupId>org.wso2.carbon.caching</groupId>
            <artifactId>org.wso2.carbon.caching</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.mgt</groupId>
            <artifactId>org.wso2.carbon.identity.mgt</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.wso2.carbon.transport</groupId>-->
            <!--<artifactId>org.wso2.carbon.transport.http.netty</artifactId>-->
            <!--<scope>test</scope>-->
        <!--</dependency>-->


        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
        </dependency>

        <dependency>
            <groupId>commons-codec.wso2</groupId>
            <artifactId>commons-codec</artifactId>
            <version>${commons.codec.version}</version>
        </dependency>

        <dependency>
            <groupId>org.wso2.orbit.com.lmax</groupId>
            <artifactId>disruptor</artifactId>
        </dependency>

        <!-- Dependencies for Testing -->
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>osgi-test-util</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-container-native</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-testng</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-link-mvn</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.url</groupId>
            <artifactId>pax-url-aether</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.logging</groupId>
            <artifactId>pax-logging-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.logging</groupId>
            <artifactId>pax-logging-log4j2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.logging</groupId>
            <artifactId>pax-logging-api</artifactId>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
        </dependency>
        <dependency>
            <groupId>xalan.wso2</groupId>
            <artifactId>xalan</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jacoco</groupId>
            <artifactId>org.jacoco.ant</artifactId>
        </dependency>

        <!-- Other Dependencies-->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
        </dependency>

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-transport</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-buffer</artifactId>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-common</artifactId>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-codec</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>io.netty</groupId>-->
            <!--<artifactId>netty-codec-http</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-handler</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ow2.spec.ee</groupId>
            <artifactId>ow2-jta-1.1-spec</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.minidev.wso2</groupId>
            <artifactId>json-smart</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io.wso2</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-pool.wso2</groupId>
            <artifactId>commons-pool</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
        <dependency>
            <groupId>net.minidev</groupId>
            <artifactId>asm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.mgt</groupId>
            <artifactId>org.wso2.carbon.identity.claim</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.wso2.msf4j</groupId>
                    <artifactId>msf4j-all</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.lcm</groupId>
            <artifactId>org.wso2.carbon.lcm.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.lcm</groupId>
            <artifactId>org.wso2.carbon.lcm.sql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.mgt</groupId>
            <artifactId>in-memory-connectors-test-artifact</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wso2.carbon.identity.gateway</groupId>
            <artifactId>org.wso2.carbon.identity.gateway.common</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>javax.ws.rs</groupId>
                    <artifactId>javax.ws.rs-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.gateway</groupId>
            <artifactId>org.wso2.carbon.identity.gateway.api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.gateway</groupId>
            <artifactId>org.wso2.carbon.identity.gateway</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>javax.ws.rs</groupId>
                    <artifactId>javax.ws.rs-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.gateway</groupId>
            <artifactId>org.wso2.carbon.identity.gateway.resource</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>javax.ws.rs</groupId>
                    <artifactId>javax.ws.rs-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.deployment</groupId>
            <artifactId>org.wso2.carbon.deployment.engine</artifactId>
            <version>${carbon.deployment.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-lang.wso2</groupId>
            <artifactId>commons-lang</artifactId>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wso2.msf4j</groupId>
            <artifactId>msf4j-core</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- sample dependencies -->

        <dependency>
            <groupId>org.wso2.carbon.identity.gateway</groupId>
            <artifactId>org.wso2.carbon.identity.inbound.sample</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.gateway</groupId>
            <artifactId>org.wso2.carbon.identity.outbound.sample</artifactId>
        </dependency>


    </dependencies>

    <profiles>
        <profile>
            <id>with-tests</id>
            <activation>
                <property>
                    <name>!maven.test.skip</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>

                            <execution>
                                <id>copy-jacoco-dependencies</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                    <includeTypes>jar</includeTypes>
                                    <includeArtifactIds>org.jacoco.ant</includeArtifactIds>
                                    <stripVersion>true</stripVersion>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>pre-unit-test</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <propertyName>surefireArgLine</propertyName>
                                    <destFile>${project.build.directory}/jacoco.exec</destFile>
                                    <includes>
                                        <include>org.wso2.*</include>
                                    </includes>
                                    <append>true</append>
                                    <sessionId>user-portal-tests</sessionId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>${surefireArgLine}</argLine>
                            <systemPropertyVariables>
                                <org.ops4j.pax.url.mvn.localRepository>${settings.localRepository}
                                </org.ops4j.pax.url.mvn.localRepository>
                                <jacoco-agent.destfile>${project.build.directory}/jacoco.exec</jacoco-agent.destfile>
                                <org.ops4j.pax.logging.DefaultServiceLog.level>INFO
                                </org.ops4j.pax.logging.DefaultServiceLog.level>
                                <osgi.console>6666</osgi.console>
                            </systemPropertyVariables>
                            <systemProperties>
                                <property>
                                    <name>carbon.home</name>
                                    <value>${project.build.directory}/test-classes/carbon-home</value>
                                </property>
                                <property>
                                    <name>osgi.console</name>
                                    <value>6666</value>
                                </property>
                            </systemProperties>
                            <suiteXmlFiles>
                                <suiteXmlFile>${project.basedir}/src/test/resources/testng.xml</suiteXmlFile>
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>


                    <!--<plugin>-->
                        <!--<groupId>org.apache.maven.plugins</groupId>-->
                        <!--<artifactId>maven-antrun-plugin</artifactId>-->
                        <!--<executions>-->
                            <!--<execution>-->
                                <!--<phase>prepare-package</phase>-->
                                <!--<configuration>-->
                                    <!--<target xmlns:jacoco="antlib:org.jacoco.ant">-->
                                        <!--//this task is to provide class/src files locations for jacoco report generation-->
                                        <!--<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">-->
                                            <!--<classpath path="${project.build.directory}" />-->
                                        <!--</taskdef>-->
                                        <!--<jacoco:report>-->
                                            <!--<executiondata>-->
                                                <!--<file file="${project.build.directory}/jacoco.exec" />-->
                                            <!--</executiondata>-->
                                            <!--<structure name="Identity Server Tests">-->
                                                <!--<classfiles>-->
                                                    <!--<fileset dir="../../components/org.wso2.carbon.identity.inbound.provisioning.scim2.common/target/classes" />-->
                                                    <!--<fileset dir="../../components/org.wso2.carbon.identity.inbound.provisioning.scim2.provider/target/classes" />-->
                                                <!--</classfiles>-->
                                                <!--<sourcefiles encoding="UTF-8">-->
                                                    <!--<fileset dir="../../components/org.wso2.carbon.identity.inbound.provisioning.scim2.common/src" />-->
                                                    <!--<fileset dir="../../components/org.wso2.carbon.identity.inbound.provisioning.scim2.provider/src" />-->
                                                <!--</sourcefiles>-->
                                            <!--</structure>-->
                                            <!--<html destdir="${project.build.directory}/site/jacoco" />-->
                                        <!--</jacoco:report>-->
                                    <!--</target>-->
                                <!--</configuration>-->
                                <!--<goals>-->
                                    <!--<goal>run</goal>-->
                                <!--</goals>-->
                            <!--</execution>-->
                        <!--</executions>-->
                        <!--<dependencies>-->
                            <!--<dependency>-->
                                <!--<groupId>org.jacoco</groupId>-->
                                <!--<artifactId>org.jacoco.ant</artifactId>-->
                                <!--<version>${org.jacoco.ant.version}</version>-->
                            <!--</dependency>-->
                        <!--</dependencies>-->
                    <!--</plugin>-->
                    <plugin>
                        <groupId>org.ops4j.pax.exam</groupId>
                        <artifactId>maven-paxexam-plugin</artifactId>
                        <version>${maven.paxexam.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>generate-config</id>
                                <goals>
                                    <goal>generate-depends-file</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>