<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, a division of Red Hat
  ~ Copyright 2011, Red Hat Middleware, LLC, and individual
  ~ contributors as indicated by the @authors tag. See the
  ~ copyright.txt in the distribution for a full listing of
  ~ individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->

<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">
   <parent>
      <groupId>org.gatein.wsrp</groupId>
      <artifactId>wsrp-parent</artifactId>
      <version>2.3.4.Final</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>

   <artifactId>wsrp-producer</artifactId>
   <packaging>war</packaging>
   <name>GateIn WSRP Producer WAR</name>

   <properties>
      <!-- the default jvmargs which should be used for the tests -->
      <!-- We need to set the STRICT_SERVLET_COMPLIANCE to false since we are using mock http requests -->
      <cargo.jvmargs.default>-Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=false</cargo.jvmargs.default>
      <cargo.jvmargs>${cargo.jvmargs.default}</cargo.jvmargs>
   </properties>

   <profiles>

      <profile>
         <id>arquillian-jbossas-remote</id>
         <build>
            <plugins>

               <plugin>
                  <artifactId>maven-assembly-plugin</artifactId>
                  <configuration>
                     <finalName>test</finalName>
                     <appendAssemblyId>true</appendAssemblyId>
                     <!-- we don't want to add these archives into the repo -->
                     <attach>false</attach>
                     <outputDirectory>${project.build.directory}/test-archives</outputDirectory>
                     <archiverConfig>
                        <appxml>src/test/producer-ear/META-INF/application.xml</appxml>
                     </archiverConfig>
                     <archive>
                        <manifestEntries>
                           <Dependencies>org.apache.cxf,org.jboss.xb,org.jboss.common-core,org.jboss.as.web,org.jboss.msc</Dependencies>
                        </manifestEntries>
                     </archive>
                     <descriptors>
                        <descriptor>src/test/assembly/test-producer.xml</descriptor>
                     </descriptors>
                  </configuration>
                  <executions>
                     <execution>
                        <id>assemble</id>
                        <phase>process-test-classes</phase>
                        <goals>
                           <goal>single</goal>
                        </goals>
                     </execution>
                  </executions>
                  <dependencies>
                     <dependency>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>jboss-packaging-maven-plugin</artifactId>
                        <version>2.1.1</version>
                     </dependency>
                  </dependencies>
               </plugin>

               <!-- Copy Google Portlet samples from PC module to test-archives so that they can be used in tests -->
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-dependency-plugin</artifactId>
                  <version>2.1</version>
                  <executions>
                     <execution>
                        <id>copy</id>
                        <goals>
                           <goal>copy</goal>
                        </goals>
                        <phase>process-test-sources</phase>
                        <configuration>
                           <artifactItems>
                              <artifactItem>
                                 <groupId>org.gatein.pc</groupId>
                                 <artifactId>pc-samples</artifactId>
                                 <version>${org.gatein.pc.version}</version>
                                 <classifier>google-portlet</classifier>
                                 <type>war</type>
                                 <destFileName>google-portlet.war</destFileName>
                                 <outputDirectory>${project.build.directory}/test-archives</outputDirectory>
                              </artifactItem>
                           </artifactItems>
                        </configuration>
                     </execution>
                     <execution>
                        <id>unpack-as7</id>
                        <goals>
                           <goal>unpack</goal>
                        </goals>
                        <phase>process-test-sources</phase>
                        <configuration>
                           <artifactItems>
                              <artifactItem>
                                 <groupId>org.jboss.as</groupId>
                                 <artifactId>jboss-as-dist</artifactId>
                                 <type>zip</type>
                                 <outputDirectory>${project.build.directory}/servers</outputDirectory>
                              </artifactItem>
                           </artifactItems>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-resources-plugin</artifactId>
                  <version>2.6</version>
                  <executions>
                     <execution>
                        <id>configure-AS</id>
                        <goals>
                           <goal>copy-resources</goal>
                        </goals>
                        <phase>process-test-resources</phase>
                        <configuration>
                           <outputDirectory>${project.build.directory}/servers/jboss-as-${jbossas.version}</outputDirectory>
                           <resources>
                              <resource>
                                 <directory>src/test/jboss</directory>
                              </resource>
                           </resources>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <!--<plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-assembly-plugin</artifactId>
                  <configuration>
                     <appendAssemblyId>true</appendAssemblyId>
                     &lt;!&ndash; we don't want to add these archives into the repo &ndash;&gt;
                     <attach>false</attach>
                     <outputDirectory>${project.build.directory}/test-archives</outputDirectory>
                     <descriptors>
                        <descriptor>src/test/assembly/test-session-portlet.xml</descriptor>
                     </descriptors>
                  </configuration>
                  <executions>
                     <execution>
                        <id>make-assembly</id>
                        &lt;!&ndash; this is used for inheritance merges &ndash;&gt;
                        <phase>package</phase>
                        &lt;!&ndash; bind to the packaging phase &ndash;&gt;
                        <goals>
                           <goal>single</goal>
                        </goals>
                     </execution>
                  </executions>
               </plugin>-->
            </plugins>
         </build>
         <activation>
            <activeByDefault>true</activeByDefault>
         </activation>
         <dependencies>
            <dependency>
               <groupId>org.jboss.spec</groupId>
               <artifactId>jboss-javaee-6.0</artifactId>
               <version>3.0.1.Final</version>
               <type>pom</type>
               <scope>provided</scope>
            </dependency>
            <dependency>
               <groupId>org.jboss.as</groupId>
               <artifactId>jboss-as-arquillian-container-managed</artifactId>
               <version>${jbossas.version}</version>
               <scope>test</scope>
            </dependency>
         </dependencies>
      </profile>
      <profile>
         <id>generate-test-war-files</id>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-assembly-plugin</artifactId>
                  <configuration>
                     <appendAssemblyId>true</appendAssemblyId>
                     <!-- we don't want to add these archives into the repo -->
                     <attach>false</attach>
                     <outputDirectory>${project.build.directory}/test-archives</outputDirectory>
                     <descriptors>
                        <descriptor>src/test/assembly/test-applicationscope-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-basic-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-dispatcher-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-encodeurl-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-escapexml-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-events-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-eventswithobject-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-getlocales-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-implicitcloning-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-markup-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-multivalued-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-portletmodes-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-portletstate-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-prp-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-renderparam-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-resource-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-resourcenoencodeurl-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-resourceserving-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-session-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-state-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-usercontext-portlet.xml</descriptor>
                        <descriptor>src/test/assembly/test-windowstates-portlet.xml</descriptor>
                     </descriptors>
                  </configuration>
                  <executions>
                     <execution>
                        <id>make-assembly</id>
                        <!-- this is used for inheritance merges -->
                        <phase>package</phase>
                        <!-- bind to the packaging phase -->
                        <goals>
                           <goal>single</goal>
                        </goals>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
         <!-- not sure what to do with this dependency -->
         <dependencies>
            <dependency>
               <groupId>org.jboss.as</groupId>
               <artifactId>jboss-as-arquillian-container-managed</artifactId>
               <version>${jbossas.version}</version>
               <scope>test</scope>
            </dependency>
         </dependencies>
      </profile>
   </profiles>

   <dependencies>
      <dependency>
         <groupId>org.gatein.wsrp</groupId>
         <artifactId>wsrp-producer-lib</artifactId>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>org.gatein.wsrp</groupId>
         <artifactId>wsrp-wsrp1-ws</artifactId>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>org.gatein.wsrp</groupId>
         <artifactId>wsrp-wsrp2-ws</artifactId>
         <scope>provided</scope>
      </dependency>

      <!-- CXF Dependencies for service class annotations. -->
      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-api</artifactId>
         <scope>provided</scope>
      </dependency>

      <!-- test dependencies -->
      <dependency>
         <groupId>org.gatein.wsrp</groupId>
         <artifactId>test-framework</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.arquillian.protocol</groupId>
         <artifactId>arquillian-protocol-servlet</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.mockito</groupId>
         <artifactId>mockito-core</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-simple</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.shrinkwrap.resolver</groupId>
         <artifactId>shrinkwrap-resolver-api-maven</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.gatein.pc</groupId>
         <artifactId>pc-controller</artifactId>
         <scope>test</scope>
         <version>${org.gatein.pc.version}</version>
      </dependency>
      <dependency>
         <groupId>org.gatein.pc</groupId>
         <artifactId>pc-test-core</artifactId>
         <scope>test</scope>
         <version>${org.gatein.pc.version}</version>
      </dependency>
      <dependency>
         <groupId>javax.ccpp</groupId>
         <artifactId>ccpp</artifactId>
         <scope>test</scope>
         <!--TODO: move version to parent pom -->
      </dependency>

      <dependency>
         <groupId>org.jboss.web</groupId>
         <artifactId>jbossweb</artifactId>
         <scope>test</scope>
         <version>7.4.2.Final</version>
         <!-- TODO: figure out this dependency issue -->
      </dependency>

      <dependency>
         <groupId>org.gatein.wci</groupId>
         <artifactId>wci-jboss7</artifactId>
         <version>${org.gatein.wci.version}</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>commons-lang</groupId>
         <artifactId>commons-lang</artifactId>
         <scope>test</scope>
      </dependency>

   </dependencies>

   <build>
      <plugins>
         <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
               <archive>
                  <manifestEntries>
                     <Dependencies>org.apache.cxf</Dependencies>
                  </manifestEntries>
               </archive>
            </configuration>
         </plugin>
         <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
               <finalName>producer</finalName>
               <outputDirectory>target/test-archives</outputDirectory>
            </configuration>
            <executions>
               <execution>
                  <phase>process-test-classes</phase>
                  <goals>
                     <goal>test-jar</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
               <systemPropertyVariables>
                  <JBOSS_HOME>${project.build.directory}/servers/jboss-as-${jbossas.version}</JBOSS_HOME>
               </systemPropertyVariables>
               <!--<includes>
                  <include>**/protocol/v2/MarkupTestCase.java</include>
               </includes>-->
            </configuration>
         </plugin>
      </plugins>
   </build>
</project>
