<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>
    <groupId>es.uvigo.esei.xcs</groupId>
    <artifactId>testing</artifactId>
    <version>0.1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    
    <name>Java :: Simple Project :: SonarQube Maven</name>
    
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <sonar.language>java</sonar.language>
        <sonar.jacoco.itReportPath>${project.build.directory}/itest.jacoco</sonar.jacoco.itReportPath>
        <jacoco.version>0.7.4.201502262128</jacoco.version>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
        
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.seleniumhq.selenium</groupId>
			<artifactId>selenium-java</artifactId>
			<version>2.47.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.jacoco</groupId>
			<artifactId>org.jacoco.agent</artifactId>
			<version>${jacoco.version}</version>
			<type>jar</type>
			<classifier>runtime</classifier>
			<scope>test</scope>
		</dependency>
    </dependencies>
    
    <distributionManagement>
		<repository>
			<id>deployment</id>
			<name>Internal Releases</name>
			<url>http://sing.ei.uvigo.es/dt/nexus/content/repositories/releases/</url>
		</repository>
		<snapshotRepository>
			<id>deployment</id>
			<name>Internal Releases</name>
			<url>http://sing.ei.uvigo.es/dt/nexus/content/repositories/snapshots/</url>
		</snapshotRepository>
    </distributionManagement>

	<build>
		<finalName>testing</finalName>
		<plugins>
			<plugin>
				<groupId>org.codehaus.cargo</groupId>
				<artifactId>cargo-maven2-plugin</artifactId>
				<version>1.4.15</version>
				<configuration>
					<container>
						<containerId>wildfly8x</containerId>
						<!-- home>/opt/wildfly/wildfly-9.0.1.Final/</home-->
						<zipUrlInstaller>
							<!-- url>http://download.jboss.org/wildfly/9.0.1.Final/wildfly-9.0.1.Final.zip</url-->
							<url>http://download.jboss.org/wildfly/8.2.1.Final/wildfly-8.2.1.Final.zip</url>
						</zipUrlInstaller>
					</container>
					<configuration>
						<properties>
							<cargo.servlet.port>9080</cargo.servlet.port>
							<cargo.jboss.ajp.port>9089</cargo.jboss.ajp.port>
							<cargo.jvmargs>-javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${project.build.directory}/itest.jacoco</cargo.jvmargs>
						</properties>
					</configuration>
				</configuration>
				<executions>
					<!-- start server before integration tests -->
					<execution>
						<id>start-container</id>
						<phase>pre-integration-test</phase>
						<goals>
							<goal>start</goal>
						</goals>
					</execution>
					<!-- stop server after integration tests -->
					<execution>
						<id>stop-container</id>
						<phase>post-integration-test</phase>
						<goals>
							<goal>stop</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.18.1</version>
				<configuration>
					<includes>
						<include>**/*UnitTestCase.java</include>
					</includes>
				</configuration>
			</plugin>
			
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
				<version>2.18.1</version>
				<configuration>
					<includes>
						<include>**/*IntegrationTestCase.java</include>
					</includes>
				</configuration>
				<executions>
					<execution>
						<id>integration-test</id>
						<goals>
							<goal>integration-test</goal>
						</goals>
					</execution>
					<execution>
						<id>verify</id>
						<goals>
							<goal>verify</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>