<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright © 2015 The Gravitee team (http://gravitee.io)

    Licensed 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>io.gravitee.apim.repository</groupId>
        <artifactId>gravitee-apim-repository</artifactId>
        <version>4.9.28</version>
    </parent>

	<artifactId>gravitee-apim-repository-mongodb</artifactId>

	<name>Gravitee.io APIM - Repository - MongoDB</name>

	<properties>
        <!-- Property used by the publication job in CI-->
        <publish-folder-path>graviteeio-apim/plugins/repositories</publish-folder-path>
    </properties>

    <dependencies>
        <!-- Gravitee dependencies -->
        <dependency>
            <groupId>io.gravitee.apim.repository</groupId>
            <artifactId>gravitee-apim-repository-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.gravitee.platform</groupId>
            <artifactId>gravitee-platform-repository-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Runtime scope -->

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.projectreactor.addons</groupId>
            <artifactId>reactor-adapter</artifactId>
            <scope>provided</scope>
        </dependency>

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

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

        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>${mongo.version}</version>
        </dependency>

        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-reactivestreams</artifactId>
            <version>${mongo.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.reactivestreams</groupId>
                    <artifactId>reactive-streams</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.projectreactor</groupId>
                    <artifactId>reactor-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-crypt</artifactId>
            <!-- /!\ Force provided scope. mongodb-crypt.jar and jna.jar should be provided via /plugin/ext/repository-mongodb -->
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <!-- /!\ Force provided scope. mongodb-crypt.jar and jna.jar should be provided via /plugin/ext/repository-mongodb -->
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-mongodb</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-expression</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-tx</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Test scope -->
        <dependency>
            <groupId>io.gravitee.apim.repository</groupId>
            <artifactId>gravitee-apim-repository-test</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>mongodb</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**/distributedsync/*.java</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <!-- default-test is the default execution. But it is already covered by `without-encryption` execution -->
                        <id>default-test</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>without-encryption</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <systemPropertyVariables>
                                <management.mongodb.encryption.enabled>false</management.mongodb.encryption.enabled>
                            </systemPropertyVariables>
                        </configuration>
                    </execution>
                    <execution>
                        <id>with-encryption</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <systemPropertyVariables>
                                <management.mongodb.encryption.enabled>true</management.mongodb.encryption.enabled>
                            </systemPropertyVariables>
                            <includes>
                                <include>io.gravitee.repository.management.UserRepositoryTest</include>
                                <include>io.gravitee.repository.management.LicenseRepositoryTest</include>
                                <include>io.gravitee.repository.management.MetadataRepositoryTest</include>
                                <include>io.gravitee.repository.management.TokenRepositoryTest</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
