<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors.
-
- 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.
-->
<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/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>org.jboss.integration.fuse</groupId>
      <artifactId>eap-release-parent</artifactId>
      <version>1.0.0.redhat-620123</version>
      <relativePath>../pom.xml</relativePath>
   </parent>

   <artifactId>fuse-integration-eap-tests</artifactId>
   <packaging>jar</packaging>
   <name>Fuse Integration: AS7 Release Distribution Tests</name>
   <description>Fuse BXMS Integration AS7 Release Distribution Tests</description>

   <properties>
      <temp.switchyard.unpack>${project.build.directory}/temp/switchyard-distro</temp.switchyard.unpack>
      <temp.fuse.integration.unpack>${project.build.directory}/temp/fuse-integration</temp.fuse.integration.unpack>
   </properties>
   <dependencies>
      <dependency>
         <groupId>org.switchyard</groupId>
         <artifactId>switchyard-test</artifactId>
      </dependency>
      <dependency>
         <groupId>org.switchyard</groupId>
         <artifactId>switchyard-remote</artifactId>
      </dependency>
      <dependency>
         <groupId>org.switchyard.components</groupId>
         <artifactId>switchyard-component-bean</artifactId>
      </dependency>
      <dependency>
         <groupId>org.switchyard.components</groupId>
         <artifactId>switchyard-component-jca</artifactId>
      </dependency>
      <dependency>
         <groupId>org.switchyard.components</groupId>
         <artifactId>switchyard-component-soap</artifactId>
      </dependency>
      <dependency>
         <groupId>org.switchyard.components</groupId>
         <artifactId>switchyard-component-test-mixin-hornetq</artifactId>
      </dependency>
      <dependency>
         <groupId>org.switchyard.components</groupId>
         <artifactId>switchyard-component-test-mixin-http</artifactId>
      </dependency>
      <dependency>
         <groupId>org.switchyard</groupId>
         <artifactId>switchyard-release-testutil</artifactId>
      </dependency>
      <dependency>
         <groupId>org.jboss.arquillian.junit</groupId>
         <artifactId>arquillian-junit-container</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.arquillian.container</groupId>
         <artifactId>arquillian-container-test-api</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.as</groupId>
         <artifactId>jboss-as-arquillian-container-managed</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.as</groupId>
         <artifactId>jboss-as-arquillian-common</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.as</groupId>
         <artifactId>jboss-as-arquillian-testenricher-msc</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.as</groupId>
         <artifactId>jboss-as-arquillian-protocol-jmx</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.shrinkwrap.descriptors</groupId>
         <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
         <scope>test</scope>
      </dependency>
      <!-- CXF client dependencies -->
      <dependency>
         <groupId>org.jboss.ws.cxf</groupId>
         <artifactId>jbossws-cxf-client</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.ws.cxf</groupId>
         <artifactId>jbossws-cxf-factories</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.ws.cxf</groupId>
         <artifactId>jbossws-cxf-transports-httpserver</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-rt-core</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-rt-frontend-simple</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-rt-frontend-jaxws</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-rt-bindings-soap</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-rt-bindings-xml</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-rt-databinding-jaxb</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-hl7</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-mina2</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.picketlink</groupId>
         <artifactId>picketlink-federation</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>

   <profiles>
      <profile>
         <id>default</id>
         <activation>
            <property>
               <name>!eap.home</name>
            </property>
         </activation>
         <properties>
            <eap.home>${project.build.directory}/jboss-eap-6.4</eap.home>
         </properties>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>wagon-maven-plugin</artifactId>
                  <version>1.0-beta-3</version>
                  <executions>
                     <execution>
                        <id>download-eap</id>
                        <phase>generate-sources</phase>
                        <goals>
                           <goal>download-single</goal>
                        </goals>
                        <configuration>
                           <url>${eap.download.url}</url>
                           <fromFile>${eap.download.url.path}</fromFile>
                           <toDir>${project.build.directory}</toDir>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-antrun-plugin</artifactId>
                  <version>1.6</version>
                  <executions>
                     <execution>
                        <id>prepare</id>
                        <phase>generate-sources</phase>
                        <configuration>
                           <tasks>
                              <echo message="Unzipping EAP"/>
                              <unzip src="${project.build.directory}/jboss-eap-6.4.0.Beta.zip"
                                     dest="${project.build.directory}"/>
                           </tasks>
                        </configuration>
                        <goals>
                           <goal>run</goal>
                        </goals>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>
   </profiles>


   <build>
      <testResources>
         <testResource>
            <directory>src/test/resources</directory>
            <filtering>true</filtering>
         </testResource>
      </testResources>
      <plugins>

         <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
               <execution>
                  <id>unpack-fuse-eap</id>
                  <phase>process-sources</phase>
                  <goals>
                     <goal>unpack</goal>
                  </goals>
                  <configuration>
                     <artifactItems>
                        <artifactItem>
                           <groupId>com.redhat.fuse</groupId>
                           <artifactId>fuse-eap-distro</artifactId>
                           <type>zip</type>
                           <version>${version.fuse.eap}</version>
                        </artifactItem>
                     </artifactItems>
                     <outputDirectory>${eap.home}</outputDirectory>
                  </configuration>
               </execution>
               <execution>
                  <id>install-as7-bpms-layer</id>
                  <phase>process-sources</phase>
                  <goals>
                     <goal>unpack</goal>
                  </goals>
                  <configuration>
                     <artifactItems>
                        <artifactItem>
                           <groupId>org.kie</groupId>
                           <artifactId>kie-eap-distributions-bpms-layer</artifactId>
                           <version>${version.org.kie}</version>
                           <type>zip</type>
                        </artifactItem>
                     </artifactItems>
                     <excludes>modules/layers.conf</excludes>
                     <outputDirectory>${eap.home}</outputDirectory>
                  </configuration>
               </execution>
               <execution>
                  <id>unpack-bundle</id>
                  <phase>process-sources</phase>
                  <goals>
                     <goal>unpack</goal>
                  </goals>
                  <configuration>
                     <artifactItems>
                        <artifactItem>
                           <groupId>org.jboss.integration.fuse</groupId>
                           <artifactId>fuse-integration-eap-distro</artifactId>
                           <type>zip</type>
                           <version>${project.version}</version>
                        </artifactItem>
                     </artifactItems>
                     <outputDirectory>${eap.home}</outputDirectory>
                  </configuration>
               </execution>
            </executions>
         </plugin>

         <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>exec-maven-plugin</artifactId>
           <version>1.4.0</version>
           <executions>
             <execution>
               <id>enabled-fuse-config</id>
               <phase>generate-resources</phase>
               <goals>
                 <goal>exec</goal>
               </goals>
               <configuration>
                 <executable>java</executable>
                 <arguments>
                   <argument>-jar</argument>
                   <argument>${eap.home}/bin/fuse-eap-config.jar</argument>
                   <argument>enable</argument>
                 </arguments>
               </configuration>
             </execution>
              <execution>
                <id>enabled-fuse-integration-config</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>java</executable>
                  <arguments>
                    <argument>-jar</argument>
                    <argument>${eap.home}/bin/fuse-integration-config.jar</argument>
                    <argument>enable</argument>
                  </arguments>
                </configuration>
              </execution>
           </executions>
         </plugin>

         <!-- Configure the Surefire plugin for running the tests.  Be sure to make these same setting if running in your IDE... -->
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
               <argLine>-Xms512m -Xmx512m</argLine>
               <environmentVariables>
                  <JBOSS_HOME>${eap.home}</JBOSS_HOME>
                  <SWITCHYARD_VERSION>${project.version}</SWITCHYARD_VERSION>
               </environmentVariables>
               <systemProperties>
                  <property>
                     <name>jboss.home</name>
                     <value>${eap.home}</value>
                  </property>
                  <property>
                     <name>module.path</name>
                     <value>${eap.home}/modules</value>
                  </property>
                  <property>
                     <name>server-config</name>
                     <value>standalone-full.xml</value>
                  </property>
                  <property>
                     <name>jboss.options</name>
                     <value>-Xms256m -Xmx1024m -XX:MaxPermSize=512m</value>
                  </property>
               </systemProperties>
               <trimStackTrace>false</trimStackTrace>
               <printSummary>true</printSummary>
               <forkMode>always</forkMode>
               <excludes>
                  <exclude>**/*$*</exclude>
               </excludes>
            </configuration>
         </plugin>

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