<?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>3.0.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>com.h2database</jdbcdriver.groupId>
    <jdbcdriver.artifactId>h2</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</groupId>
      <artifactId>syncope-core-starter</artifactId>
      <version>${project.version}</version>
    </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.common.keymaster</groupId>
      <artifactId>syncope-common-keymaster-client-zookeeper</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
    </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.idrepo</groupId>
      <artifactId>syncope-client-idrepo-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.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.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.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>
            <jaxrsContentType>${jaxrs.content.type}</jaxrsContentType>
            <obscureSecretKey>${obscureSecretKey}</obscureSecretKey>
            <wicket.ioc.useByteBuddy>true</wicket.ioc.useByteBuddy>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <systemPropertyVariables>
            <jaxrsContentType>${jaxrs.content.type}</jaxrsContentType>
            <obscureSecretKey>${obscureSecretKey}</obscureSecretKey>
            <wicket.ioc.useByteBuddy>true</wicket.ioc.useByteBuddy>
          </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>tomcat9x</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>300000</timeout>
            <log>${cargo.log}</log>
            <output>${cargo.output}</output>
            <systemProperties>
              <java.security.egd>file:/dev/./urandom</java.security.egd>
              <java.util.secureRandomSeed>true</java.util.secureRandomSeed>

              <h2.returnOffsetDateTime>true</h2.returnOffsetDateTime>

              <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>
    </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-logic</artifactId>
          <version>${project.version}</version>
        </dependency>
        <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-jpa</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>
                  <name>docker.elastic.co/elasticsearch/elasticsearch:${elasticsearch.version}</name>
                  <run>
                    <env>
                      <discovery.type>single-node</discovery.type>
                      <cluster.name>elasticsearch</cluster.name>
                      <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>
              </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>pgjsonb-it</id>

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

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

      <dependencies>
        <dependency>
          <groupId>org.apache.syncope.core</groupId>
          <artifactId>syncope-core-persistence-jpa-json</artifactId>
          <version>${project.version}</version>
        </dependency>
        
        <dependency>
          <groupId>org.postgresql</groupId>
          <artifactId>postgresql</artifactId>
          <version>${jdbc.postgresql.version}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>

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

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
              <packagingExcludes>WEB-INF/classes/domains/Two*</packagingExcludes>
            </configuration>
          </plugin>

          <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>postgres</alias>
                  <name>postgres:${docker.postgresql.version}</name>
                  <run>
                    <env>
                      <POSTGRES_DB>syncope</POSTGRES_DB>
                      <POSTGRES_USER>syncope</POSTGRES_USER>
                      <POSTGRES_PASSWORD>syncope</POSTGRES_PASSWORD>
                    </env>
                    <wait>
                      <log>database system is ready to accept connections</log>
                      <time>30000</time>
                    </wait>
                    <tmpfs>
                      <mount>/var/lib/postgresql/data:rw</mount>
                    </tmpfs>
                  </run>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start-postgres</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-postgres</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.postgres.ip}</DB_CONTAINER_IP>
                </systemProperties>
              </container>
            </configuration>
          </plugin>
        </plugins>

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

    <profile>
      <id>postgres-it</id>

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

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

      <dependencies>
        <dependency>
          <groupId>org.postgresql</groupId>
          <artifactId>postgresql</artifactId>
          <version>${jdbc.postgresql.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bcpkix-jdk15on</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bcprov-jdk15on</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>postgres</alias>
                  <name>postgres:${docker.postgresql.version}</name>
                  <run>
                    <env>
                      <POSTGRES_DB>syncope</POSTGRES_DB>
                      <POSTGRES_USER>syncope</POSTGRES_USER>
                      <POSTGRES_PASSWORD>syncope</POSTGRES_PASSWORD>
                    </env>
                    <wait>
                      <log>database system is ready to accept connections</log>
                      <time>30000</time>
                    </wait>
                    <tmpfs>
                      <mount>/var/lib/postgresql/data:rw</mount>
                    </tmpfs>
                  </run>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start-postgres</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-postgres</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.postgres.ip}</DB_CONTAINER_IP>
                </systemProperties>
              </container>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>myjson-it</id>

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

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

      <dependencies>
        <dependency>
          <groupId>org.apache.syncope.core</groupId>
          <artifactId>syncope-core-persistence-jpa-json</artifactId>
          <version>${project.version}</version>
        </dependency>
    
        <dependency>
          <groupId>com.mysql</groupId>
          <artifactId>mysql-connector-j</artifactId>
          <version>${jdbc.mysql.version}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>

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

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
              <packagingExcludes>WEB-INF/classes/domains/Two*</packagingExcludes>
            </configuration>
          </plugin>

          <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/mysql-server:${docker.mysql.version}</name>
                  <run>
                    <cmd>--skip-log-bin --server-id=1 --sort_buffer_size=348M</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>
                    <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>

        <resources>
          <resource>
            <directory>${basedir}/../../core/persistence-jpa-json/src/test/resources/domains</directory>
            <targetPath>${project.build.outputDirectory}/domains</targetPath>
            <filtering>true</filtering>
          </resource>
        </resources>
      </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>
          <version>${jdbc.mysql.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bcpkix-jdk15on</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bcprov-jdk15on</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/mysql-server:${docker.mysql.version}</name>
                  <run>
                    <cmd>--skip-log-bin --server-id=1 --sort_buffer_size=348M</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>
                    <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>
          <version>${jdbc.mariadb.version}</version>
          <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>
                    <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>
                    <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>ojson-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,ojson</spring.profiles.active>
      </properties>

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

        <dependency>
          <groupId>com.oracle.database.jdbc</groupId>
          <artifactId>ojdbc11</artifactId>
          <version>${jdbc.oracle.version}</version>
          <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-xe:21-slim</name>
                  <run>
                    <env>
                      <ORACLE_PASSWORD>password</ORACLE_PASSWORD>
                      <APP_USER>syncope</APP_USER>
                      <APP_USER_PASSWORD>syncope</APP_USER_PASSWORD>
                    </env>
                    <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>

        <resources>
          <resource>
            <directory>${basedir}/../../core/persistence-jpa-json/src/test/resources/domains</directory>
            <targetPath>${project.build.outputDirectory}/domains</targetPath>
            <filtering>true</filtering>
          </resource>
        </resources>
      </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>
          <version>${jdbc.oracle.version}</version>
          <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-xe:21-slim</name>
                  <run>
                    <env>
                      <ORACLE_PASSWORD>password</ORACLE_PASSWORD>
                      <APP_USER>syncope</APP_USER>
                      <APP_USER_PASSWORD>syncope</APP_USER_PASSWORD>
                    </env>
                    <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>sqlserver-it</id>
      
      <properties>
        <jdbcdriver.groupId>com.microsoft.sqlserver</jdbcdriver.groupId>
        <jdbcdriver.artifactId>mssql-jdbc</jdbcdriver.artifactId>

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

      <dependencies>
        <dependency>
          <groupId>com.microsoft.sqlserver</groupId>
          <artifactId>mssql-jdbc</artifactId>
          <version>${jdbc.mssql.version}11</version>
          <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>sqlserver</alias>
                  <name>mcmoe/mssqldocker:latest</name>
                  <run>
                    <env>
                      <ACCEPT_EULA>Y</ACCEPT_EULA>
                      <SA_PASSWORD>2astazeY</SA_PASSWORD>
                      <MSSQL_DB>syncope</MSSQL_DB>
                      <MSSQL_USER>syncope</MSSQL_USER>
                      <MSSQL_PASSWORD>Syncope123</MSSQL_PASSWORD>
                    </env>
                    <wait>
                      <log>MSSQL CONFIG COMPLETE</log>
                      <time>30000</time>
                    </wait>
                  </run>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start-sqlserver</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-sqlserver</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.sqlserver.ip}</DB_CONTAINER_IP>
                </systemProperties>
              </container>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    
    <profile>
      <id>payara-it</id>

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

        <dependency>
          <groupId>org.glassfish</groupId>
          <artifactId>jakarta.faces</artifactId>
          <version>${javax.faces.version}</version>
        </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"/>
                    <delete file="${project.build.outputDirectory}/syncope-fit-buildtools/WEB-INF/lib/bval-jsr-${bval.version}.jar"/>
                    <copy file="${settings.localRepository}/org/glassfish/jakarta.faces/${javax.faces.version}/jakarta.faces-${javax.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>
                <log>${cargo.log}</log>
                <output>${cargo.output}</output>
              </container>
              <configuration>
                <properties>
                  <cargo.glassfish.removeDefaultDatasource>false</cargo.glassfish.removeDefaultDatasource>
                  <cargo.jvmargs>-Dspring.profiles.active=embedded,payara
                    -XX:+UseG1GC -Xmx2048m -Xms1024m</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>

      <properties>
        <!-- PostgreSQL JDBC Driver is not actually needed but we need this to avoid Wildfly messing up
        by turning Cargo's H2 dependency into a module -->
        <jdbcdriver.groupId>org.postgresql</jdbcdriver.groupId>
        <jdbcdriver.artifactId>postgresql</jdbcdriver.artifactId>        
      </properties>

      <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>
          </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>
          <version>${jdbc.postgresql.version}</version>
          <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>wildfly26x</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>
                <log>${cargo.log}</log>
                <output>${cargo.output}</output>
              </container>
              <configuration>
                <properties>
                  <cargo.jvmargs>-Djava.net.preferIPv4Stack=true -Dspring.profiles.active=embedded,wildfly
                    -XX:+UseG1GC -Xmx2048m -Xms1024m</cargo.jvmargs>
                </properties>
              </configuration>
            </configuration>
          </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>

    <!-- requires JAVA_HOME set to the latest JDK from https://github.com/TravaOpenJDK/trava-jdk-11-dcevm -->
    <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>
      </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>
