<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.debezium.quarkus</groupId>
        <artifactId>debezium-quarkus-sqlserver-parent</artifactId>
        <version>3.6.0.Beta2</version>
    </parent>

    <artifactId>debezium-quarkus-sqlserver-integration-tests</artifactId>

    <name>Debezium Quarkus :: Extension :: Sql Server :: Integration Tests</name>
    <properties>
        <docker.image>mcr.microsoft.com/mssql/server:2022-latest</docker.image>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.debezium.quarkus</groupId>
            <artifactId>debezium-quarkus-sqlserver</artifactId>
            <exclusions>
                <!-- Disable dev services for testing purpose -->
                <exclusion>
                    <groupId>io.quarkus</groupId>
                    <artifactId>quarkus-devservices-mssql</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.debezium.quarkus</groupId>
            <artifactId>debezium-quarkus-testsuite-integration-tests</artifactId>
        </dependency>

        <dependency>
            <groupId>io.debezium.quarkus</groupId>
            <artifactId>debezium-quarkus-testsuite-integration-tests</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-suite</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-junit5</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.lz4</groupId>
            <artifactId>lz4-java</artifactId>
            <version>1.8.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                        <maven.home>${maven.home}</maven.home>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <systemPropertyVariables>
                                <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                                <maven.home>${maven.home}</maven.home>
                            </systemPropertyVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-maven-plugin</artifactId>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <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></goals>
                    </execution>
                </executions>
                <configuration>
                    <images>
                        <image>
                            <!-- A Docker image using the SQL Server -->
                            <name>${docker.image}</name>
                            <alias>sqlserver1</alias>
                            <run>
                                <env>
                                    <ACCEPT_EULA>Y</ACCEPT_EULA>
                                    <SA_PASSWORD>Password!</SA_PASSWORD>
                                    <MSSQL_PID>Standard</MSSQL_PID>
                                    <MSSQL_AGENT_ENABLED>true</MSSQL_AGENT_ENABLED>
                                </env>
                                <ports>
                                    <port>1433:1433</port>
                                </ports>
                                <log>
                                    <prefix>sqlserver</prefix>
                                    <enabled>true</enabled>
                                    <color>yellow</color>
                                </log>
                                <wait>
                                    <time>60000</time> <!-- 60 seconds max -->
                                    <log>SQL Server is now ready for client connections</log>
                                </wait>
                            </run>
                            <external>
                                <type>properties</type>
                                <mode>override</mode>
                            </external>
                        </image>
                        <image>
                            <!-- A Docker image using the SQL Server -->
                            <name>${docker.image}</name>
                            <alias>sqlserver2</alias>
                            <run>
                                <env>
                                    <ACCEPT_EULA>Y</ACCEPT_EULA>
                                    <SA_PASSWORD>Password!</SA_PASSWORD>
                                    <MSSQL_PID>Standard</MSSQL_PID>
                                    <MSSQL_AGENT_ENABLED>true</MSSQL_AGENT_ENABLED>
                                </env>
                                <ports>
                                    <port>1434:1433</port>
                                </ports>
                                <log>
                                    <prefix>sqlserver</prefix>
                                    <enabled>true</enabled>
                                    <color>yellow</color>
                                </log>
                                <wait>
                                    <time>60000</time> <!-- 60 seconds max -->
                                    <log>SQL Server is now ready for client connections</log>
                                </wait>
                            </run>
                            <external>
                                <type>properties</type>
                                <mode>override</mode>
                            </external>
                        </image>
                    </images>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>skip-integration-tests</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>skipITs</name>
                </property>
            </activation>
            <properties>
                <docker.skip>true</docker.skip>
            </properties>
        </profile>
        <profile>
            <id>quick</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>quick</name>
                </property>
            </activation>
            <properties>
                <skipITs>true</skipITs>
                <docker.skip>true</docker.skip>
            </properties>
        </profile>
    </profiles>

</project>