<?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>com.azure</groupId>
    <artifactId>azure-client-sdk-parent</artifactId>
    <version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
    <relativePath>../../parents/azure-client-sdk-parent</relativePath>
  </parent>

  <groupId>com.azure</groupId>
  <artifactId>azure-spring-data-cosmos</artifactId>
  <version>5.3.0</version> <!-- {x-version-update;com.azure:azure-spring-data-cosmos;current} -->
  <packaging>jar</packaging>
  <name>Spring Data for Azure Cosmos DB SQL API</name>
  <description>Spring Data for Azure Cosmos DB SQL API</description>
  <url>https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/spring/azure-spring-data-cosmos</url>

  <properties>
    <maven.build.timestamp.format>MM-dd-HH-mm-ss</maven.build.timestamp.format>
    <jacoco.min.branchcoverage>0.17</jacoco.min.branchcoverage>
    <jacoco.min.linecoverage>0.18</jacoco.min.linecoverage>
    <!-- Configures the Java 9+ run to perform the required module exports, opens, and reads that are necessary for testing but shouldn't be part of the module-info. -->
    <javaModulesSurefireArgLine>
      <!-- Azure Spring Data Cosmos tests need this -->
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos=ALL-UNNAMED,spring.core,com.fasterxml.jackson.databind
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.common=spring.core
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.core=ALL-UNNAMED,spring.core
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.core.convert=com.fasterxml.jackson.databind
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.core.converter=ALL-UNNAMED
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.core.mapping=spring.core
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.core.mapping.event=spring.core,spring.beans
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.repository=ALL-UNNAMED,spring.core
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.repository.integration=ALL-UNNAMED,spring.core
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.repository.query=ALL-UNNAMED
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.repository.support=ALL-UNNAMED,spring.core
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.domain=com.fasterxml.jackson.databind,spring.core,spring.data.commons
      --add-opens com.azure.spring.data.cosmos/com.azure.spring.data.cosmos.domain.inheritance=com.fasterxml.jackson.databind,spring.core,spring.data.commons
      --add-opens com.fasterxml.jackson.databind/com.fasterxml.jackson.databind=spring.core
    </javaModulesSurefireArgLine>
    <azure.test.resourcegroup>azure-spring-data-cosmos-test</azure.test.resourcegroup>
    <azure.test.dbname>testdb-${maven.build.timestamp}</azure.test.dbname>
    <skip.integration.tests>true</skip.integration.tests>
    <test.on.azure>false</test.on.azure>
    <test.on.emualator>false</test.on.emualator>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>6.0.7</version> <!-- {x-version-update;org.springframework:spring-core;external_dependency} -->
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>6.0.7</version> <!-- {x-version-update;org.springframework:spring-web;external_dependency} -->
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>6.0.7</version> <!-- {x-version-update;org.springframework:spring-beans;external_dependency} -->
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>6.0.7</version> <!-- {x-version-update;org.springframework:spring-context;external_dependency} -->
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
      <version>6.0.7</version> <!-- {x-version-update;org.springframework:spring-tx;external_dependency} -->
    </dependency>
    <dependency>
      <groupId>org.springframework.data</groupId>
      <artifactId>spring-data-commons</artifactId>
      <version>3.0.4</version> <!-- {x-version-update;org.springframework.data:spring-data-commons;external_dependency} -->
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-expression</artifactId>
      <version>6.0.7</version> <!-- {x-version-update;org.springframework:spring-expression;external_dependency} -->
    </dependency>
    <dependency>
      <groupId>com.azure</groupId>
      <artifactId>azure-cosmos</artifactId>
      <version>4.46.0</version> <!-- {x-version-update;com.azure:azure-cosmos;dependency} -->
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.module</groupId>
      <artifactId>jackson-module-parameter-names</artifactId>
      <version>2.14.2</version> <!-- {x-version-update;com.fasterxml.jackson.module:jackson-module-parameter-names;external_dependency} -->
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jdk8</artifactId>
      <version>2.14.2</version> <!-- {x-version-update;com.fasterxml.jackson.datatype:jackson-datatype-jdk8;external_dependency} -->
    </dependency>
    <dependency>
      <groupId>org.javatuples</groupId>
      <artifactId>javatuples</artifactId>
      <version>1.2</version> <!-- {x-version-update;org.javatuples:javatuples;external_dependency} -->
    </dependency>
    <dependency>
      <groupId>javax.annotation</groupId>
      <artifactId>javax.annotation-api</artifactId>
      <version>1.3.2</version> <!-- {x-version-update;javax.annotation:javax.annotation-api;external_dependency} -->
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.12.0</version> <!-- {x-version-update;org.apache.commons:commons-lang3;external_dependency} -->
    </dependency>

    <!-- Test -->
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>4.11.0</version> <!-- {x-version-update;org.mockito:mockito-core;external_dependency} -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version> <!-- {x-version-update;junit:junit;external_dependency} -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <version>3.0.5</version> <!-- {x-version-update;org.springframework.boot:spring-boot-starter-test;external_dependency} -->
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>com.vaadin.external.google</groupId>
          <artifactId>android-json</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.projectreactor</groupId>
      <artifactId>reactor-test</artifactId>
      <version>3.5.4</version> <!-- {x-version-update;io.projectreactor:reactor-test;external_dependency} -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>2.0.7</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
      <scope>test</scope>
    </dependency>
    <!-- Added this provided dependency to include necessary annotations used by "reactor-core".
         Without this dependency, javadoc throws a warning as it cannot find enum When.MAYBE
         which is used in @Nullable annotation in reactor core classes.

         Similar provided dependency exits for "azure-core" as well.
    -->
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <version>3.0.2</version> <!-- {x-version-update;com.google.code.findbugs:jsr305;external_dependency} -->
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>2.0.7</version> <!-- {x-version-update;org.slf4j:slf4j-api;external_dependency} -->
    </dependency>
    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <version>5.9.2</version> <!-- {x-version-update;org.junit.vintage:junit-vintage-engine;external_dependency} -->
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.hamcrest</groupId>
          <artifactId>hamcrest-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M3</version> <!-- {x-version-update;org.apache.maven.plugins:maven-enforcer-plugin;external_dependency} -->
        <configuration>
          <rules>
            <bannedDependencies>
              <includes>
                <include>org.springframework:spring-beans:[6.0.7]</include> <!-- {x-include-update;org.springframework:spring-beans;external_dependency} -->
                <include>org.springframework:spring-web:[6.0.7]</include> <!-- {x-include-update;org.springframework:spring-web;external_dependency} -->
                <include>org.springframework:spring-tx:[6.0.7]</include> <!-- {x-include-update;org.springframework:spring-tx;external_dependency} -->
                <include>org.springframework:spring-expression:[6.0.7]</include> <!-- {x-include-update;org.springframework:spring-expression;external_dependency} -->
                <include>org.springframework:spring-core:[6.0.7]</include> <!-- {x-include-update;org.springframework:spring-core;external_dependency} -->
                <include>org.springframework:spring-context:[6.0.7]</include> <!-- {x-include-update;org.springframework:spring-context;external_dependency} -->
                <include>org.springframework.data:spring-data-commons:[3.0.4]</include> <!-- {x-include-update;org.springframework.data:spring-data-commons;external_dependency} -->
                <include>org.javatuples:javatuples:[1.2]</include> <!-- {x-include-update;org.javatuples:javatuples;external_dependency} -->
                <include>com.fasterxml.jackson.datatype:jackson-datatype-jdk8:[2.14.2]</include> <!-- {x-include-update;com.fasterxml.jackson.datatype:jackson-datatype-jdk8;external_dependency} -->
                <include>com.fasterxml.jackson.module:jackson-module-parameter-names:[2.14.2]</include> <!-- {x-include-update;com.fasterxml.jackson.module:jackson-module-parameter-names;external_dependency} -->
                <include>javax.annotation:javax.annotation-api:[1.3.2]</include> <!-- {x-include-update;javax.annotation:javax.annotation-api;external_dependency} -->
                <include>org.apache.commons:commons-lang3:[3.12.0]</include> <!-- {x-include-update;org.apache.commons:commons-lang3;external_dependency} -->
                <include>org.slf4j:slf4j-api:[2.0.7]</include> <!-- {x-include-update;org.slf4j:slf4j-api;external_dependency} -->
              </includes>
            </bannedDependencies>
          </rules>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
        <configuration>
          <sourceFileExcludes>
            <sourceFileExclude>com/azure/spring/data/cosmos/core/mapping/BasicCosmosPersistentProperty.java</sourceFileExclude>
          </sourceFileExcludes>
          <additionalDependencies>
            <additionalDependency>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>1.18.6</version>
            </additionalDependency>
          </additionalDependencies>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>3.1.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
        <configuration>
          <systemPropertiesFile>src/test/resources/application.properties</systemPropertiesFile>
          <skipITs>${skip.integration.tests}</skipITs>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <!-- unit test -->
      <id>unit</id>
      <properties>
        <env>default</env>
        <test.groups>unit</test.groups>
      </properties>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.1.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-surefire-plugin;external_dependency} -->
            <configuration>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>integration-test-azure</id>
      <properties>
        <build.profile.id>integration-test-azure</build.profile.id>
        <skip.integration.tests>false</skip.integration.tests>
        <test.on.azure>true</test.on.azure>
        <test.on.emulator>false</test.on.emulator>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.1.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-surefire-plugin;external_dependency} -->
            <configuration>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>integration-test-emulator</id>
      <properties>
        <build.profile.id>integration-test-emulator</build.profile.id>
        <skip.integration.tests>false</skip.integration.tests>
        <test.on.azure>false</test.on.azure>
        <test.on.emulator>true</test.on.emulator>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.1.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
            <configuration>
              <excludes>
                <!--Excluding PageablePersonRepositoryIT test class, as it creates large documents which are not suitable for emulator-->
                <exclude>**/PageablePersonRepositoryIT.java</exclude>
                <!--Excluding PersonCrossPartitionIT test class, as it creates large containers which are not suitable for emulator-->
                <exclude>**/PersonCrossPartitionIT.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
