<?xml version="1.0" encoding="UTF-8"?>
<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">

<!--
	The database dependent tests are meant to be run on their own, not as part of the continous or nightly
	build for Teiid.   
-->

	<parent>
		<artifactId>teiid-test-integration</artifactId>
		<groupId>org.jboss.teiid</groupId>
        <version>8.10.0.Final</version>
	</parent>

	<modelVersion>4.0.0</modelVersion>
	<artifactId>test-integration-db</artifactId>

	<name>DB Dependent Integration Tests</name>
 	<groupId>org.jboss.teiid.teiid-test-integration</groupId>
	<description>Integration tests that require external database dependencies </description>
	<dependencies>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
		</dependency>
	
        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>jta</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.teiid</groupId>
            <artifactId>teiid-client</artifactId>
        </dependency>
			
		<dependency>
			<groupId>org.jboss.teiid</groupId>
			<artifactId>teiid-client</artifactId>
			<type>test-jar</type>
			<scope>compile</scope>
		</dependency>

        <dependency>
            <groupId>org.jboss.teiid</groupId>
            <artifactId>teiid-common-core</artifactId>
        </dependency>

		<dependency>
			<groupId>org.jboss.teiid</groupId>
			<artifactId>teiid-common-core</artifactId>
			<type>test-jar</type>
			<scope>compile</scope>
		</dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>
            
		<dependency>
			<groupId>org.jboss.teiid</groupId>
			<artifactId>teiid-engine</artifactId>
			<type>test-jar</type>
			<scope>compile</scope>
		</dependency> 
		
		<dependency>
			<groupId>org.jboss.teiid</groupId>
			<artifactId>test-integration-common</artifactId>
			<type>test-jar</type>
			<scope>compile</scope>
		</dependency> 

		<dependency>
			<groupId>org.apache.ant</groupId>
			<artifactId>ant</artifactId>
		</dependency>
        
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
        </dependency>         

		<dependency>
			<groupId>org.apache.ant</groupId>
			<artifactId>ant-launcher</artifactId>
		</dependency>
		<dependency>
			<groupId>ant-contrib</groupId>
			<artifactId>ant-contrib</artifactId>
		</dependency>

		<dependency>
			<groupId>ant-contrib</groupId>
			<artifactId>cpptasks</artifactId>
		</dependency>

	<!-- DBUnit dependencies -->
		
		<dependency>
			<groupId>org.dbunit</groupId>
			<artifactId>dbunit</artifactId>
		</dependency>

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

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi</artifactId>
		</dependency>

		<dependency>
				<groupId>org.jdom</groupId>
				<artifactId>jdom</artifactId>
		</dependency>

		<dependency>
			<groupId>postgresql</groupId>
			<artifactId>postgresql</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.derby</groupId>
			<artifactId>derby</artifactId>
		</dependency>
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
		</dependency>

	</dependencies>	

	 <profiles>
        <profile>
          <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>

          <build>
            <plugins>
      <!-- Specify the compiler options and settings -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <showDeprecation>false</showDeprecation>
                    <showWarnings>false</showWarnings>
                </configuration>
            </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                            <skip>true</skip>
                    </configuration>
                </plugin>   

                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptors>
                                <descriptor>src/assembly/binaries.xml</descriptor>
                            </descriptors>
                            <outputDirectory>target/distribution</outputDirectory>
                            <workDirectory>target/assembly/work</workDirectory>
                        </configuration>
                        <executions>
                            <execution>
                                <id>make-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>attached</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
            </plugins>
        </build>
    </profile>


	    <profile>
	      <id>runalltests</id>
	      <build>
			<plugins>
			
			<plugin>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
		          <additionalClasspathElements>
		                <additionalClasspathElement>${basedir}/lib/ojdbc6.jar</additionalClasspathElement>
		                <additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
		                <additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>

		          </additionalClasspathElements>
		          <systemProperties>
		            <property>
		              <name>usedatasources</name>
		              <value>${usedatasources}</value>
		            </property>
		            <property>
		              <name>datasourceloc</name>
		              <value>${datasourceloc}</value>
		            </property>
		          </systemProperties>
				
<!-- 
<forkMode>always</forkMode>
					<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
			-->
					<includes>
			<!--			<include>**/*TestCase.java</include> -->
						<include>**/*Test.java</include>
						<include>**/*Tests.java</include>
						<include>**/Test*.java</include>
					</includes>
					<excludes>
						<exclude>**/*Abstract*TestCase.java</exclude>
						<exclude>**/*Abstract*Test.java</exclude>
			<!-- hack to prevent anonymous inner classes in Tests from being run as tests -->
						<exclude>**/Test*$*.java</exclude>
					</excludes>

				</configuration>
			</plugin>

			</plugins>

	      </build>

<!-- 		        <version>2.4.2</version> -->

		  <reporting>
		    <plugins>
		      <plugin>
		        <groupId>org.apache.maven.plugins</groupId>
		        <artifactId>maven-surefire-report-plugin</artifactId>

		        <configuration>
		           <outputDirectory>${basedir}/target/newsite</outputDirectory>
		        </configuration>
		      </plugin>
		    </plugins>
		  </reporting>
	    </profile>

	    <profile>
	      <id>runsingletest</id>
            <activation>
                <property>
                    <name>classname</name>
                </property>
            </activation>
	      <build>
			<plugins>

			<plugin>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>    		
		          <additionalClasspathElements>
		                <additionalClasspathElement>${basedir}/lib/ojdbc6.jar</additionalClasspathElement>
		                <additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
		                <additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
 		          </additionalClasspathElements>
		          <systemProperties>
		            <property>
		              <name>usedatasources</name>
		              <value>${usedatasources}</value>
		            </property>
		            <property>
		              <name>datasourceloc</name>
		              <value>${datasourceloc}</value>
		            </property>
		          </systemProperties>

<!--
					<forkMode>always</forkMode>

					<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
	-->				
					<includes>
						<include>**/${classname}.java</include>
					</includes>

				</configuration>
			</plugin>

			</plugins>
	      </build>
	    </profile>


	    <profile>
	      <id>setupdatasources</id>
	      <build>
	        <plugins>

    	<plugin>
      		<groupId>org.apache.maven.plugins</groupId>
      		<artifactId>maven-surefire-plugin</artifactId>
      		<configuration>
        			<skip>true</skip>
     		</configuration>
    	</plugin>
	          <plugin>
	          	<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-antrun-plugin</artifactId>
					<dependencies>
						<dependency>
							<groupId>org.apache.ant</groupId>
							<artifactId>ant</artifactId>
							<version>${apache.ant.version}</version>
						</dependency>
					</dependencies>
				<configuration>
				</configuration>
					<executions>
						<execution>
							<id>setupalldatasources</id>
							<phase>pre-integration-test</phase>
							<configuration>
								<tasks>
									<property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
									<property name="relative.resources.dir" value="src/main/resources" />
									<property name="datasourceloc" value="${datasourceloc}" />
									<ant antfile="src/main/resources/ddl/manage_schemas.xml" />
								</tasks>
							</configuration>
							<goals>
								<goal>run</goal>
							</goals>
						</execution>
	            </executions>
	          </plugin>


	        </plugins>
	      </build>
	    </profile>
	    <profile>
	      <id>singledatasource</id>
    		<activation>
      			<property>
       		 		<name>datasource</name>
      			</property>
    		</activation>
	      <build>
	        <plugins>

    	<plugin>
      		<groupId>org.apache.maven.plugins</groupId>
      		<artifactId>maven-surefire-plugin</artifactId>
      		<configuration>
        			<skip>true</skip>
     		</configuration>
    	</plugin>
	          <plugin>
	          	<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-antrun-plugin</artifactId>
					<dependencies>
						<dependency>
							<groupId>org.apache.ant</groupId>
							<artifactId>ant</artifactId>
							<version>${apache.ant.version}</version>
						</dependency>
					</dependencies>
	            <configuration>

	            </configuration>
					<executions>
						<execution>
							<id>setupsingledatasource</id>
							<phase>pre-integration-test</phase>
							<configuration>
								<tasks>

									<property name="single" value="${datasource}" />
									<property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
									<property name="datasourceloc" value="${datasourceloc}" />

									<property name="relative.resources.dir" value="src/main/resources" />
									<ant antfile="src/main/resources/ddl/manage_schemas.xml" />
								</tasks>
							</configuration>
							<goals>
								<goal>run</goal>
							</goals>
						</execution>
	            </executions>
	          </plugin>


	        </plugins>
	      </build>
	    </profile>


		<profile>
	      <id>runclienttests</id>
    		<activation>
      			<property>
       		 		<name>scenario.dir</name>
      			</property>
    		</activation>
			<build>
				<plugins>

    	<plugin>
      		<groupId>org.apache.maven.plugins</groupId>
      		<artifactId>maven-surefire-plugin</artifactId>
      		<configuration>
        			<skip>true</skip>
     		</configuration>
    	</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<dependencies>
					<dependency>
						<groupId>org.apache.ant</groupId>
						<artifactId>ant</artifactId>
						<version>${apache.ant.version}</version>
					</dependency>
				</dependencies>
				<executions>
					<execution>
						<id>run-client-test</id>
						<phase>integration-test</phase>
						<configuration>
							<tasks>
								
								<property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
								<property name="scenario.dir" value="${scenario.dir}" />
								<property name="queryset.artifacts.dir" value="${queryset.artifacts.dir}" />
								<property name="vdb.artifacts.dir" value="${vdb.artifacts.dir}" />
								<!-- optional properties -->
								<property name="config.file" value="${config.file}" />
								<property name="query.scenario.classname" value="${query.scenario.classname}" />
								<property name="proj.dir" value="${project.basedir}/target/" />
								<property name="usedatasources" value="${usedatasources}" />
								<property name="datasourceloc" value="${datasourceloc}" />

								<ant antfile="src/main/resources/ctc_tests/ctc.xml" />

							</tasks>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
					
				</executions>
			</plugin>
				</plugins>
			</build>

		</profile>

		<profile>
			<id>assemble</id>
<!-- assemble will compile, but not run the tests prior to assemblying the kit -->

			<build>
			<plugins>

		    	<plugin>
		      		<groupId>org.apache.maven.plugins</groupId>
		      		<artifactId>maven-surefire-plugin</artifactId>
		      		<configuration>
		        			<skip>true</skip>
		     		</configuration>
		    	</plugin>	

				<plugin>
					<artifactId>maven-assembly-plugin</artifactId>
					<configuration>
						<descriptors>
							<descriptor>src/assembly/binaries.xml</descriptor>
						</descriptors>
						<outputDirectory>target/distribution</outputDirectory>
						<workDirectory>target/work/assembly</workDirectory>

					</configuration>
					<executions>

						<execution>
							<id>make-assembly</id>
							<phase>package</phase>
							<goals>
								<goal>attached</goal>
							</goals>
						</execution>
					</executions>
				</plugin>

				</plugins>
			</build>
		</profile>

	</profiles>


</project>