<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  ~
  ~ Copyright 2011-2016 ForgeRock AS.
  ~
  ~ The contents of this file are subject to the terms
  ~ of the Common Development and Distribution License
  ~ (the License). You may not use this file except in
  ~ compliance with the License.
  ~
  ~ You can obtain a copy of the License at
  ~ http://forgerock.org/license/CDDLv1.0.html
  ~ See the License for the specific language governing
  ~ permission and limitations under the License.
  ~
  ~ When distributing Covered Code, include this CDDL
  ~ Header Notice in each file and include the License file
  ~ at http://forgerock.org/license/CDDLv1.0.html
  ~ If applicable, add the following below the CDDL Header,
  ~ with the fields enclosed by brackets [] replaced by
  ~ your own identifying information:
  ~ "Portions Copyrighted [year] [name of copyright owner]"
  ~
  ~ Portions Copyrighted 2024 3A Systems LLC.
  -->
<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>openidm-project</artifactId>
        <groupId>org.openidentityplatform.openidm</groupId>
        <version>7.1.0</version>
    </parent>
    <artifactId>openidm-provisioner-openicf</artifactId>
    <packaging>bundle</packaging>
    <name>OpenIDM Provisioner System Bundle - OpenICF</name>
    <description>This bundle integrates OpenICF under /system</description>

    <properties>
        <openidm.osgi.import.before.defaults>!org.testng.annotations,!com_cenqua_clover</openidm.osgi.import.before.defaults>
        <openicf.port>8888</openicf.port>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openidentityplatform.openidm</groupId>
            <artifactId>openidm-enhanced-config</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.openidm</groupId>
            <artifactId>openidm-provisioner</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.openidm</groupId>
            <artifactId>openidm-smartevent</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.script</groupId>
            <artifactId>common</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.json-schema</groupId>
            <artifactId>core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.openicf.framework</groupId>
            <artifactId>connector-framework-server</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.openidentityplatform.openicf.framework</groupId>
                    <artifactId>connector-test-common</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.openicf.framework</groupId>
            <artifactId>connector-framework</artifactId>
        </dependency>

        <!-- Provided OSGi Dependencies -->
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.cmpn</artifactId>
            <scope>provided</scope>
        </dependency>


        <!-- Test Dependencies -->
        <dependency>
            <groupId>org.openidentityplatform.openidm</groupId>
            <artifactId>openidm-router</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.openicf.framework</groupId>
            <artifactId>connector-test-common</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <scope>test</scope>
        </dependency>
        <!--<dependency>
            <groupId>org.openidentityplatform.openicf.connectors</groupId>
            <artifactId>groovy-connector</artifactId>
            <scope>test</scope>
        </dependency>-->
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jdbc</artifactId>
            <version>7.0.53</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons</groupId>
            <artifactId>test-utils</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.script</groupId>
            <artifactId>groovy</artifactId>
            <scope>test</scope>
        </dependency>
     </dependencies>
    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.openidentityplatform.commons.i18n-framework</groupId>
                <artifactId>maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate-messages</goal>
                        </goals>
                        <configuration>
                            <messageFiles>
                                <messageFile>org/forgerock/openidm/provisioner/openicf/logger.properties</messageFile>
                            </messageFiles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <bundles.configuration.location>${project.build.testOutputDirectory}/connectorServer/</bundles.configuration.location>
                        <openidm.system.server.root>${project.build.testOutputDirectory}/connectorServer/</openidm.system.server.root>
                        <openicfServerPort>${openicf.port}</openicfServerPort>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <!-- Copy bundle JARs -->
                    <execution>
                        <id>copy-connectorbundles</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.openidentityplatform.openicf.connectors</groupId>
                                    <artifactId>xml-connector</artifactId>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.openidentityplatform.openicf.connectors</groupId>
                                    <artifactId>csvfile-connector</artifactId>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.openidentityplatform.openicf.connectors</groupId>
                                    <artifactId>groovy-connector</artifactId>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>
                                ${project.build.testOutputDirectory}/connectors/
                            </outputDirectory>
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution>
                    <!-- Unpack sample scripts -->
                    <execution>
                        <id>copy-connector-samples</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.openidentityplatform.openicf.connectors</groupId>
                                    <artifactId>groovy-connector</artifactId>
                                    <classifier>samples</classifier>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-connector-samples</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.openidentityplatform.openicf.connectors</groupId>
                                    <artifactId>groovy-connector</artifactId>
                                    <classifier>samples</classifier>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>
                                ${project.build.testOutputDirectory}/samples/groovy-connector
                            </outputDirectory>
                            <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
                        </configuration>
                    </execution>
                    <!--execution>
                        <id>copy-connectorServer</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.openidentityplatform.openicf.framework</groupId>
                                    <artifactId>connector-framework</artifactId>
                                    <version>${openicf.framework.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.openidentityplatform.openicf.framework</groupId>
                                    <artifactId>connector-framework-internal</artifactId>
                                    <version>${openicf.framework.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.codehaus.groovy</groupId>
                                    <artifactId>groovy-all</artifactId>
                                    <version>2.1.6</version>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${project.build.testOutputDirectory}/connectorServer/lib</outputDirectory>
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution-->
                </executions>
            </plugin>
            <!-- Remote Connector Server Test -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>reserve-network-port</id>
                        <goals>
                            <goal>reserve-network-port</goal>
                        </goals>
                        <phase>process-resources</phase>
                        <configuration>
                            <portNames>
                                <portName>openicf.port</portName>
                            </portNames>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
