<?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-parent</artifactId>
      <version>9.1.0.Alpha1</version>
      <relativePath>../../parent/pom.xml</relativePath>
   </parent>

   <artifactId>infinispan-client-hotrod</artifactId>
   <packaging>bundle</packaging>
   <name>Infinispan Hot Rod Client</name>
   <description>Infinispan Hot Rod Client</description>

   <properties>
      <infinispan.test.parallel.threads>5</infinispan.test.parallel.threads>
      <ca.dname>CN=CA,OU=Infinispan,O=JBoss,L=Red Hat</ca.dname>
      <ca.alias>infinispan-ca</ca.alias>
      <client.dname>CN=HotRodClient1,OU=Infinispan,O=JBoss,L=Red Hat</client.dname>
      <client.alias>client1</client.alias>
      <server.dname>CN=HotRodServer,OU=Infinispan,O=JBoss,L=Red Hat</server.dname>
      <server.alias>hotrod</server.alias>
      <client.keystore>${project.build.testOutputDirectory}/keystore_client.jks</client.keystore>
      <server.keystore>${project.build.testOutputDirectory}/keystore_server.jks</server.keystore>
      <default.password>secret</default.password>
      <alt.password>changeme</alt.password>
   </properties>

   <dependencies>
      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-commons</artifactId>
      </dependency>

      <dependency>
         <groupId>org.jboss.marshalling</groupId>
         <artifactId>jboss-marshalling-osgi</artifactId>
      </dependency>

      <dependency>
         <groupId>commons-pool</groupId>
         <artifactId>commons-pool</artifactId>
      </dependency>

      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-commons-test</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-core</artifactId>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-query</artifactId>
         <version>${project.version}</version>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-remote-query-server</artifactId>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-scripting</artifactId>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-scripting</artifactId>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-server-hotrod</artifactId>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-server-hotrod</artifactId>
         <type>test-jar</type>
         <scope>test</scope>
      </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-query-dsl</artifactId>
         <optional>true</optional>
      </dependency>

      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>infinispan-remote-query-client</artifactId>
         <optional>true</optional>
      </dependency>

      <dependency>
         <groupId>org.infinispan.protostream</groupId>
         <artifactId>sample-domain-definition</artifactId>
         <scope>test</scope>
      </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>

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

   </dependencies>

   <build>
      <resources>
         <resource>
            <directory>${project.basedir}/src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
               <include>**/*</include>
            </includes>
         </resource>
      </resources>
      <plugins>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>keytool-maven-plugin</artifactId>
            <executions>
               
               <execution>
                  <id>ca</id>
                  <goals>
                     <goal>generateKeyPair</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${ca.alias}</alias>
                     <dname>${ca.dname}</dname>
                     <keystore>${project.build.testOutputDirectory}/ca.jks</keystore>
                     <ext>bc:c</ext>
                  </configuration>
               </execution>
               <execution>
                  <id>ca-export</id>
                  <goals>
                     <goal>exportCertificate</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${ca.alias}</alias>
                     <keystore>${project.build.testOutputDirectory}/ca.jks</keystore>
                     <file>${project.build.testOutputDirectory}/ca.cer</file>
                  </configuration>
               </execution>
               
               <execution>
                  <id>server-truststore-import</id>
                  <goals>
                     <goal>importCertificate</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${ca.alias}</alias>
                     <file>${project.build.testOutputDirectory}/ca.cer</file>
                     <keystore>${project.build.testOutputDirectory}/truststore_server.jks</keystore>
                  </configuration>
               </execution>
               <execution>
                  <id>client-truststore-import</id>
                  <goals>
                     <goal>importCertificate</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${ca.alias}</alias>
                     <file>${project.build.testOutputDirectory}/ca.cer</file>
                     <keystore>${project.build.testOutputDirectory}/truststore_client.jks</keystore>
                  </configuration>
               </execution>
               
               <execution>
                  <id>client</id>
                  <goals>
                     <goal>generateKeyPair</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${client.alias}</alias>
                     <dname>${client.dname}</dname>
                     <keystore>${client.keystore}</keystore>
                  </configuration>
               </execution>
               <execution>
                  <id>client-certreq</id>
                  <goals>
                     <goal>generateCertificateRequest</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${client.alias}</alias>
                     <dname>${client.dname}</dname>
                     <file>${project.build.testOutputDirectory}/client1.csr</file>
                     <keystore>${client.keystore}</keystore>
                  </configuration>
               </execution>
               <execution>
                  <id>client-gencert</id>
                  <goals>
                     <goal>generateCertificate</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${ca.alias}</alias>
                     <keystore>${project.build.testOutputDirectory}/ca.jks</keystore>
                     <infile>${project.build.testOutputDirectory}/client1.csr</infile>
                     <outfile>${project.build.testOutputDirectory}/client1.cer</outfile>
                  </configuration>
               </execution>
               <execution>
                  <id>client-import-ca</id>
                  <goals>
                     <goal>importCertificate</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${ca.alias}</alias>
                     <file>${project.build.testOutputDirectory}/ca.cer</file>
                     <keystore>${client.keystore}</keystore>
                  </configuration>
               </execution>
               <execution>
                  <id>client-signed-import</id>
                  <goals>
                     <goal>importCertificate</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${client.alias}</alias>
                     <file>${project.build.testOutputDirectory}/client1.cer</file>
                     <keystore>${client.keystore}</keystore>
                  </configuration>
               </execution>
               
               <execution>
                  <id>server</id>
                  <goals>
                     <goal>generateKeyPair</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${server.alias}</alias>
                     <dname>${server.dname}</dname>
                     <keystore>${server.keystore}</keystore>
                  </configuration>
               </execution>
               <execution>
                  <id>server-certreq</id>
                  <goals>
                     <goal>generateCertificateRequest</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${server.alias}</alias>
                     <dname>${server.dname}</dname>
                     <file>${project.build.testOutputDirectory}/server.csr</file>
                     <keystore>${server.keystore}</keystore>
                  </configuration>
               </execution>
               <execution>
                  <id>server-gencert</id>
                  <goals>
                     <goal>generateCertificate</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${ca.alias}</alias>
                     <keystore>${project.build.testOutputDirectory}/ca.jks</keystore>
                     <infile>${project.build.testOutputDirectory}/server.csr</infile>
                     <outfile>${project.build.testOutputDirectory}/server.cer</outfile>
                  </configuration>
               </execution>
               <execution>
                  <id>server-import-ca</id>
                  <goals>
                     <goal>importCertificate</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${ca.alias}</alias>
                     <file>${project.build.testOutputDirectory}/ca.cer</file>
                     <keystore>${server.keystore}</keystore>
                  </configuration>
               </execution>
               <execution>
                  <id>server-signed-import</id>
                  <goals>
                     <goal>importCertificate</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${server.alias}</alias>
                     <file>${project.build.testOutputDirectory}/server.cer</file>
                     <keystore>${server.keystore}</keystore>
                  </configuration>
               </execution>
               
               <execution>
                  <id>client-alt-cert-password</id>
                  <goals>
                     <goal>importKeystore</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <srckeystore>${client.keystore}</srckeystore>
                     <srcalias>${client.alias}</srcalias>
                     <srcstorepass>${default.password}</srcstorepass>
                     <srckeypass>${default.password}</srckeypass>
                     <destkeystore>${project.build.testOutputDirectory}/keystore_client_alt_cert_password.jks</destkeystore>
                     <deststorepass>${default.password}</deststorepass>
                     <destkeypass>${alt.password}</destkeypass>
                  </configuration>
               </execution>
               <execution>
                  <id>client-alt-cert-password-ca</id>
                  <goals>
                     <goal>importCertificate</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${ca.alias}</alias>
                     <file>${project.build.testOutputDirectory}/ca.cer</file>
                     <keystore>${project.build.testOutputDirectory}/keystore_client_alt_cert_password.jks</keystore>
                     <keypass>${alt.password}</keypass>
                  </configuration>
               </execution>
               <execution>
                  <id>server-alt-cert-password</id>
                  <goals>
                     <goal>importKeystore</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <srckeystore>${server.keystore}</srckeystore>
                     <srcalias>${server.alias}</srcalias>
                     <srcstorepass>${default.password}</srcstorepass>
                     <srckeypass>${default.password}</srckeypass>
                     <destkeystore>${project.build.testOutputDirectory}/keystore_server_alt_cert_password.jks</destkeystore>
                     <deststorepass>${default.password}</deststorepass>
                     <destkeypass>${alt.password}</destkeypass>
                  </configuration>
               </execution>
               <execution>
                  <id>server-alt-cert-password-ca</id>
                  <goals>
                     <goal>importCertificate</goal>
                  </goals>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <alias>${ca.alias}</alias>
                     <file>${project.build.testOutputDirectory}/ca.cer</file>
                     <keystore>${project.build.testOutputDirectory}/keystore_server_alt_cert_password.jks</keystore>
                     <keypass>${alt.password}</keypass>
                  </configuration>
               </execution>
            </executions>
            <configuration>
               <keyalg>RSA</keyalg>
               <keysize>2048</keysize>
               <noprompt>true</noprompt>
               <storepass>${default.password}</storepass>
               <keypass>${default.password}</keypass>
               <trustcacerts>true</trustcacerts>
               <validity>365</validity>
               <verbose>true</verbose>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <configuration>
               <instructions>
                  <Export-Package>
                     ${project.groupId}.client.hotrod.*;version=${project.version};-split-package:=error
                  </Export-Package>
                  <Import-Package>
                     *
                  </Import-Package>
               </instructions>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
               <execution>
                  <id>attach-artifacts</id>
                  <phase>package</phase>
                  <goals>
                     <goal>attach-artifact</goal>
                  </goals>
                  <configuration>
                     <artifacts>
                        <artifact>
                           <file>target/classes/features.xml</file>
                           <type>xml</type>
                           <classifier>features</classifier>
                        </artifact>
                     </artifacts>
                  </configuration>
               </execution>
            </executions>
         </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,*.csr,*.cer" />
                        </delete>
                     </tasks>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
</project>