<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>io.apicurio</groupId>
        <artifactId>apicurio-registry</artifactId>
        <version>2.6.11.redhat-00001</version>
    </parent>
    <artifactId>apicurio-registry-integration-tests</artifactId>
    <name>apicurio-registry-integration-tests</name>

    <properties>
        <skipTests>true</skipTests>
        <quarkus.version>3.15.3.redhat-00002</quarkus.version>
        <quarkus.http.test-host>localhost</quarkus.http.test-host>
        <quarkus.http.test-port>0</quarkus.http.test-port>
        <groups />
    </properties>
    <dependencies>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-junit5</artifactId>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>kubernetes-client</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>kubernetes-httpclient-okhttp</artifactId>
                    <groupId>io.fabric8</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>kubernetes-httpclient-vertx</artifactId>
        </dependency>
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-uri-template</artifactId>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>openshift-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
        </dependency>
        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-registry-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-tenant-manager-client</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-registry-utils-kafka</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-registry-utils-tests</artifactId>
        </dependency>
        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-registry-maven-plugin</artifactId>
            <type>maven-plugin</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-registry-serdes-avro-serde</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-registry-serdes-protobuf-serde</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-registry-serdes-jsonschema-serde</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-registry-utils-converter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>kafka-avro-serializer</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>kafka-connect-avro-converter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.strimzi</groupId>
            <artifactId>strimzi-test-container</artifactId>
        </dependency>
        <dependency>
            <groupId>io.zonky.test</groupId>
            <artifactId>embedded-postgres</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- UI tests  -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>selenium</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-registry-utils-import-export</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-core</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                        <maven.home>${maven.home}</maven.home>
                        <groups>${groups}</groups>
                        <project.version>${project.version}</project.version>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.redhat.quarkus.platform</groupId>
                <artifactId>quarkus-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
                <version>3.15.3.redhat-00002</version>
            </plugin>
        </plugins>
    </build>

    <!-- Profiles for local testing -->
    <profiles>
        <profile>
            <id>local-mem</id>
            <properties>
                <skipTests>false</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-static-resources</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>apicurio-registry-app</artifactId>
                                            <version>${project.version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <includes>**/web.xml,**/application.properties</includes>
                                        </artifactItem>
                                    </artifactItems>
                                    <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                    <overWriteReleases>false</overWriteReleases>
                                    <overWriteSnapshots>true</overWriteSnapshots>
                                </configuration>
                            </execution>
                            <execution>
                                <id>unpack-test-dependencies</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack-dependencies</goal>
                                </goals>
                                <configuration>
                                    <includeGroupIds>io.apicurio</includeGroupIds>
                                    <includeTypes>test-jar</includeTypes>
                                    <includeScope>test</includeScope>
                                    <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
                                    <includes>**/*IT.class, **/*.properties</includes>
                                    <overWriteReleases>false</overWriteReleases>
                                    <overWriteSnapshots>true</overWriteSnapshots>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>properties-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>set-system-properties</goal>
                                </goals>
                                <configuration>
                                    <properties>
                                        <property>
                                            <name>quarkus.http.test-host</name>
                                            <value>${quarkus.http.test-host}</value>
                                        </property>
                                        <property>
                                            <name>quarkus.http.test-port</name>
                                            <value>${quarkus.http.test-port}</value>
                                        </property>
                                    </properties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>io.apicurio</groupId>
                    <artifactId>apicurio-registry-app</artifactId>
                </dependency>
                <dependency>
                    <groupId>io.apicurio</groupId>
                    <artifactId>apicurio-registry-app</artifactId>
                    <type>test-jar</type>
                    <exclusions>
                        <exclusion>
                            <groupId>io.apicurio</groupId>
                            <artifactId>apicurio-registry-schema-util-provider</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>local-sql</id>
            <properties>
                <skipTests>false</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-static-resources</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>apicurio-registry-storage-sql</artifactId>
                                            <version>${project.version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <includes>**/web.xml,**/application.properties</includes>
                                        </artifactItem>
                                    </artifactItems>
                                    <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                    <overWriteReleases>false</overWriteReleases>
                                    <overWriteSnapshots>true</overWriteSnapshots>
                                </configuration>
                            </execution>
                            <execution>
                                <id>unpack-test-dependencies</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack-dependencies</goal>
                                </goals>
                                <configuration>
                                    <includeGroupIds>io.apicurio</includeGroupIds>
                                    <includeTypes>test-jar</includeTypes>
                                    <includeScope>test</includeScope>
                                    <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
                                    <includes>**/*SqlStorageTestResources.class, **/*.properties</includes>
                                    <overWriteReleases>false</overWriteReleases>
                                    <overWriteSnapshots>true</overWriteSnapshots>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>properties-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>set-system-properties</goal>
                                </goals>
                                <configuration>
                                    <properties>
                                        <property>
                                            <name>quarkus.http.test-host</name>
                                            <value>${quarkus.http.test-host}</value>
                                        </property>
                                        <property>
                                            <name>quarkus.http.test-port</name>
                                            <value>${quarkus.http.test-port}</value>
                                        </property>
                                    </properties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>io.apicurio</groupId>
                    <artifactId>apicurio-registry-storage-sql</artifactId>
                </dependency>
                <dependency>
                    <groupId>io.apicurio</groupId>
                    <artifactId>apicurio-registry-storage-sql</artifactId>
                    <type>test-jar</type>
                    <exclusions>
                        <exclusion>
                            <groupId>io.apicurio</groupId>
                            <artifactId>apicurio-registry-schema-util-provider</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>local-kafka</id>
            <properties>
                <skipTests>false</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-static-resources</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>apicurio-registry-storage-kafkasql</artifactId>
                                            <version>${project.version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <includes>**/web.xml,**/application.properties</includes>
                                        </artifactItem>
                                    </artifactItems>
                                    <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                    <overWriteReleases>false</overWriteReleases>
                                    <overWriteSnapshots>true</overWriteSnapshots>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>properties-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>set-system-properties</goal>
                                </goals>
                                <configuration>
                                    <properties>
                                        <property>
                                            <name>quarkus.http.test-host</name>
                                            <value>${quarkus.http.test-host}</value>
                                        </property>
                                        <property>
                                            <name>quarkus.http.test-port</name>
                                            <value>${quarkus.http.test-port}</value>
                                        </property>
                                    </properties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>io.apicurio</groupId>
                    <artifactId>apicurio-registry-storage-kafkasql</artifactId>
                </dependency>
                <dependency>
                    <groupId>io.apicurio</groupId>
                    <artifactId>apicurio-registry-storage-kafkasql</artifactId>
                    <type>test-jar</type>
                    <exclusions>
                        <exclusion>
                            <groupId>io.apicurio</groupId>
                            <artifactId>apicurio-registry-schema-util-provider</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
            </dependencies>
        </profile>

        <!-- Here we define the remote deployment options -->
        <profile>
            <id>remote-mem</id>
            <properties>
                <skipTests>false</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <configuration>
                                    <systemPropertyVariables>
                                        <registry-in-memory-image>
                                            quay.io/apicurio/apicurio-registry-mem:latest-snapshot
                                        </registry-in-memory-image>
                                        <deployInMemory>true</deployInMemory>
                                        <cluster.tests>true</cluster.tests>
                                        <quarkus.http.test-host>localhost</quarkus.http.test-host>
                                        <quarkus.http.test-port>8080</quarkus.http.test-port>
                                    </systemPropertyVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>remote-kafka</id>
            <properties>
                <skipTests>false</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <configuration>
                                    <systemPropertyVariables>
                                        <registry-kafkasql-image>
                                            quay.io/apicurio/apicurio-registry-kafkasql:latest-snapshot
                                        </registry-kafkasql-image>
                                        <cluster.tests>true</cluster.tests>
                                        <deployKafka>true</deployKafka>
                                        <quarkus.http.test-host>localhost</quarkus.http.test-host>
                                        <quarkus.http.test-port>8080</quarkus.http.test-port>
                                    </systemPropertyVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>remote-sql</id>
            <properties>
                <skipTests>false</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <configuration>
                                    <systemPropertyVariables>
                                        <registry-sql-image>quay.io/apicurio/apicurio-registry-sql:latest-snapshot
                                        </registry-sql-image>
                                        <cluster.tests>true</cluster.tests>
                                        <deploySql>true</deploySql>
                                        <quarkus.http.test-host>localhost</quarkus.http.test-host>
                                        <quarkus.http.test-port>8080</quarkus.http.test-port>
                                    </systemPropertyVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>


        <!-- Finally, these are the different test groups, this will determine the tests executed using the defined storage -->
        <profile>
            <id>all</id>
            <properties>
                <skipTests>false</skipTests>
                <groups>( smoke | serdes | acceptance | ui)</groups>
            </properties>
        </profile>

        <profile>
            <id>ci</id>
            <properties>
                <skipTests>false</skipTests>
                <groups>( smoke | serdes | acceptance )</groups>
            </properties>
        </profile>

        <profile>
            <id>smoke</id>
            <properties>
                <groups>smoke</groups>
                <skipTests>false</skipTests>
            </properties>
        </profile>

        <profile>
            <id>regression</id>
            <properties>
                <groups>regression</groups>
                <skipTests>false</skipTests>
            </properties>
        </profile>

        <profile>
            <id>serdes</id>
            <properties>
                <groups>serdes</groups>
                <skipTests>false</skipTests>
            </properties>
        </profile>

        <profile>
            <id>ui</id>
            <properties>
                <groups>ui</groups>
                <skipTests>false</skipTests>
            </properties>
        </profile>

        <profile>
            <id>acceptance</id>
            <properties>
                <skipTests>false</skipTests>
                <groups>acceptance &amp; !multitenancy</groups>
            </properties>
        </profile>

        <profile>
            <id>auth</id>
            <properties>
                <groups>auth</groups>
                <skipTests>false</skipTests>
            </properties>
        </profile>

        <profile>
            <id>multitenancy</id>
            <properties>
                <groups>multitenancy</groups>
                <skipTests>false</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <configuration>
                                    <systemPropertyVariables>
                                        <multitenancy.tests>true</multitenancy.tests>
                                    </systemPropertyVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>migration</id>
            <properties>
                <skipTests>false</skipTests>
                <groups>migration</groups>
            </properties>
        </profile>

        <profile>
            <id>sqlit</id>
            <properties>
                <skipTests>false</skipTests>
                <groups>sqlit</groups>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <configuration>
                                    <systemPropertyVariables>
                                        <multitenancy.tests>true</multitenancy.tests>
                                    </systemPropertyVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>kafkasqlit</id>
            <properties>
                <skipTests>false</skipTests>
                <groups>kafkasqlit</groups>
            </properties>
        </profile>

        <profile>
            <id>kafkasql-manual</id>
            <properties>
                <skipTests>false</skipTests>
                <groups>kafkasql-manual</groups>
            </properties>
        </profile>

        <profile>
            <id>openshift</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <configuration>
                                    <systemPropertyVariables>
                                        <openshift.resources>true</openshift.resources>
                                    </systemPropertyVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>
</project>
