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


    Copyright 2021-2025 gematik GmbH

    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.

    *******

    For additional notes and disclaimer from gematik and in case of changes by gematik find details in the "Readme" file.

-->
<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>de.gematik.test</groupId>
        <artifactId>tiger</artifactId>
        <version>4.1.7</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>tiger-test-lib</artifactId>
    <packaging>jar</packaging>
    <name>${project.artifactId}</name>
    <description>tiger-test-lib modul of the tiger test platform.</description>

    <properties>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>

        <tiger.build.timestamp>${maven.build.timestamp}</tiger.build.timestamp>
    </properties>

    <dependencies>
        <!-- needed for java junit / testng test code parsing -->
        <dependency>
            <groupId>com.github.javaparser</groupId>
            <artifactId>javaparser-core</artifactId>
        </dependency>
        <!-- validate json based on a schema -->
        <dependency>
            <groupId>com.networknt</groupId>
            <artifactId>json-schema-validator</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>de.gematik.test</groupId>
            <artifactId>tiger-test-utils</artifactId>
        </dependency>
        <dependency>
            <groupId>de.gematik.test</groupId>
            <artifactId>tiger-testenv-mgr</artifactId>
        </dependency>
        <!-- needed for TigerCucumberRunner -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit-platform-engine</artifactId>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-plugin</artifactId>
        </dependency>
        <dependency>
            <groupId>net.javacrumbs.json-unit</groupId>
            <artifactId>json-unit-spring</artifactId>
        </dependency>
        <!-- serenity & cucumber -->
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-cucumber</artifactId>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-model</artifactId>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-rest-assured</artifactId>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-screenplay</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-suite</artifactId>
        </dependency>
        <!-- even though we don't directly use junit4, we still need the vintage engine
                because cucumber uses it on its PickleRunner -->
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <!-- hardcoded. excluded from serenity because of clash with system-stubs-core -->
        </dependency>
        <!-- JSON Checker -->
        <dependency>
            <groupId>org.skyscreamer</groupId>
            <artifactId>jsonassert</artifactId>
        </dependency>
        <!-- to easily compare xml structures -->
        <dependency>
            <groupId>org.xmlunit</groupId>
            <artifactId>xmlunit-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>de.gematik.test</groupId>
            <artifactId>tiger-httpbin</artifactId>
            <classifier>jar-with-dependencies</classifier>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.activation</groupId>
            <artifactId>jakarta.activation-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wiremock</groupId>
            <artifactId>wiremock-standalone</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>uk.org.webcompere</groupId>
            <artifactId>system-stubs-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>uk.org.webcompere</groupId>
            <artifactId>system-stubs-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <resources>
            <resource>
                <filtering>true</filtering>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok-maven-plugin</artifactId>
                <version>1.18.20.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>delombok</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                            <addOutputDirectory>false</addOutputDirectory>
                            <sourceDirectory>src/main/java</sourceDirectory>
                            <outputDirectory>${project.build.directory}/delombok</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-assertions-generator-maven-plugin</artifactId>
                <version>2.2.0</version>
                <configuration>
                    <generateJUnitSoftAssertions>false</generateJUnitSoftAssertions>
                    <packages>
                        <package>io.cucumber.core.plugin.report</package>
                    </packages>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                        <version>${version.junit5}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>generateAssertions</id>
                        <goals>
                            <goal>generate-assertions</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>maven-replacer-plugin</artifactId>
                <version>1.4.1</version>
                <executions>
                    <execution>
                        <id>replace-generated-annotation</id>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                        <phase>process-test-sources</phase>
                        <configuration>
                            <includes>
                                <include>target/generated-test-sources/assertj-assertions/**/*.java</include>
                            </includes>
                            <replacements>
                                <replacement>
                                    <token>@javax.annotation.Generated</token>
                                    <value>@javax.annotation.processing.Generated</value>
                                </replacement>
                            </replacements>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${version.maven.javadoc}</version>
                <configuration>
                    <doclint>none</doclint>
                    <sourcepath>${project.build.directory}/delombok</sourcepath>
                    <tags>
                        <tag>
                            <name>testenv</name>
                            <placement>a</placement>
                            <head>Testenvironment Variables:</head>
                        </tag>
                        <tag>
                            <name>gematik.context.out</name>
                            <placement>a</placement>
                            <head>Context OUT:</head>
                        </tag>
                        <tag>
                            <name>gematik.context.in</name>
                            <placement>a</placement>
                            <head>Context INPUT:</head>
                        </tag>
                    </tags>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${version.maven.failsafe}</version>
                <configuration>
                    <argLine>${failsafe.jacoco.args}</argLine>
                    <includes>
                        <include>**/integrationtest/Test*.java</include>
                    </includes>
                    <excludes>
                        <!-- to be executed only by tiger-integration-tests/tiger-custom-fail-message-tests.Jenkinsfile -->
                        <exclude>**/integrationtest/TestCustomFailMessage.java</exclude>
                    </excludes>
                    <skipITs>false</skipITs>
                    <threadCount>16</threadCount>
                    <!-- serenity plugin will check and fail after integration test -->
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.serenity-bdd.maven.plugins</groupId>
                <artifactId>serenity-maven-plugin</artifactId>
                <version>${version.serenity.maven.plugin}</version>
                <dependencies>
                    <dependency>
                        <groupId>net.serenity-bdd</groupId>
                        <artifactId>serenity-core</artifactId>
                        <version>${version.serenity.core}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>aggregate</goal>
                            <goal>reports</goal>
                            <goal>check</goal>
                        </goals>
                        <phase>post-integration-test</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.3.1</version>
                <executions>
                    <execution>
                        <id>update-project-version-in-manual</id>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <outputDirectory>${project.parent.basedir}/doc/user_manual</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.parent.basedir}/doc/user_manual/tobefiltered</directory>
                                    <includes>
                                        <include>**</include>
                                    </includes>
                                    <filtering>true</filtering>
                                </resource>
                                <resource>
                                    <directory>
                                        ${project.parent.basedir}/tiger-test-lib/src/test/resources/features/tiger-test-lib
                                    </directory>
                                    <includes>
                                        <include>HttpGlueCodeTest.feature</include>
                                    </includes>
                                    <filtering>false</filtering>
                                </resource>

                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>detect os</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <target>
                                <condition property="isWindows">
                                    <os family="windows"/>
                                </condition>
                                <condition property="isUnix">
                                    <os family="unix"/>
                                </condition>
                            </target>
                            <exportAntProperties>true</exportAntProperties>
                        </configuration>
                    </execution>
                    <execution>
                        <id>extract comments from InlineJexlToolbox for user manual</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <skip>${isWindows}</skip>
                            <target>
                                <exec dir="../doc/user_manual" executable="/bin/bash">
                                    <arg value="extractCommentsFromInlineJexlToolbox.sh"/>
                                </exec>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>codegeneration</id>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <phase>generate-test-resources</phase>
                        <configuration>
                            <mainClass>de.gematik.test.tiger.glue.AnnotationParser</mainClass>
                            <arguments>
                                <argument>HttpGlueCode.java</argument>
                                <argument>RbelBuilderGlueCode.java</argument>
                                <argument>RBelValidatorGlue.java</argument>
                                <argument>TigerGlue.java</argument>
                                <argument>TigerProxyGlue.java</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <sourceDirectory>../doc/user_manual</sourceDirectory>
                    <sourceDocumentName>tiger_user_manual.adoc</sourceDocumentName>
                    <outputDirectory>target/doc/user_manual</outputDirectory>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-pdf</artifactId>
                        <version>2.3.23</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <phase>generate-test-resources</phase>
                        <configuration>
                            <attributes>
                                <source-highlighter>highlightjs</source-highlighter>
                                <icons>font</icons>
                                <pagenums/>
                                <toc>left</toc>
                                <idprefix/>
                                <idseparator>-</idseparator>
                            </attributes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>generate-pdf-doc</id>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <phase>generate-test-resources</phase>
                        <configuration>
                            <backend>pdf</backend>
                            <attributes>
                                <source-highlighter>coderay</source-highlighter>
                                <icons>font</icons>
                                <pagenums/>
                                <toc/>
                                <idprefix/>
                                <idseparator>-</idseparator>
                            </attributes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>
</project>
