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

    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You 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>org.apache.camel.quarkus</groupId>
        <artifactId>camel-quarkus-build-parent-it</artifactId>
        <version>3.8.4</version>
        <relativePath>../../poms/build-parent-it/pom.xml</relativePath>
    </parent>

    <artifactId>camel-quarkus-integration-test-ldap</artifactId>
    <name>Camel Quarkus :: Integration Tests :: LDAP</name>
    <description>Integration tests for Camel Quarkus LDAP extension</description>

    <dependencies>
        <dependency>
            <groupId>org.apache.camel.quarkus</groupId>
            <artifactId>camel-quarkus-ldap</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel.quarkus</groupId>
            <artifactId>camel-quarkus-direct</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-resteasy</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-resteasy-jackson</artifactId>
        </dependency>


        <!-- test dependencies -->
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-junit5</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.unboundid</groupId>
            <artifactId>unboundid-ldapsdk</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>full</id>
            <activation>
                <property>
                    <name>!quickly</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>keytool-maven-plugin</artifactId>
                        <configuration>
                            <validity>18250</validity>
                            <keyalg>RSA</keyalg>
                            <storepass>ldapPass</storepass>
                            <noprompt>true</noprompt>
                        </configuration>
                        <executions>
                            <execution>
                                <id>generate-keypair</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>clean</goal>
                                    <goal>generateKeyPair</goal>
                                </goals>
                                <configuration>
                                    <alias>ldap</alias>
                                    <keysize>2048</keysize>
                                    <dname>CN=127.0.0.1, OU=Camel Quarkus, O=Apache</dname>
                                    <exts>
                                        <ext>SAN=IP:127.0.0.1</ext>
                                    </exts>
                                    <keystore>${project.basedir}/target/test-classes/keystore.jks</keystore>
                                </configuration>
                            </execution>
                            <execution>
                                <id>export-certificate</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>exportCertificate</goal>
                                </goals>
                                <configuration>
                                    <alias>ldap</alias>
                                    <keystore>${project.basedir}/target/test-classes/keystore.jks</keystore>
                                    <file>${basedir}/target/test-classes/ldap-cert</file>
                                </configuration>
                            </execution>
                            <execution>
                                <id>create-trusstore</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>importCertificate</goal>
                                </goals>
                                <configuration>
                                    <alias>localhost</alias>
                                    <trustcacerts>true</trustcacerts>
                                    <keystore>${basedir}/target/test-classes/truststore.jks</keystore>
                                    <file>${basedir}/target/test-classes/ldap-cert</file>
                                </configuration>
                            </execution>
                            <execution>
                                <id>generate-wrong-trusstore</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>clean</goal>
                                    <goal>generateKeyPair</goal>
                                </goals>
                                <configuration>
                                    <alias>localhost</alias>
                                    <dname>CN=localhost, OU=eng, O=apache.org</dname>
                                    <exts>
                                        <ext>bc:c=ca:true,pathlen:2147483647</ext>
                                        <ext>IssuerAlternativeName=DNS:NOT-FOR-PRODUCTION-USE</ext>
                                    </exts>
                                    <keystore>${project.build.outputDirectory}/truststore-wrong.jks</keystore>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>virtualDependencies</id>
            <activation>
                <property>
                    <name>!noVirtualDependencies</name>
                </property>
            </activation>
            <dependencies>
                <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
                <dependency>
                    <groupId>org.apache.camel.quarkus</groupId>
                    <artifactId>camel-quarkus-direct-deployment</artifactId>
                    <version>${project.version}</version>
                    <type>pom</type>
                    <scope>test</scope>
                    <exclusions>
                        <exclusion>
                            <groupId>*</groupId>
                            <artifactId>*</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.apache.camel.quarkus</groupId>
                    <artifactId>camel-quarkus-ldap-deployment</artifactId>
                    <version>${project.version}</version>
                    <type>pom</type>
                    <scope>test</scope>
                    <exclusions>
                        <exclusion>
                            <groupId>*</groupId>
                            <artifactId>*</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>native</id>
            <activation>
                <property>
                    <name>native</name>
                </property>
            </activation>
            <properties>
                <quarkus.package.type>native</quarkus.package.type>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>