<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>org.infinispan</groupId>
      <artifactId>infinispan-server-parent</artifactId>
      <version>9.1.0.Final</version>
      <relativePath>../pom.xml</relativePath>
   </parent>

   <artifactId>infinispan-server-hotrod</artifactId>
   <packaging>bundle</packaging>
   <name>Infinispan Hot Rod Server</name>
   <description>Infinispan Hot Rod Server</description>

   <properties>
      <module.skipComponentMetaDataProcessing>false</module.skipComponentMetaDataProcessing>
      <certificate.dname>CN=HotRod_1,OU=Infinispan,O=JBoss,L=Red Hat,ST=World,C=WW</certificate.dname>
   </properties>

   <dependencies>
       <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-server-core</artifactId>
      </dependency>
      <dependency>
         <groupId>io.netty</groupId>
         <artifactId>netty-all</artifactId>
      </dependency>
      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-server-core</artifactId>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-remote-query-server</artifactId>
         <optional>true</optional>
      </dependency>
      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-tasks</artifactId>
      </dependency>
      <dependency>
         <groupId>org.jboss.sasl</groupId>
         <artifactId>jboss-sasl</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.testng</groupId>
         <artifactId>testng</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>

   <build>
      <plugins>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>keytool-maven-plugin</artifactId>
            <executions>
               <execution>
                  <id>password_server</id>
                  <goals>
                     <goal>generateKeyPair</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>default</alias>
                     <keystore>${project.build.testOutputDirectory}/password_server_keystore.jks</keystore>
                     <dname>${certificate.dname}</dname>
                  </configuration>
               </execution>
               <execution>
                  <id>default_server</id>
                  <goals>
                     <goal>generateKeyPair</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>default</alias>
                     <keystore>${project.build.testOutputDirectory}/default_server_keystore.jks</keystore>
                     <dname>${certificate.dname}</dname>
                  </configuration>
               </execution>
               <execution>
                  <id>sni_server</id>
                  <goals>
                     <goal>generateKeyPair</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>sni</alias>
                     <keystore>${project.build.testOutputDirectory}/sni_server_keystore.jks</keystore>
                     <dname>${certificate.dname}</dname>
                  </configuration>
               </execution>
               <execution>
                  <id>notrust_clients</id>
                  <goals>
                     <goal>generateKeyPair</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>sni</alias>
                     <keystore>${project.build.testOutputDirectory}/no_trusted_clients_keystore.jks</keystore>
                     <dname>${certificate.dname}</dname>
                  </configuration>
               </execution>
               <execution>
                  <id>password_truststore</id>
                  <goals>
                     <goal>importKeystore</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <srckeystore>${project.build.testOutputDirectory}/password_server_keystore.jks</srckeystore>
                     <srcstorepass>secret</srcstorepass>
                     <destkeystore>${project.build.testOutputDirectory}/password_client_truststore.jks</destkeystore>
                     <deststorepass>secret</deststorepass>
                  </configuration>
               </execution>
               <execution>
                  <id>default_truststore</id>
                  <goals>
                     <goal>importKeystore</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <srckeystore>${project.build.testOutputDirectory}/default_server_keystore.jks</srckeystore>
                     <srcstorepass>secret</srcstorepass>
                     <destkeystore>${project.build.testOutputDirectory}/default_client_truststore.jks</destkeystore>
                     <deststorepass>secret</deststorepass>
                  </configuration>
               </execution>
               <execution>
                  <id>sni_truststore</id>
                  <goals>
                     <goal>importKeystore</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <srckeystore>${project.build.testOutputDirectory}/sni_server_keystore.jks</srckeystore>
                     <srcstorepass>secret</srcstorepass>
                     <destkeystore>${project.build.testOutputDirectory}/sni_client_truststore.jks</destkeystore>
                     <deststorepass>secret</deststorepass>
                  </configuration>
               </execution>
            </executions>
            <configuration>
               <storepass>secret</storepass>
               <keypass>secret</keypass>
               <keysize>2048</keysize>
               <keyalg>RSA</keyalg>
               <validity>365</validity>
               <noprompt>true</noprompt>
               <trustcacerts>true</trustcacerts>
               <verbose>true</verbose>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <configuration>
               <instructions>
                  <Export-Package>
                     ${project.groupId}.server.hotrod.*;version=${project.version};-split-package:=error
                  </Export-Package>
                  <Include-Resource>
                     {maven-resources},
                     ${project.build.outputDirectory}/${project.artifactId}-component-metadata.dat
                  </Include-Resource>
               </instructions>
            </configuration>
         </plugin>

         
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
               <execution>
                  <id>clean-key-stores</id>
                  <phase>process-test-sources</phase>
                  <goals>
                     <goal>run</goal>
                  </goals>
                  <configuration>
                     <tasks>
                        <delete quiet="true">
                           <fileset dir="${project.build.testOutputDirectory}" includes="*.jks" />
                        </delete>
                     </tasks>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
</project>