<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ /*
  ~ *  Copyright (c) 2017, 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>
        <groupId>org.wso2.carbon.auth</groupId>
        <artifactId>auth</artifactId>
        <version>1.0.59</version>
		<relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>org.wso2.carbon.auth.user.store</artifactId>
	<packaging>bundle</packaging>

	<name>Carbon Auth - Userstore</name>
	
	<dependencies>
		<dependency>
            <groupId>org.wso2.carbon.datasources</groupId>
            <artifactId>org.wso2.carbon.datasource.core</artifactId>
        </dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
		</dependency>
		<dependency>
			<groupId>org.wso2.eclipse.osgi</groupId>
			<artifactId>org.eclipse.osgi</artifactId>
		</dependency>
		<dependency>
			<groupId>org.wso2.eclipse.osgi</groupId>
			<artifactId>org.eclipse.osgi.services</artifactId>
		</dependency>
		<dependency>
			<groupId>org.osgi</groupId>
			<artifactId>org.osgi.core</artifactId>
		</dependency>
		<dependency>
            <groupId>org.wso2.carbon.auth</groupId>
            <artifactId>org.wso2.carbon.auth.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.charon</groupId>
            <artifactId>org.wso2.charon3.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4-rule-agent</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>local-ldap</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>start-docker-for-ldap</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-docker-for-ldap</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                    <goal>remove</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <images>
                                <image>
                                    <alias>apim-ldap</alias>
                                    <name>ruks/ldap</name>
                                    <run>
                                        <namingStrategy>alias</namingStrategy>
                                        <env>
                                        </env>
                                        <ports>
                                            <port>389:389</port>
                                        </ports>
                                        <wait>
                                            <tcp>
                                                <ports>
                                                    <port>389</port>
                                                </ports>
                                            </tcp>
                                            <time>6000000</time>
                                        </wait>
                                    </run>
                                </image>
                            </images>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.19.1</version>
                        <executions>
                            <execution>
                                <id>integration-test-for-ldap</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>verify-for-ldap</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <environmentVariables>
                            </environmentVariables>
                            <suiteXmlFiles>
                                <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>integration-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.19.1</version>
                        <executions>
                            <execution>
                                <id>integration-for-generic-tests</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>verify-for-generic-tests</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>org/wso2/carbon/auth/user/store/test/**</exclude>
                        <exclude>org/wso2/carbon/auth/user/store/connector/ldap/LDAPUserStoreConnectorIT.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <!-- Specify this plugin to build the configuration class -->
            <plugin>
                <groupId>org.wso2.carbon.config</groupId>
                <artifactId>org.wso2.carbon.config.maven.plugin</artifactId>
                <version>${carbon.config.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>create-doc</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemProperties>
                        <property>
                            <name>carbon.home</name>
                            <value>${basedir}/src/test/resources/</value>
                        </property>
                    </systemProperties>
                    <skip>${skip.surefire.test}</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${basedir}/target/coverage-reports/jacoco-ut.exec</destFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>pre-integration-test</id>
                        <goals>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                        <configuration>
                            <destFile>${basedir}/target/coverage-reports/jacoco-it.exec</destFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-integration-test</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${basedir}/target/coverage-reports/jacoco-it.exec</dataFile>
                            <outputDirectory>${basedir}/target/coverage-reports/site/jacoco-it</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${basedir}/target/coverage-reports/jacoco-ut.exec</dataFile>
                            <outputDirectory>${basedir}/target/coverage-reports/site/jacoco-ut</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>merge-results</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>merge</goal>
                        </goals>
                        <configuration>
                            <fileSets>
                                <fileSet>
                                    <directory>${basedir}/target/coverage-reports</directory>
                                    <includes>
                                        <include>*.exec</include>
                                    </includes>
                                </fileSet>
                            </fileSets>
                            <destFile>${basedir}/target/coverage-reports/aggregate.exec</destFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-merge-report</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${basedir}/target/coverage-reports/aggregate.exec</dataFile>
                            <outputDirectory>${basedir}/target/coverage-reports/site/jacoco-aggregate
                            </outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <dataFile>${basedir}/target/coverage-reports/aggregate.exec</dataFile>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>INSTRUCTION</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.50</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

	<properties>
        <private.package>org.wso2.carbon.auth.user.store.internal</private.package>
        <export.package>
            !org.wso2.carbon.auth.user.store.internal,
            org.wso2.carbon.auth.user.store.*
        </export.package>
        <import.package>
        	org.osgi.framework.*;version="${osgi.framework.package.import.version.range}",
            org.osgi.service.*;version="${equinox.osgi.services.package.import.version.range}",
            org.slf4j.*;version="${slf4j.logging.package.import.version.range}",
            javax.security.auth.*,
            javax.sql.*,
            javax.naming.*,
            javax.xml.*,
            javax.crypto.*,
            org.wso2.charon3.core.*; version="${charon.core.import.version.range}",
            org.wso2.carbon.config.*;version="${carbon.config.package.import.version.range}",
            org.wso2.carbon.datasource.core.*;version="${datasources.core.package.import.version.range}",
            org.wso2.carbon.auth.core.*; version="${carbon.auth.version}",
            org.json.*,
            org.apache.commons.lang3.*,
        </import.package>
	</properties>

</project>
