<!--
  #%L
  Gravia :: Integration Tests :: Tomcat
  %%
  Copyright (C) 2010 - 2014 JBoss by Red Hat
  %%
  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.
  #L%
  -->
<!--
    Set these VM properties in your IDE debugger 

    -Dlog4j.configuration=file://${workspace_loc:gravia-itests-tomcat}/src/test/resources/logging.properties
-->
<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">
    <modelVersion>4.0.0</modelVersion>
    
    <parent>
        <groupId>org.jboss.gravia</groupId>
        <artifactId>gravia-itests</artifactId>
        <version>1.1.0.Beta20</version>
    </parent>

    <name>Gravia :: Integration Tests :: Tomcat</name>
    
    <artifactId>gravia-itests-tomcat</artifactId>

	<!-- Properties -->
    <properties>
        <version.jboss.arquillian.core>1.0.0.Final</version.jboss.arquillian.core>
        <tomcat.home>${project.build.directory}/apache-tomcat-${version.apache.tomcat}</tomcat.home>
    </properties>
    
    <dependencies>
        
        <!-- Provided Dependencies -->
        <dependency>
	        <groupId>org.jboss.gravia</groupId>
	        <artifactId>gravia-itests-common</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        
        <!-- Test Dependencies -->
		<dependency>
			<groupId>org.jboss.arquillian.container</groupId>
			<artifactId>arquillian-tomcat-managed-7</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.arquillian.junit</groupId>
			<artifactId>arquillian-junit-container</artifactId>
			<scope>test</scope>
		</dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

	<build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>
		<plugins>
           	<plugin>
	            <artifactId>maven-dependency-plugin</artifactId>
	            <executions>
	                <execution>
	                    <id>unpack-tomcat</id>
	                    <phase>process-test-resources</phase>
	                    <goals>
	                        <goal>unpack</goal>
	                    </goals>
	                    <configuration>
	                        <artifactItems>
	                            <artifactItem>
	                                <groupId>org.apache.tomcat</groupId>
	                                <artifactId>tomcat</artifactId>
	                                <version>${version.apache.tomcat}</version>
                                    <type>tar.gz</type>
	                                <overWrite>false</overWrite>
	                                <outputDirectory>${project.build.directory}</outputDirectory>
	                            </artifactItem>
	                        </artifactItems>
	                    </configuration>
	                </execution>
	                <execution>
	                    <id>unpack-tomcat-patch</id>
	                    <phase>process-test-resources</phase>
	                    <goals>
	                        <goal>unpack</goal>
	                    </goals>
	                    <configuration>
	                        <artifactItems>
	                            <artifactItem>
	                                <groupId>org.jboss.gravia</groupId>
	                                <artifactId>gravia-container-tomcat-patch</artifactId>
	                                <version>${project.version}</version>
                                    <type>tar.gz</type>
	                                <overWrite>true</overWrite>
	                                <outputDirectory>${tomcat.home}</outputDirectory>
	                            </artifactItem>
	                        </artifactItems>
	                    </configuration>
	                </execution>
	            </executions>
	        </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <phase>process-test-resources</phase>
                        <configuration>
                            <target>
                                <copy file="src/test/resources/tomcat-users.xml" todir="${tomcat.home}/conf" overwrite="true" />
                                <copy file="src/test/resources/jaas.config" todir="${tomcat.home}/conf" overwrite="true" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
			<plugin>
			    <artifactId>maven-surefire-plugin</artifactId>
			    <configuration>
			        <argLine>${surefire.system.args}</argLine>
			        <redirectTestOutputToFile>false</redirectTestOutputToFile>
                    <reportNameSuffix>tomcat</reportNameSuffix>
                    <dependenciesToScan>
                        <dependency>org.jboss.gravia:gravia-itests-common</dependency>
                    </dependenciesToScan>
			        <systemPropertyVariables>
                        <!-- log4j.configuration>file://${basedir}/src/test/resources/logging.properties</log4j.configuration -->
                        <target.container>tomcat</target.container>
			        </systemPropertyVariables>
			    </configuration>
			</plugin>
	    </plugins>
	</build>
	
</project>
