<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.rhq</groupId>
    <artifactId>rhq-parent</artifactId>
    <version>4.5.1</version>
    <relativePath>../../../../pom.xml</relativePath>
  </parent>

  <artifactId>rhq-server-itests</artifactId>

  <name>RHQ Server Integration Tests</name>
  <description>RHQ enterprise server integration tests</description>

  <scm>
    <connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/itests/</connection>
    <developerConnection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/itests/</developerConnection>
  </scm>

  <properties>
    <rhq.server.datasource>java:/RHQDS</rhq.server.datasource>
    <rhq.server.ds-mapping>PostgreSQL</rhq.server.ds-mapping>
    <jboss-embeddable-ejb3.version>1.0.0.Alpha9</jboss-embeddable-ejb3.version>
  </properties>

  <dependencies>
      <!--================ Test Deps ================-->

      <!-- Note, the test deps are intentionally placed above the other scoped deps because of classpath
           reasons.  Maven orders the [test] classpath in the order listed in the pom.  We specifically
           need the embeddable-ejb3 jar above the standard ejb3 jars because we need the embeddble packages
           loaded when testing.  -->

      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>test-utils</artifactId>
         <version>${project.version}</version>
         <scope>test</scope>
         <exclusions>
            <exclusion>
               <groupId>org.testng</groupId>
               <artifactId>testng</artifactId>
            </exclusion>
         </exclusions>
      </dependency>

      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>rhq-core-domain</artifactId>
         <version>${project.version}</version>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>rhq-container-lib</artifactId>
         <version>${project.version}</version>
         <scope>test</scope>
      </dependency>
      
      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>rhq-enterprise-server</artifactId>
         <version>${project.version}</version>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>rhq-enterprise-server</artifactId>
         <version>${project.version}</version>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>rhq-core-client-api</artifactId>
         <version>${project.version}</version>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>rhq-script-bindings</artifactId>
         <version>${project.version}</version>
         <scope>test</scope>
         <exclusions>
            <exclusion>
                <groupId>org.rhq</groupId>
                <artifactId>rhq-enterprise-server</artifactId>
            </exclusion>
         </exclusions>
      </dependency>
      
      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>rhq-scripting-javascript</artifactId>
         <version>${project.version}</version>
         <scope>test</scope>
      </dependency>
      
      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>rhq-server-client-api</artifactId>
         <version>${project.version}</version>
         <scope>test</scope>
         <exclusions>
            <exclusion>
                <groupId>org.rhq</groupId>
                <artifactId>rhq-enterprise-server</artifactId>
            </exclusion>
         </exclusions>
      </dependency>
      
      <dependency>
        <groupId>org.rhq.helpers</groupId>
        <artifactId>perftest-support</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
        <exclusions>
          <exclusion>
            <groupId>ant</groupId>
            <artifactId>ant</artifactId>
          </exclusion>
          <exclusion>
            <groupId>ant</groupId>
            <artifactId>ant-launcher</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <dependency>
         <groupId>jboss.jboss-embeddable-ejb3</groupId>
         <artifactId>jboss-ejb3-all</artifactId>
         <version>${jboss-embeddable-ejb3.version}</version>
         <scope>test</scope>
      </dependency>

      <!-- Shrinkwrap to build up test plugins etc. -->
      <dependency>
          <groupId>org.jboss.shrinkwrap</groupId>
          <artifactId>shrinkwrap-api</artifactId>
      </dependency>
 
      <dependency>
          <groupId>org.jboss.shrinkwrap</groupId>
          <artifactId>shrinkwrap-impl-base</artifactId>
          <scope>compile</scope>
      </dependency>
      
      <!-- NOTE: The remaining test deps correspond to the classes contained in hibernate-all.jar and thirdparty-all.jar. -->

      <dependency>
         <groupId>javassist</groupId>
         <artifactId>javassist</artifactId>
         <scope>test</scope>
      </dependency>

      <!-- needed by embedded ejb container -->
      <dependency>
         <groupId>trove</groupId>
         <artifactId>trove</artifactId>
         <version>1.0.2</version>
         <scope>test</scope>
      </dependency>

      <!-- needed by embedded ejb container -->
      <dependency>
         <groupId>xerces</groupId>
         <artifactId>xercesImpl</artifactId>
         <version>${xercesImpl.version}</version>
         <scope>test</scope>
      </dependency>

      <!-- 3rd Party Deps -->

      <!-- required by RHQ server classes, as well as EJB3 Embedded -->
      <dependency>
         <groupId>dom4j</groupId>
         <artifactId>dom4j</artifactId>
         <version>1.6.1-jboss</version>
         <scope>runtime</scope>
      </dependency>

      <dependency>
         <groupId>hibernate</groupId>
         <artifactId>hibernate3</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>hibernate-annotations</groupId>
         <artifactId>hibernate-annotations</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>hibernate-entitymanager</groupId>
         <artifactId>hibernate-entitymanager</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4</version>
      </dependency>

      <dependency>
         <groupId>javax.persistence</groupId>
         <artifactId>persistence-api</artifactId>
         <version>1.0</version>
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
         <version>2.4</version>
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>jboss</groupId>
         <artifactId>jboss-annotations-ejb3</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <!-- includes the org.jboss.ejb3.StrictMaxPool class, which is needed by the PoolClass annotation used on some
           of our SLSB's -->
      <dependency>
         <groupId>jboss</groupId>
         <artifactId>jboss-ejb3</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <!-- for the transaction interrupt EJB3 interceptor -->
      <dependency>
         <groupId>org.jboss.transaction</groupId>
         <artifactId>jboss-jta</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>org.opensymphony.quartz</groupId>
         <artifactId>quartz</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
      </dependency>

      <dependency>
         <groupId>org.opensymphony.quartz</groupId>
         <artifactId>quartz-oracle</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
      </dependency>

      <!-- This is needed cglib which is in turn needed by hibernate -->
      <dependency>
         <groupId>org.easymock</groupId>
         <artifactId>easymockclassextension</artifactId>
         <version>2.2</version>
         <scope>test</scope>
      </dependency>

       <dependency>
           <groupId>org.freemarker</groupId>
           <artifactId>freemarker</artifactId>
           <version>2.3.18</version>
           <scope>provided</scope>
       </dependency>

     <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxrs</artifactId>
        <version>${resteasy.version}</version>
     </dependency>
  
     <!-- Dependencies for RHQ components needed for integration tests -->
     <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>rhq-serverplugin-drift</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
     </dependency>

    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-testng</artifactId>
      <version>${powermock.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-api-mockito</artifactId>
      <version>${powermock.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>


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

    <plugins>
    <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
               <!--  in order to get JMS to work properly in embedded test container, extract jms-rs.rar classes -->
               <execution>
                  <id>Extract JMS classes from RAR needed for JMS tests</id>
                  <phase>process-classes</phase>
                  <configuration>
                     <target>
                        <unzip src="src/test/resources/jms-ra.rar" dest="target">
                           <patternset>
                              <include name="jms-ra.jar"/>
                           </patternset>
                        </unzip>
                        <unzip src="target/jms-ra.jar" dest="target/test-classes">
                           <patternset>
                              <include name="org/**"/>
                           </patternset>
                        </unzip>
                     </target>
                  </configuration>
                  <goals>
                     <goal>run</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
                <!-- Everything but the web service tests, this is the standard test execution -->
               <configuration>
                   <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
                   <groups>${rhq.testng.includedGroups}</groups>
                   <properties>
                       <property>
                          <name>listener</name>
                          <value>org.rhq.test.testng.StdoutReporter</value>
                       </property>
                   </properties>
                   <systemPropertyVariables>
                      <embeddedDeployment>true</embeddedDeployment>
                      <deploymentDirectory>target/test-classes</deploymentDirectory>
                      <hibernate.dialect>${rhq.test.ds.hibernate-dialect}</hibernate.dialect>
                   </systemPropertyVariables>
                   <systemProperties>
                      <property>
                         <name>projectVersion</name>
                         <value>${project.version}</value>
                      </property>
                   </systemProperties>
                   <argLine>-Djava.security.manager -Djava.security.policy==${basedir}/target/test-classes/security.policy</argLine>
                   <additionalClasspathElements>
                      <!-- The below is required for tests to run against Oracle. -->
                      <additionalClasspathElement>${settings.localRepository}/com/oracle/ojdbc6/${ojdbc6.version}/ojdbc6-${ojdbc6.version}.jar</additionalClasspathElement>
                   </additionalClasspathElements>
                </configuration>
         </plugin>
    </plugins>
  </build>
</project>
