<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF 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">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.apache.syncope</groupId>
    <artifactId>syncope-fit</artifactId>
    <version>4.1.1</version>
  </parent>

  <name>Apache Syncope FIT Core Reference</name>
  <description>Apache Syncope FIT Core Reference</description>
  <groupId>org.apache.syncope.fit</groupId>
  <artifactId>syncope-fit-core-reference</artifactId>
  <packaging>war</packaging>
  
  <properties>
    <spring.profiles.active>embedded</spring.profiles.active>

    <ianal.phase>none</ianal.phase>

    <jdbcdriver.groupId>org.postgresql</jdbcdriver.groupId>
    <jdbcdriver.artifactId>postgresql</jdbcdriver.artifactId>

    <obscureSecretKey>obscureSecretKeyValue</obscureSecretKey>

    <rootpom.basedir>${basedir}/../..</rootpom.basedir>
  </properties>

  <dependencies>
    <dependency>
      <groupId>jakarta.servlet</groupId>
      <artifactId>jakarta.servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.syncope.core.idm</groupId>
      <artifactId>syncope-core-idm-rest-cxf</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.core.am</groupId>
      <artifactId>syncope-core-am-rest-cxf</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.syncope.core</groupId>
      <artifactId>syncope-core-self-keymaster-starter</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.core</groupId>
      <artifactId>syncope-core-metrics-starter</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.syncope.common.keymaster</groupId>
      <artifactId>syncope-common-keymaster-client-zookeeper</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.syncope.fit</groupId>
      <artifactId>persistence-embedded</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- TEST -->
    <dependency>
      <groupId>org.apache.syncope.fit</groupId>
      <artifactId>syncope-fit-build-tools</artifactId>
      <version>${project.version}</version>
      <type>war</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.common.keymaster.self</groupId>
      <artifactId>syncope-common-keymaster-client-self</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.client.am</groupId>
      <artifactId>syncope-client-am-console</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.client.idm</groupId>
      <artifactId>syncope-client-idm-console</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.client.am</groupId>
      <artifactId>syncope-client-am-enduser</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.flowable</groupId>
      <artifactId>syncope-ext-flowable-rest-cxf</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>          
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.flowable</groupId>
      <artifactId>syncope-ext-flowable-client-console</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.flowable</groupId>
      <artifactId>syncope-ext-flowable-client-enduser</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.saml2sp4ui</groupId>
      <artifactId>syncope-ext-saml2sp4ui-rest-cxf</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>          
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.saml2sp4ui</groupId>
      <artifactId>syncope-ext-saml2sp4ui-client-console</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.saml2sp4ui</groupId>
      <artifactId>syncope-ext-saml2sp4ui-client-enduser</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.scimv2</groupId>
      <artifactId>syncope-ext-scimv2-rest-cxf</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.scimv2</groupId>
      <artifactId>syncope-ext-scimv2-scim-rest-cxf</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.scimv2</groupId>
      <artifactId>syncope-ext-scimv2-client-console</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.oidcc4ui</groupId>
      <artifactId>syncope-ext-oidcc4ui-rest-cxf</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>          
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.oidcc4ui</groupId>
      <artifactId>syncope-ext-oidcc4ui-client-console</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.syncope.ext.oidcc4ui</groupId>
      <artifactId>syncope-ext-oidcc4ui-client-enduser</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.kafka</groupId>
      <artifactId>kafka-clients</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.unboundid</groupId>
      <artifactId>unboundid-ldapsdk</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.wicket</groupId>
      <artifactId>wicket-tester</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-client</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <inherited>true</inherited>
        <executions>
          <execution>
            <id>set-bundles</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <inherited>true</inherited>
        <executions>
          <execution>
            <id>setupCSV</id>
            <phase>pre-integration-test</phase>
            <configuration>
              <target>
                <copy file="${project.build.directory}/test-classes/test.csv" todir="${test.csvdir.path}" overwrite="true" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <systemPropertyVariables>
            <obscureSecretKey>${obscureSecretKey}</obscureSecretKey>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <systemPropertyVariables>
            <obscureSecretKey>${obscureSecretKey}</obscureSecretKey>
          </systemPropertyVariables>
        </configuration>
        <executions>
          <execution>
            <id>verify</id>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven3-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <container>
            <containerId>tomcat11x</containerId>
            <zipUrlInstaller>
              <url>https://repo1.maven.org/maven2/org/apache/tomcat/tomcat/${tomcat.version}/tomcat-${tomcat.version}.zip</url>
              <downloadDir>${settings.localRepository}/org/codehaus/cargo/cargo-container-archives</downloadDir>
              <extractDir>${project.build.directory}/cargo/extract</extractDir>
            </zipUrlInstaller>
            <timeout>1800000</timeout>
            <systemProperties>
              <java.security.egd>file:/dev/./urandom</java.security.egd>
              <java.util.secureRandomSeed>true</java.util.secureRandomSeed>

              <obscureSecretKey>${obscureSecretKey}</obscureSecretKey>
            </systemProperties>
            <dependencies>
              <dependency>
                <groupId>${jdbcdriver.groupId}</groupId>
                <artifactId>${jdbcdriver.artifactId}</artifactId>
              </dependency>
            </dependencies>
          </container>
          <configuration>
            <properties>
              <cargo.jvmargs>
                -Dspring.profiles.active=${spring.profiles.active}
                -XX:+UseG1GC -Xmx1024m -Xms512m</cargo.jvmargs>
            </properties>
          </configuration>
          <deployables>
            <deployable>
              <groupId>org.apache.syncope.fit</groupId>
              <artifactId>syncope-fit-build-tools</artifactId>
              <type>war</type>
              <properties>
                <context>syncope-fit-build-tools</context>
              </properties>
            </deployable>
            <deployable>
              <location>${project.build.directory}/${project.build.finalName}</location>
              <pingURL>http://localhost:${cargo.servlet.port}/syncope/index.html</pingURL>
              <pingTimeout>${cargo.deployable.ping.timeout}</pingTimeout>
              <properties>
                <context>syncope</context>
              </properties>
            </deployable>
          </deployables>
        </configuration>
        <executions>
          <execution>
            <id>start-container</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>start</goal>
            </goals>
            <configuration>
              <skip>${skipTests}</skip>
            </configuration>
          </execution>
          <execution>
            <id>stop-container</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
            <configuration>
              <skip>${skipTests}</skip>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <resourceIncludes>src/main/resources/**/*.properties</resourceIncludes>
        </configuration>
      </plugin>
    </plugins>
    
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>${basedir}/../../core/starter/src/main/resources</directory>
        <includes>
          <include>core.properties</include>
        </includes>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>${basedir}/../../core/persistence-jpa/src/test/resources/domains</directory>
        <targetPath>${project.build.outputDirectory}/domains</targetPath>
        <filtering>true</filtering>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
        <excludes>
          <exclude>saml.keystore.jks</exclude>
          <exclude>test.pdf</exclude>
        </excludes>
      </testResource>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>false</filtering>
        <includes>
          <include>saml.keystore.jks</include>
          <include>test.pdf</include>
        </includes>
      </testResource>
      <testResource>
        <directory>${basedir}/../../core/idm/logic/src/test/resources</directory>
        <includes>
          <include>test1.csv</include>
        </includes>
      </testResource>
      <testResource>
        <directory>${basedir}/../../core/rest-cxf/src/main/resources</directory>
        <includes>
          <include>errorMessages.properties</include>
        </includes>
      </testResource>
      <testResource>
        <directory>${basedir}/../../core/spring/src/test/resources</directory>
        <includes>
          <include>*.groovy</include>
        </includes>
      </testResource>
    </testResources>
  </build>
  
  <profiles>
    <profile>
      <id>zookeeper-it</id>

      <properties>
        <spring.profiles.active>embedded,zookeeper</spring.profiles.active>
      </properties>

      <build>
        <plugins>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <configuration>
              <images>
                <image>
                  <name>zookeeper:${zookeeper.version}</name>
                  <run>
                    <ports>
                      <port>2181:2181</port>
                    </ports>
                    <volumes>
                      <bind>
                        <volume>${project.build.directory}/test-classes/zoo.cfg:/conf/zoo.cfg</volume>
                        <volume>${project.build.directory}/test-classes/java.env:/conf/java.env</volume>
                        <volume>${project.build.directory}/test-classes/server-jaas.conf:/conf/server-jaas.conf</volume>
                        <volume>${project.build.directory}/test-classes/client-jaas.conf:/conf/client-jaas.conf</volume>
                      </bind>
                    </volumes>
                  </run>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start-zookeeper</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-zookeeper</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                  <goal>remove</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
          </plugin>
        </plugins>

        <testResources>
          <testResource>
            <directory>src/test/resources</directory>
            <filtering>true</filtering>
            <excludes>
              <exclude>saml.keystore.jks</exclude>
              <exclude>test.pdf</exclude>
            </excludes>
          </testResource>
          <testResource>
            <directory>src/test/resources</directory>
            <filtering>false</filtering>
            <includes>
              <include>saml.keystore.jks</include>
              <include>test.pdf</include>
            </includes>
          </testResource>
          <testResource>
            <directory>${basedir}/../../common/keymaster/client-zookeeper/src/main/resources</directory>
            <filtering>true</filtering>
          </testResource>
        </testResources>
      </build>
    </profile>

    <profile>
      <id>elasticsearch-it</id>

      <properties>
        <spring.profiles.active>embedded,elasticsearch</spring.profiles.active>
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.apache.syncope.ext.elasticsearch</groupId>
          <artifactId>syncope-ext-elasticsearch-provisioning-java</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.syncope.ext.elasticsearch</groupId>
          <artifactId>syncope-ext-elasticsearch-persistence</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <includes>
                <include>**/org/apache/syncope/fit/core/*ITCase.java</include>
              </includes>
            </configuration>
          </plugin>

          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <configuration>
              <images>
                <image>
                  <alias>elasticsearch</alias>
                  <name>docker.elastic.co/elasticsearch/elasticsearch:${elasticsearch.version}</name>
                  <run>
                    <env>
                      <discovery.type>single-node</discovery.type>
                      <cluster.name>elasticsearch</cluster.name>
                      <cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
                      <xpack.security.enabled>false</xpack.security.enabled>
                      <ingest.geoip.downloader.enabled>false</ingest.geoip.downloader.enabled>
                      <ES_JAVA_OPTS>-Xms750m -Xmx750m</ES_JAVA_OPTS>
                    </env>
                    <ports>
                      <port>9200:9200</port>
                      <port>9300:9300</port>
                    </ports>
                  </run>
                </image>
                <image>
                  <alias>kibana</alias>
                  <name>docker.elastic.co/kibana/kibana:${elasticsearch.version}</name>
                  <run>
                    <env>
                      <ELASTICSEARCH_HOSTS>http://${docker.container.elasticsearch.ip}:9200</ELASTICSEARCH_HOSTS>
                      <xpack.security.enabled>false</xpack.security.enabled>
                    </env>
                    <ports>
                      <port>5601:5601</port>
                    </ports>
                  </run>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start-elasticsearch</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-elasticsearch</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                  <goal>remove</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
          </plugin>
        </plugins>

        <testResources>
          <testResource>
            <directory>src/test/resources</directory>
            <filtering>true</filtering>
            <excludes>
              <exclude>saml.keystore.jks</exclude>
              <exclude>test.pdf</exclude>
            </excludes>
          </testResource>
          <testResource>
            <directory>src/test/resources</directory>
            <filtering>false</filtering>
            <includes>
              <include>saml.keystore.jks</include>
              <include>test.pdf</include>
            </includes>
          </testResource>
          <testResource>
            <directory>${basedir}/../../core/rest-cxf/src/main/resources</directory>
            <includes>
              <include>errorMessages.properties</include>
            </includes>
          </testResource>
        </testResources>
      </build>
    </profile>
  
    <profile>
      <id>opensearch-it</id>

      <properties>
        <spring.profiles.active>embedded,opensearch</spring.profiles.active>
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.apache.syncope.ext.opensearch</groupId>
          <artifactId>syncope-ext-opensearch-provisioning-java</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.syncope.ext.opensearch</groupId>
          <artifactId>syncope-ext-opensearch-persistence</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <includes>
                <include>**/org/apache/syncope/fit/core/*ITCase.java</include>
              </includes>
            </configuration>
          </plugin>

          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <configuration>
              <images>
                <image>
                  <alias>opensearch</alias>
                  <name>opensearchproject/opensearch:${opensearch.version}</name>
                  <run>
                    <env>
                      <discovery.type>single-node</discovery.type>
                      <cluster.name>elasticsearch</cluster.name>
                      <cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
                      <plugins.security.disabled>true</plugins.security.disabled>
                      <OPENSEARCH_JAVA_OPTS>-Xms750m -Xmx750m</OPENSEARCH_JAVA_OPTS>
                      <OPENSEARCH_INITIAL_ADMIN_PASSWORD>z[x@%~CS7Vn}</OPENSEARCH_INITIAL_ADMIN_PASSWORD>
                    </env>
                    <ports>
                      <port>9200:9200</port>
                      <port>9300:9300</port>
                    </ports>
                  </run>
                </image>
                <image>
                  <alias>dashboards</alias>
                  <name>opensearchproject/opensearch-dashboards:${opensearch.version}</name>
                  <run>
                    <env>
                      <OPENSEARCH_HOSTS>http://${docker.container.opensearch.ip}:9200</OPENSEARCH_HOSTS>
                      <DISABLE_SECURITY_DASHBOARDS_PLUGIN>true</DISABLE_SECURITY_DASHBOARDS_PLUGIN>
                    </env>
                    <ports>
                      <port>5601:5601</port>
                    </ports>
                  </run>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start-opensearch</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-opensearch</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                  <goal>remove</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
          </plugin>
        </plugins>

        <testResources>
          <testResource>
            <directory>src/test/resources</directory>
            <filtering>true</filtering>
            <excludes>
              <exclude>saml.keystore.jks</exclude>
              <exclude>test.pdf</exclude>
            </excludes>
          </testResource>
          <testResource>
            <directory>src/test/resources</directory>
            <filtering>false</filtering>
            <includes>
              <include>saml.keystore.jks</include>
              <include>test.pdf</include>
            </includes>
          </testResource>
          <testResource>
            <directory>${basedir}/../../core/rest-cxf/src/main/resources</directory>
            <includes>
              <include>errorMessages.properties</include>
            </includes>
          </testResource>
        </testResources>
      </build>
    </profile>

    <profile>
      <id>mysql-it</id>

      <properties>
        <jdbcdriver.groupId>com.mysql</jdbcdriver.groupId>
        <jdbcdriver.artifactId>mysql-connector-j</jdbcdriver.artifactId>

        <spring.profiles.active>embedded,mysql</spring.profiles.active>
      </properties>

      <dependencies>
        <dependency>
          <groupId>com.mysql</groupId>
          <artifactId>mysql-connector-j</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>

      <build>
        <defaultGoal>clean verify</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <includes>
                <include>**/org/apache/syncope/fit/core/*ITCase.java</include>
              </includes>
            </configuration>
          </plugin>

          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <configuration>
              <images>
                <image>
                  <alias>mysql</alias>
                  <name>mysql:${docker.mysql.version}</name>
                  <run>
                    <cmd>--skip-log-bin --server-id=1 --sort_buffer_size=348M --character-set-server=utf8mb4 --collation-server=utf8mb4_bin</cmd>
                    <env>
                      <MYSQL_ROOT_PASSWORD>password</MYSQL_ROOT_PASSWORD>
                      <MYSQL_DATABASE>syncope</MYSQL_DATABASE>
                      <MYSQL_USER>syncope</MYSQL_USER>
                      <MYSQL_PASSWORD>syncope</MYSQL_PASSWORD>
                    </env>
                    <tmpfs>
                      <mount>/var/lib/mysql:rw</mount>
                    </tmpfs>
                    <volumes>
                      <bind>
                        <volume>${basedir}/src/test/resources/mysql_init.sql:/docker-entrypoint-initdb.d/mysql_init.sql:ro</volume>
                      </bind>
                    </volumes>                   
                    <wait>
                      <log>MySQL init process done. Ready for start up.</log>
                      <time>30000</time>
                    </wait>
                  </run>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start-mysql</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-mysql</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                  <goal>remove</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <container>
                <systemProperties>
                  <DB_CONTAINER_IP>${docker.container.mysql.ip}</DB_CONTAINER_IP>
                </systemProperties>
              </container>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>mariadb-it</id>

      <properties>
        <jdbcdriver.groupId>org.mariadb.jdbc</jdbcdriver.groupId>
        <jdbcdriver.artifactId>mariadb-java-client</jdbcdriver.artifactId>

        <spring.profiles.active>embedded,mariadb</spring.profiles.active>
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.mariadb.jdbc</groupId>
          <artifactId>mariadb-java-client</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>

      <build>
        <defaultGoal>clean verify</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <includes>
                <include>**/org/apache/syncope/fit/core/*ITCase.java</include>
              </includes>
            </configuration>
          </plugin>

          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <configuration>
              <images>
                <image>
                  <alias>mariadb</alias>
                  <name>mariadb:${docker.mariadb.version}</name>
                  <run>
                    <cmd>--character-set-server=utf8mb4 --collation-server=utf8mb4_bin</cmd>
                    <env>
                      <MYSQL_ROOT_PASSWORD>password</MYSQL_ROOT_PASSWORD>
                      <MYSQL_DATABASE>syncope</MYSQL_DATABASE>
                      <MYSQL_USER>syncope</MYSQL_USER>
                      <MYSQL_PASSWORD>syncope</MYSQL_PASSWORD>
                    </env>
                    <tmpfs>
                      <mount>/var/lib/mysql:rw</mount>
                    </tmpfs>
                    <volumes>
                      <bind>
                        <volume>${basedir}/src/test/resources/mysql_init.sql:/docker-entrypoint-initdb.d/mysql_init.sql:ro</volume>
                      </bind>
                    </volumes>                   
                    <wait>
                      <log>MariaDB init process done. Ready for start up.</log>
                      <time>30000</time>
                    </wait>
                  </run>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start-mariadb</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-mariadb</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                  <goal>remove</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <container>
                <systemProperties>
                  <DB_CONTAINER_IP>${docker.container.mariadb.ip}</DB_CONTAINER_IP>
                </systemProperties>
              </container>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>oracle-it</id>

      <properties>
        <jdbcdriver.groupId>com.oracle.database.jdbc</jdbcdriver.groupId>
        <jdbcdriver.artifactId>ojdbc11</jdbcdriver.artifactId>
        <cargo.deployable.ping.timeout>120000</cargo.deployable.ping.timeout>

        <spring.profiles.active>embedded,oracle</spring.profiles.active>
      </properties>

      <dependencies>
        <dependency>
          <groupId>com.oracle.database.jdbc</groupId>
          <artifactId>ojdbc11</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>

      <build>
        <defaultGoal>clean verify</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <includes>
                <include>**/org/apache/syncope/fit/core/*ITCase.java</include>
              </includes>
            </configuration>
          </plugin>

          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <configuration>
              <images>
                <image>
                  <alias>oracle</alias>
                  <name>gvenzl/oracle-free:${docker.oracle.version}</name>
                  <run>
                    <env>
                      <ORACLE_PASSWORD>password</ORACLE_PASSWORD>
                      <APP_USER>syncope</APP_USER>
                      <APP_USER_PASSWORD>syncope</APP_USER_PASSWORD>
                    </env>
                    <volumes>
                      <bind>
                        <volume>${basedir}/src/test/resources/1_oracle_init.sql:/container-entrypoint-initdb.d/1_oracle_init.sql:ro</volume>
                        <volume>${basedir}/src/test/resources/2_oracle_init.sql:/container-entrypoint-initdb.d/2_oracle_init.sql:ro</volume>
                      </bind>
                    </volumes>                    
                    <wait>
                      <log>DATABASE IS READY TO USE</log>
                      <time>120000</time>
                    </wait>
                  </run>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>buid-oracle</id>
                <phase>initialize</phase>
                <goals>
                  <goal>build</goal>
                </goals>
              </execution>
              <execution>
                <id>start-oracle</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-oracle</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                  <goal>remove</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <container>
                <systemProperties>
                  <DB_CONTAINER_IP>${docker.container.oracle.ip}</DB_CONTAINER_IP>
                </systemProperties>
              </container>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>neo4j-it</id>

      <properties>
        <spring.profiles.active>embedded,neo4j</spring.profiles.active>
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.apache.syncope.core</groupId>
          <artifactId>syncope-core-self-keymaster-starter</artifactId>
          <version>${project.version}</version>
          <exclusions>
            <exclusion>
              <groupId>org.apache.syncope.core</groupId>
              <artifactId>syncope-core-persistence-jpa</artifactId>          
            </exclusion>
          </exclusions>
        </dependency>

        <dependency>
          <groupId>org.apache.syncope.core</groupId>
          <artifactId>syncope-core-persistence-neo4j</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>

      <build>
        <defaultGoal>clean verify</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <inherited>true</inherited>
          </plugin>

          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <configuration>
              <images>
                <image>
                  <alias>neo4j</alias>
                  <name>neo4j:${docker.neo4j.version}</name>
                  <run>
                    <env>
                      <NEO4J_AUTH>none</NEO4J_AUTH>
                      <NEO4JLABS_PLUGINS>["apoc"]</NEO4JLABS_PLUGINS>
                    </env>
                    <wait>
                      <log>Started.</log>
                      <time>30000</time>
                    </wait>
                    <tmpfs>
                      <mount>/data:rw</mount>
                      <mount>/logs:rw</mount>
                      <mount>/var/lib/neo4j/data:rw</mount>
                      <mount>/var/lib/neo4j/logs:rw</mount>
                      <mount>/var/lib/neo4j/metrics:rw</mount>
                    </tmpfs>
                  </run>
                </image>
                <image>
                  <alias>neo4jTwo</alias>
                  <name>neo4j:${docker.neo4j.version}</name>
                  <run>
                    <env>
                      <NEO4J_AUTH>none</NEO4J_AUTH>
                      <NEO4JLABS_PLUGINS>["apoc"]</NEO4JLABS_PLUGINS>
                    </env>
                    <wait>
                      <log>Started.</log>
                      <time>30000</time>
                    </wait>
                    <tmpfs>
                      <mount>/data:rw</mount>
                      <mount>/logs:rw</mount>
                      <mount>/var/lib/neo4j/data:rw</mount>
                      <mount>/var/lib/neo4j/logs:rw</mount>
                      <mount>/var/lib/neo4j/metrics:rw</mount>
                    </tmpfs>
                  </run>
                </image>                
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start-neo4j</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-neo4j</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                  <goal>remove</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <container>
                <systemProperties>
                  <NEO4J_CONTAINER_IP>${docker.container.neo4j.ip}</NEO4J_CONTAINER_IP>
                  <NEO4J_TWO_CONTAINER_IP>${docker.container.neo4jTwo.ip}</NEO4J_TWO_CONTAINER_IP>
                </systemProperties>
              </container>
            </configuration>
          </plugin>
        </plugins>

        <resources>
          <resource>
            <directory>${basedir}/../../core/persistence-neo4j/src/test/resources/domains</directory>
            <targetPath>${project.build.outputDirectory}/domains</targetPath>
            <filtering>true</filtering>
          </resource>
        </resources>
      </build>
    </profile>

    <profile>
      <id>payara-it</id>

      <dependencies>
        <dependency>
          <groupId>org.apache.syncope.core</groupId>
          <artifactId>syncope-core-starter</artifactId>
          <version>${project.version}</version>
          <exclusions>
            <exclusion>
              <groupId>org.apache.tomcat.embed</groupId>
              <artifactId>tomcat-embed-el</artifactId>
            </exclusion>
            <exclusion>
              <groupId>com.github.ben-manes.caffeine</groupId>
              <artifactId>jcache</artifactId>
            </exclusion>
          </exclusions>
        </dependency>

        <dependency>
          <groupId>org.glassfish</groupId>
          <artifactId>jakarta.faces</artifactId>
          <version>${jakarta.faces.version}</version>
        </dependency>
        <dependency>
          <groupId>com.fasterxml.jackson.dataformat</groupId>
          <artifactId>jackson-dataformat-xml</artifactId>
        </dependency>
      </dependencies>

      <build>
        <defaultGoal>clean verify</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <inherited>true</inherited>
            <executions>
              <execution>
                <id>adjust-buildtools-for-payara</id>
                <phase>prepare-package</phase>
                <configuration>
                  <target>
                    <unzip src="${settings.localRepository}/org/apache/syncope/fit/syncope-fit-build-tools/${project.version}/syncope-fit-build-tools-${project.version}.war"
                           dest="${project.build.outputDirectory}/syncope-fit-buildtools"/>
                    <copy file="${settings.localRepository}/org/glassfish/jakarta.faces/${jakarta.faces.version}/jakarta.faces-${jakarta.faces.version}.jar"
                          todir="${project.build.outputDirectory}/syncope-fit-buildtools/WEB-INF/lib"/>
                  </target>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <container>
                <containerId>payara</containerId>
                <zipUrlInstaller>
                  <url>https://repo1.maven.org/maven2/fish/payara/distributions/payara/${payara.version}/payara-${payara.version}.zip</url>
                  <downloadDir>${settings.localRepository}/org/codehaus/cargo/cargo-container-archives</downloadDir>
                  <extractDir>${project.build.directory}/cargo/extract</extractDir>
                </zipUrlInstaller>
              </container>
              <configuration>
                <properties>
                  <cargo.glassfish.removeDefaultDatasource>false</cargo.glassfish.removeDefaultDatasource>
                  <cargo.jvmargs>-Djdk.util.zip.disableZip64ExtraFieldValidation=true
                    -Dspring.profiles.active=embedded,payara
                    -XX:+UseG1GC -Xmx2048m -Xms1024m
                    --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED
                    -Dhazelcast.jcache.provider.type=member</cargo.jvmargs>
                </properties>
              </configuration>
              <deployables>
                <deployable>
                  <location>${project.build.outputDirectory}/syncope-fit-buildtools</location>
                  <properties>
                    <context>syncope-fit-build-tools</context>
                  </properties>
                </deployable>
                <deployable>
                  <location>${project.build.directory}/${project.build.finalName}</location>
                  <pingURL>http://localhost:${cargo.servlet.port}/syncope/index.html</pingURL>
                  <pingTimeout>${cargo.deployable.ping.timeout}</pingTimeout>
                  <properties>
                    <context>syncope</context>
                  </properties>
                </deployable>
              </deployables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>wildfly-it</id>

      <dependencies>
        <dependency>
          <groupId>org.apache.syncope.core</groupId>
          <artifactId>syncope-core-starter</artifactId>
          <version>${project.version}</version>
          <exclusions>
            <exclusion>
              <groupId>org.apache.tomcat.embed</groupId>
              <artifactId>tomcat-embed-el</artifactId>
            </exclusion>
            <exclusion>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
          </exclusions>
        </dependency>

        <dependency>
          <groupId>jakarta.xml.ws</groupId>
          <artifactId>jakarta.xml.ws-api</artifactId>
        </dependency>
        <dependency>
          <groupId>org.apache.cxf</groupId>
          <artifactId>cxf-core</artifactId>
          <version>${cxf.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.cxf</groupId>
          <artifactId>cxf-rt-transports-http</artifactId>
          <version>${cxf.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.cxf</groupId>
          <artifactId>cxf-rt-ws-policy</artifactId>
          <version>${cxf.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.cxf</groupId>
          <artifactId>cxf-rt-wsdl</artifactId>
          <version>${cxf.version}</version>
        </dependency>

        <dependency>
          <groupId>org.postgresql</groupId>
          <artifactId>postgresql</artifactId>
        </dependency>

        <dependency>
          <groupId>org.apache.syncope.client.am</groupId>
          <artifactId>syncope-client-am-enduser</artifactId>
          <version>${project.version}</version>
          <exclusions>
            <exclusion>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
          </exclusions>
          <scope>test</scope>
        </dependency>        
      </dependencies>

      <build>
        <defaultGoal>clean verify</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <container>
                <containerId>wildfly39x</containerId>
                <zipUrlInstaller>
                  <url>https://github.com/wildfly/wildfly/releases/download/${wildfly.version}/wildfly-${wildfly.version}.zip</url>
                  <downloadDir>${settings.localRepository}/org/codehaus/cargo/cargo-container-archives</downloadDir>
                  <extractDir>${project.build.directory}/cargo/extract</extractDir>
                </zipUrlInstaller>
              </container>
              <configuration>
                <properties>
                  <cargo.jvmargs>-Djava.net.preferIPv4Stack=true -Dspring.profiles.active=embedded,wildfly
                    -XX:+UseG1GC -Xmx2048m -Xms1024m
                    --add-opens java.base/java.util=ALL-UNNAMED
                    --add-opens=java.base/java.lang=ALL-UNNAMED
                    --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED</cargo.jvmargs>
                </properties>
              </configuration>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>debezium-it</id>

      <dependencies>
        <dependency>
          <groupId>com.mysql</groupId>
          <artifactId>mysql-connector-j</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>

      <build>
        <defaultGoal>clean verify</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <includes>
                <include>**/org/apache/syncope/fit/core/DebeziumITCase.java</include>
              </includes>
              <systemPropertyVariables>
                <KAFKA_BOOTSTRAP_SERVERS>${docker.container.kafka.ip}:9092</KAFKA_BOOTSTRAP_SERVERS>
                <MYSQL_IP>${docker.container.mysql.ip}</MYSQL_IP>
                <CONNECT_IP>${docker.container.connect.ip}</CONNECT_IP>
              </systemPropertyVariables>
            </configuration>
          </plugin>

          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <configuration>
              <images>
                <image>
                  <alias>zookeeper</alias>
                  <name>zookeeper:${zookeeper.version}</name>
                  <run>
                    <volumes>
                      <bind>
                        <volume>/etc/localtime:/etc/localtime:ro</volume>
                      </bind>
                    </volumes>
                    <tmpfs>
                      <mount>/datalog:rw</mount>
                      <mount>/data:rw</mount>
                      <mount>/logs:rw</mount>
                    </tmpfs>
                  </run>
                </image>                
                <image>
                  <alias>kafka</alias>
                  <name>quay.io/debezium/kafka:${debezium.version}</name>
                  <run>
                    <dependsOn>
                      <container>zookeeper</container>
                    </dependsOn>
                    <links>
                      <link>zookeeper</link>
                    </links>
                    <env>
                      <ZOOKEEPER_CONNECT>zookeeper:2181</ZOOKEEPER_CONNECT>
                    </env>
                    <volumes>
                      <bind>
                        <volume>/etc/localtime:/etc/localtime:ro</volume>
                      </bind>
                    </volumes>
                    <tmpfs>
                      <mount>/kafka/config:rw</mount>
                      <mount>/kafka/data:rw</mount>
                      <mount>/kafka/logs:rw</mount>
                    </tmpfs>
                  </run>
                </image>              
                <image>
                  <alias>mysql</alias>
                  <name>quay.io/debezium/example-mysql:${debezium.version}</name>
                  <run>
                    <ports> 
                      <port>3306:3306</port>
                    </ports>
                    <env>
                      <MYSQL_ROOT_PASSWORD>debezium</MYSQL_ROOT_PASSWORD>
                      <MYSQL_USER>mysqluser</MYSQL_USER>
                      <MYSQL_PASSWORD>mysqlpw</MYSQL_PASSWORD>
                    </env>
                    <volumes>
                      <bind>
                        <volume>/etc/localtime:/etc/localtime:ro</volume>
                        <volume>${basedir}/src/test/resources/debezium_mysql_init.sql:/docker-entrypoint-initdb.d/mysql_init.sql:ro</volume>
                      </bind>
                    </volumes>
                    <tmpfs>
                      <mount>/var/lib/mysql:rw</mount>
                    </tmpfs>
                    <wait>
                      <log>MySQL init process done. Ready for start up.</log>
                      <time>30000</time>
                    </wait>
                  </run>
                </image>
                <image>
                  <alias>connect</alias>
                  <name>quay.io/debezium/connect:${debezium.version}</name>
                  <run>
                    <dependsOn>
                      <container>kafka</container>
                      <container>mysql</container>
                    </dependsOn>
                    <links>
                      <link>kafka</link>
                      <link>mysql</link>
                    </links>
                    <env>
                      <BOOTSTRAP_SERVERS>kafka:9092</BOOTSTRAP_SERVERS>
                      <GROUP_ID>1</GROUP_ID>
                      <CONFIG_STORAGE_TOPIC>my_connect_configs</CONFIG_STORAGE_TOPIC>
                      <OFFSET_STORAGE_TOPIC>my_connect_offsets</OFFSET_STORAGE_TOPIC>
                      <STATUS_STORAGE_TOPIC>my_connect_statuses</STATUS_STORAGE_TOPIC>
                    </env>
                    <volumes>
                      <bind>
                        <volume>/etc/localtime:/etc/localtime:ro</volume>
                      </bind>
                    </volumes>
                    <tmpfs>
                      <mount>/kafka/config:rw</mount>
                      <mount>/kafka/data:rw</mount>
                      <mount>/kafka/logs:rw</mount>
                    </tmpfs>
                  </run>
                </image>                
                <image>
                  <alias>kafka-ui</alias>
                  <name>provectuslabs/kafka-ui</name>
                  <run>
                    <dependsOn>
                      <container>kafka</container>
                    </dependsOn>
                    <links>
                      <link>kafka</link>
                    </links>
                    <env>
                      <KAFKA_CLUSTERS_0_NAME>local</KAFKA_CLUSTERS_0_NAME>
                      <KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS>kafka:9092</KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS>
                    </env>
                    <volumes>
                      <bind>
                        <volume>/etc/localtime:/etc/localtime:ro</volume>
                      </bind>
                    </volumes>
                  </run>
                </image>
                <image>
                  <alias>debezium-ui</alias>
                  <name>quay.io/debezium/debezium-ui</name>
                  <run>
                    <dependsOn>
                      <container>kafka</container>
                      <container>connect</container>
                    </dependsOn>
                    <links>
                      <link>kafka</link>
                      <link>connect</link>
                    </links>
                    <env>
                      <KAFKA_CONNECT_URIS>http://connect:8083</KAFKA_CONNECT_URIS>
                    </env>
                    <volumes>
                      <bind>
                        <volume>/etc/localtime:/etc/localtime:ro</volume>
                      </bind>
                    </volumes>
                  </run>
                </image>                
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start-debezium</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-debezium</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                  <goal>remove</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>syncrepl-it</id>

      <build>
        <defaultGoal>clean verify</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <includes>
                <include>**/org/apache/syncope/fit/core/SyncReplITCase.java</include>
              </includes>
              <systemPropertyVariables>
                <OPENLDAP_IP>${docker.container.openldap.ip}</OPENLDAP_IP>
              </systemPropertyVariables>
            </configuration>
          </plugin>

          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <configuration>
              <images>
                <image>
                  <alias>openldap</alias>
                  <name>bitnamilegacy/openldap:2.6</name>
                  <run>
                    <env>
                      <LDAP_PORT_NUMBER>1389</LDAP_PORT_NUMBER>
                      <LDAP_ROOT>o=isp</LDAP_ROOT>
                      <LDAP_USER_OU>People</LDAP_USER_OU>
                      <LDAP_GROUP_OU>Groups</LDAP_GROUP_OU>
                      <LDAP_ENABLE_SYNCPROV>yes</LDAP_ENABLE_SYNCPROV>
                    </env>
                    <volumes>
                      <bind>
                        <volume>/etc/localtime:/etc/localtime:ro</volume>
                      </bind>
                    </volumes>
                  </run>
                </image>                
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start-openldap</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-openldap</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                  <goal>remove</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>skipTests</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <skipTests>${skipTests}</skipTests>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>debug</id>

      <properties>
        <skipTests>true</skipTests>
      </properties>

      <build>
        <defaultGoal>clean verify cargo:run</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <configuration>
                <properties>
                  <cargo.jvmargs>
                    -Dspring.profiles.active=${spring.profiles.active}
                    -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
                    -XX:+UseG1GC -Xmx1024m -Xms512m</cargo.jvmargs>
                </properties>
              </configuration>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>hotswap</id>
      
      <properties>
        <skipTests>true</skipTests>
      </properties>
      
      <build>
        <defaultGoal>clean verify cargo:run</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <configuration>
                <properties>
                  <cargo.jvmargs>
                    -Dspring.profiles.active=${spring.profiles.active}
                    -javaagent:${java.home}/lib/hotswap/hotswap-agent.jar=autoHotswap=true,disablePlugin=Spring,disablePlugin=Hibernate
                    -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
                    -XX:+UseConcMarkSweepGC -Xmx1024m -Xms512m</cargo.jvmargs>
                </properties>
              </configuration>
            </configuration>
          </plugin>
        </plugins>

        <resources>
          <resource>
            <directory>src/test/resources</directory>
            <filtering>true</filtering>
            <includes>
              <include>hotswap-agent.properties</include>
            </includes>
          </resource>
        </resources>
      </build>
    </profile>

    <profile>
      <id>all</id>

      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      
      <properties>
        <spring.profiles.active>embedded,all</spring.profiles.active> 
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.apache.syncope.ext.flowable</groupId>
          <artifactId>syncope-ext-flowable-rest-cxf</artifactId>
          <version>${project.version}</version>
        </dependency>

        <dependency>
          <groupId>org.apache.syncope.ext.saml2sp4ui</groupId>
          <artifactId>syncope-ext-saml2sp4ui-rest-cxf</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.syncope.ext.saml2sp4ui</groupId>
          <artifactId>syncope-ext-saml2sp4ui-persistence-jpa</artifactId>
          <version>${project.version}</version>
        </dependency>
        
        <dependency>
          <groupId>org.apache.syncope.ext.oidcc4ui</groupId>
          <artifactId>syncope-ext-oidcc4ui-rest-cxf</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.syncope.ext.oidcc4ui</groupId>
          <artifactId>syncope-ext-oidcc4ui-persistence-jpa</artifactId>
          <version>${project.version}</version>
        </dependency>
        
        <dependency>
          <groupId>org.apache.syncope.ext.scimv2</groupId>
          <artifactId>syncope-ext-scimv2-rest-cxf</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.syncope.ext.scimv2</groupId>
          <artifactId>syncope-ext-scimv2-scim-rest-cxf</artifactId>
          <version>${project.version}</version>
        </dependency>

        <dependency>
          <groupId>org.apache.syncope.ext.openfga</groupId>
          <artifactId>syncope-ext-openfga-provisioning-java</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <!-- Adds Flowable custom classes -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>add-flowable-custom-classes</id>
                <phase>initialize</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>${basedir}/src/main/java-all</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>     
        </plugins>
      </build>
    </profile>
    
    <profile>
      <id>apache-release</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <inherited>false</inherited>
            <configuration>
              <skipSource>true</skipSource>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>
</project>
