<?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>
    <groupId>org.alfresco.tas</groupId>
    <artifactId>restapi</artifactId>
    <name>alfresco-tas-restapi</name>

    <parent>
        <groupId>org.alfresco</groupId>
        <artifactId>alfresco-community-repo-tests</artifactId>
        <version>25.3.0.60</version>
    </parent>

    <properties>
        <suiteXmlFile>${project.basedir}/src/test/resources/restapi-suite.xml</suiteXmlFile>
        <maven.build.sourceVersion>17</maven.build.sourceVersion>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <rest.api.explorer.branch>master</rest.api.explorer.branch>
        <httpclient-osgi-version>4.5.6</httpclient-osgi-version>
        <commons-lang3.version>3.18.0</commons-lang3.version>
        <scribejava-apis.version>8.3.3</scribejava-apis.version>
        <java.version>17</java.version>
    </properties>

    <profiles>
        <profile>
            <id>run-restapi-part1</id>
            <properties>
                <suiteXmlFile>${project.basedir}/src/test/resources/test-suites/part1-suite.xml</suiteXmlFile>
            </properties>
        </profile>
        <profile>
            <id>run-restapi-part2</id>
            <properties>
                <suiteXmlFile>${project.basedir}/src/test/resources/test-suites/part2-suite.xml</suiteXmlFile>
            </properties>
        </profile>
        <profile>
            <id>run-restapi-part3</id>
            <properties>
                <suiteXmlFile>${project.basedir}/src/test/resources/test-suites/part3-suite.xml</suiteXmlFile>
            </properties>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
        </dependency>

        <!-- alfresco tester settings -->
        <dependency>
            <groupId>org.alfresco.tas</groupId>
            <artifactId>utility</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>slf4j-api</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
                <exclusion>
                	<artifactId>commons-lang3</artifactId>
                	<groupId>org.apache.commons</groupId>
                </exclusion>
                <exclusion>
                	<artifactId>commons-lang</artifactId>
                	<groupId>commons-lang</groupId>
                </exclusion>
                <exclusion>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang3.version}</version>
        </dependency>

        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>${dependency.awaitility.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- REST ASSURED -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient-osgi</artifactId>
            <version>${httpclient-osgi-version}</version>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-path</artifactId>
            <exclusions>
            	<exclusion>
            		<artifactId>commons-lang3</artifactId>
            		<groupId>org.apache.commons</groupId>
            	</exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>xml-path</artifactId>
            <exclusions>
            	<exclusion>
            		<artifactId>commons-lang3</artifactId>
            		<groupId>org.apache.commons</groupId>
            	</exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-schema-validator</artifactId>
        </dependency>

        <dependency>
            <groupId>com.github.scribejava</groupId>
            <artifactId>scribejava-apis</artifactId>
            <version>${scribejava-apis.version}</version>
        </dependency>

        <!-- JSON to Object -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>

        <!-- swagger parser -->
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-parser</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>commons-lang3</artifactId>
                    <groupId>org.apache.commons</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
        </dependency>
        
        <!--fixing java.lang.ClassCastException: class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap')  -->
        <!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy -->
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy</artifactId>
            <version>3.0.25</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-json-->
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-json</artifactId>
            <version>3.0.25</version>
        </dependency>

       <dependency>
           <groupId>org.mockito</groupId>
           <artifactId>mockito-core</artifactId>
           <scope>test</scope>
       </dependency>

        <dependency>
            <groupId>org.eclipse.parsson</groupId>
            <artifactId>parsson</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
                    </suiteXmlFiles>
                    <!-- Keeping illegal-access=warn for Java 11 compatibility, even though it has no effect on JDK 17 -->
                    <argLine>
                        --illegal-access=warn
                        --add-opens=java.base/java.lang=ALL-UNNAMED
                    </argLine>
                </configuration>
            </plugin>
            <!-- Build only test jar -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludes>
                        <exclude>**/*UnitTest*</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <arguments>
                        <argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-auth.yaml</argument>
                        <argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-core.yaml</argument>
                        <argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-discovery.yaml</argument>
                        <argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-search.yaml</argument>
                        <argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-workflow.yaml</argument>
                    </arguments>
                    <mainClass>org.alfresco.rest.core.swagger.Generator</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
