<?xml version="1.0"?>
<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.seam.rest</groupId>
		<artifactId>seam-rest-parent</artifactId>
		<version>3.0.0.Alpha3</version>
		<relativePath>../../pom.xml</relativePath>
	</parent>

	<groupId>org.jboss.seam.rest</groupId>
	<artifactId>seam-tasks-example</artifactId>
	<packaging>war</packaging>
	<version>3.0.0.Alpha3</version>
	<name>Seam Tasks Example</name>

	<properties>
		<resteasy.version>2.0.1.GA</resteasy.version>
		<!-- test properties -->
		<selenium.java.client.version>1.0.1</selenium.java.client.version>
		<richfaces.selenium.version>1.5.1.Final</richfaces.selenium.version>
		<ftest.version.discriminator />
		<selenium.browser>*firefoxproxy</selenium.browser>
		<selenium.browser.url>http://localhost:8080</selenium.browser.url>
		<selenium.server.port>14444</selenium.server.port>
		<selenium.server.host>localhost</selenium.server.host>
		<selenium.speed>0</selenium.speed>
		<selenium.timeout>30000</selenium.timeout>
		<selenium.debug>false</selenium.debug>
		<selenium.log.dir>${project.build.directory}/ftest</selenium.log.dir>
		<application.deploy.timeout>300</application.deploy.timeout>
		<richfaces.selenium.version>1.5.1.Final</richfaces.selenium.version>
		<!-- richfaces-selenium -->
		<browserSessionReuse>true</browserSessionReuse>
		<cargo.jvmargs.additional />
		<cargo.timeout.deploy>120000</cargo.timeout.deploy>
		<context.host>localhost</context.host>
		<context.root>http://${context.host}:8080/</context.root>
		<context.path>/${project.build.finalName}/</context.path>
		<context.deploy.path>${context.path}</context.deploy.path>
		<jboss.master.configuration>${env.JBOSS_HOME}/server/all
		</jboss.master.configuration>
		<deployable.location />
		<deployable.type>war</deployable.type>
		<method>*</method>
		<selenium.maximize>false</selenium.maximize>
		<selenium.timeout.ajax>15000</selenium.timeout.ajax>
		<selenium.timeout.default>30000</selenium.timeout.default>
		<selenium.timeout.gui>5000</selenium.timeout.gui>
		<selenium.timeout.model>30000</selenium.timeout.model>
		<ftest.suite.xml>ftests.xml</ftest.suite.xml>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.jboss.seam.servlet</groupId>
			<artifactId>seam-servlet-api</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.jboss.seam.servlet</groupId>
			<artifactId>seam-servlet-impl</artifactId>
			<scope>provided</scope>
		</dependency>
	
		<!-- APIs -->
		<dependency>
			<groupId>javax.ws.rs</groupId>
			<artifactId>jsr311-api</artifactId>
		</dependency>

		<dependency>
			<groupId>org.hibernate.javax.persistence</groupId>
			<artifactId>hibernate-jpa-2.0-api</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.jboss.spec.javax.ejb</groupId>
			<artifactId>jboss-ejb-api_3.1_spec</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.jboss.spec.javax.servlet</groupId>
			<artifactId>jboss-servlet-api_3.0_spec</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Runtime dependencies -->
		<dependency>
			<groupId>org.jboss.seam.config</groupId>
			<artifactId>seam-config-xml</artifactId>
		</dependency>

		<dependency>
			<groupId>org.jboss.seam.rest</groupId>
			<artifactId>seam-rest-api</artifactId>
		</dependency>
		
		<dependency>
			<groupId>org.jboss.seam.rest</groupId>
			<artifactId>seam-rest-impl</artifactId>
		</dependency>

		<dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-jaxrs</artifactId>
		</dependency>
		<dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-xc</artifactId>
		</dependency>

		<dependency>
			<groupId>org.freemarker</groupId>
			<artifactId>freemarker</artifactId>
			<scope>compile</scope>
		</dependency>

		<!-- WELDX depends on this -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
		</dependency>

		<!-- Test dependencies -->
		<dependency>
			<groupId>org.seleniumhq.selenium.client-drivers</groupId>
			<artifactId>selenium-java-client-driver</artifactId>
			<version>${selenium.java.client.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.test</groupId>
			<artifactId>richfaces-selenium</artifactId>
			<version>${richfaces.selenium.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.testng</groupId>
			<artifactId>testng</artifactId>
		</dependency>
	</dependencies>

	<build>
		<finalName>seam-tasks</finalName>
		<plugins>
			<plugin>
				<!-- no unit tests, surefire would instead run functional tests in incorrect 
					phase -->
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>selenium-maven-plugin</artifactId>
				<version>1.0.1</version>
			</plugin>
			<plugin>
				<groupId>org.codehaus.cargo</groupId>
				<artifactId>cargo-maven2-plugin</artifactId>
				<version>1.0</version>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>failsafe-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>catch</id>
			<dependencies>
				<dependency>
					<groupId>org.jboss.seam.catch</groupId>
					<artifactId>seam-catch-api</artifactId>
				</dependency>
				<dependency>
					<groupId>org.jboss.seam.catch</groupId>
					<artifactId>seam-catch-impl</artifactId>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>jboss-remote-6</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.cargo</groupId>
						<artifactId>cargo-maven2-plugin</artifactId>
						<configuration>
							<container>
								<containerId>jboss5x</containerId>
								<type>remote</type>
							</container>
							<configuration>
								<type>runtime</type>
							</configuration>
						</configuration>
						<executions>
							<execution>
								<id>deploy</id>
								<phase>pre-integration-test</phase>
								<goals>
									<goal>deploy</goal>
								</goals>
							</execution>
							<execution>
								<id>undeploy</id>
								<phase>post-integration-test</phase>
								<goals>
									<goal>undeploy</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>ftest-jboss-remote-6</id>
			<build>
				<plugins>
					<!-- Deploy/undeploy -->
					<plugin>
						<groupId>org.codehaus.cargo</groupId>
						<artifactId>cargo-maven2-plugin</artifactId>
						<configuration>
							<container>
								<containerId>jboss5x</containerId>
								<type>remote</type>
							</container>
							<configuration>
								<type>runtime</type>
							</configuration>
						</configuration>
						<executions>
							<execution>
								<id>deploy</id>
								<phase>pre-integration-test</phase>
								<goals>
									<goal>deploy</goal>
								</goals>
							</execution>
							<execution>
								<id>undeploy</id>
								<phase>post-integration-test</phase>
								<goals>
									<goal>undeploy</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>ftest</id>
			<build>
				<defaultGoal>verify</defaultGoal>
				<plugins>
					<!-- Start Selenium -->
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>selenium-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>start-selenium</id>
								<phase>pre-integration-test</phase>
								<goals>
									<goal>start-server</goal>
								</goals>
								<configuration>
									<background>true</background>
									<port>${selenium.server.port}</port>
									<logOutput>true</logOutput>
									<logFile>${selenium.log.dir}/selenium-server.log</logFile>
									<browserSideLog>${selenium.debug}</browserSideLog>
									<debug>${selenium.debug}</debug>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>failsafe-maven-plugin</artifactId>
						<configuration>
							<suiteXmlFiles>
								<suiteXmlFile>${basedir}/${ftest.suite.xml}</suiteXmlFile>
							</suiteXmlFiles>
							<argLine>-Xmx748m</argLine>
							<forkMode>once</forkMode>
							<systemProperties>
								<property>
									<name>method</name>
									<value>${method}</value>
								</property>
								<property>
									<name>browser</name>
									<value>${selenium.browser}</value>
								</property>
								<property>
									<name>context.root</name>
									<value>${context.root}</value>
								</property>
								<property>
									<name>context.path</name>
									<value>${context.path}</value>
								</property>
								<property>
									<name>selenium.host</name>
									<value>${selenium.server.host}</value>
								</property>
								<property>
									<name>selenium.port</name>
									<value>${selenium.server.port}</value>
								</property>
								<property>
									<name>selenium.debug</name>
									<value>${selenium.debug}</value>
								</property>
								<property>
									<name>selenium.maximize</name>
									<value>${selenium.maximize}</value>
								</property>
								<property>
									<name>maven.resources.dir</name>
									<value>${resources.dir}</value>
								</property>
								<property>
									<name>maven.project.build.directory</name>
									<value>${project.build.directory}</value>
								</property>
								<property>
									<name>selenium.timeout.default</name>
									<value>${selenium.timeout.default}</value>
								</property>
								<property>
									<name>selenium.timeout.gui</name>
									<value>${selenium.timeout.gui}</value>
								</property>
								<property>
									<name>selenium.timeout.ajax</name>
									<value>${selenium.timeout.ajax}</value>
								</property>
								<property>
									<name>selenium.timeout.model</name>
									<value>${selenium.timeout.model}</value>
								</property>
								<property>
									<name>selenium.speed</name>
									<value>${selenium.speed}</value>
								</property>
								<property>
									<name>selenium.timeout</name>
									<value>${selenium.timeout}</value>
								</property>
								<property>
									<name>basedir</name>
									<value>${basedir}</value>
								</property>
							</systemProperties>
						</configuration>
						<executions>
							<execution>
								<id>verify</id>
								<phase>verify</phase>
								<goals>
									<goal>verify</goal>
								</goals>
							</execution>
							<execution>
								<id>integration-test</id>
								<phase>integration-test</phase>
								<goals>
									<goal>integration-test</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<!-- Stop Selenium -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<!-- this ant script runs testng natively -->
								<id>stop-selenium</id>
								<phase>post-integration-test</phase>
								<configuration>
									<tasks>
										<echo taskname="selenium-shutdown" message="DGF Errors during shutdown are expected" />
										<get taskname="selenium-shutdown" src="http://${selenium.server.host}:${selenium.server.port}/selenium-server/driver/?cmd=shutDownSeleniumServer" ignoreerrors="true" dest="${selenium.log.dir}/selenium.stop.msg" />
									</tasks>
								</configuration>
								<goals>
									<goal>run</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>resin</id>
			<dependencies>
				<dependency>
					<groupId>org.jboss.resteasy</groupId>
					<artifactId>resteasy-jaxb-provider</artifactId>
				</dependency>

				<dependency>
					<groupId>org.jboss.resteasy</groupId>
					<artifactId>resteasy-jaxrs</artifactId>
				</dependency>

				<dependency>
					<groupId>org.jboss.resteasy</groupId>
					<artifactId>resteasy-cdi</artifactId>
				</dependency>

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

				<!-- Does not work on Resin ATM -->
				<dependency>
					<groupId>org.jboss.seam.xml</groupId>
					<artifactId>seam-xml-config</artifactId>
					<scope>provided</scope>
				</dependency>
			</dependencies>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-war-plugin</artifactId>
						<configuration>
							<webResources>
								<resource>
									<directory>src/main/resin</directory>
								</resource>
							</webResources>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>jboss-as</id>
			<!-- Excluded dependencies -->
			<dependencies>
				<dependency>
					<groupId>org.jboss.logging</groupId>
					<artifactId>jboss-logging</artifactId>
					<scope>provided</scope>
				</dependency>
				<dependency>
					<groupId>org.codehaus.jackson</groupId>
					<artifactId>jackson-jaxrs</artifactId>
					<scope>provided</scope>
				</dependency>
				<dependency>
					<groupId>org.codehaus.jackson</groupId>
					<artifactId>jackson-xc</artifactId>
					<scope>provided</scope>
				</dependency>
				<dependency>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-api</artifactId>
					<scope>provided</scope>
				</dependency>
				<dependency>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-simple</artifactId>
					<scope>provided</scope>
				</dependency>

			</dependencies>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-war-plugin</artifactId>
						<configuration>
							<webResources>
								<resource>
									<directory>src/main/jboss</directory>
								</resource>
							</webResources>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>distribution</id>
			<activation>
				<property>
					<name>release</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-assembly-plugin</artifactId>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>

