<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>
	<artifactId>arquillian-extension-liferay</artifactId>
	<groupId>org.arquillian.liferay</groupId>
	<version>1.0.0.Alpha2</version>
	<relativePath>../pom.xml</relativePath>
</parent>

	<groupId>org.arquillian.liferay</groupId>
	<artifactId>arquillian-liferay-extension-example</artifactId>
	<version>1.0.0.Alpha2</version>
	<name>Arquillian Liferay Extension Example</name>
	<description>Arquillian Liferay Extension Example</description>

	<properties>
		<test.resources>src/test/resources</test.resources>
		<arquillian.liferay.bundle>${project.basedir}/../../arquillian-liferay-bundle</arquillian.liferay.bundle>
		<liferay.home>${arquillian.liferay.bundle}/liferay-portal-7.0-ce-a3</liferay.home>
		<liferay.version>7.0.0-a3</liferay.version>
		<url.liferay><![CDATA[http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/7.0.0%20A3/liferay-portal-tomcat-7.0-ce-a3-20151119130239619.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flportal%2Ffiles%2FLiferay%2520Portal%2F7.0.0%2520A3%2F&ts=1448364010&use_mirror=netcologne]]></url.liferay>
		<browser>phantomjs</browser>
	</properties>

	<profiles>
		<profile>
			<id>download-test-environment</id>
			<activation>
				<file>
					<missing>../../arquillian-liferay-bundle/unziped-successfully</missing>
				</file>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>com.googlecode.maven-download-plugin</groupId>
						<artifactId>download-maven-plugin</artifactId>
						<version>1.2.1</version>
						<executions>
							<execution>
								<id>download-liferay</id>
								<phase>generate-test-sources</phase>
								<goals>
									<goal>wget</goal>
								</goals>
								<configuration>
									<url>${url.liferay}</url>
									<outputDirectory>${arquillian.liferay.bundle}/zip/</outputDirectory>
									<outputFileName>liferay.zip</outputFileName>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<version>1.6</version>
						<executions>
							<execution>
								<id>unzip-liferay</id>
								<phase>process-test-sources</phase>
								<configuration>
									<target>
										<echo message="unzip Liferay" />
										<unzip src="${arquillian.liferay.bundle}/zip/liferay.zip" dest="${arquillian.liferay.bundle}" />
										<chmod dir="${liferay.home}/tomcat-7.0.62/bin/" perm="ugo+rx" includes="**/*.sh" />
									</target>
								</configuration>
								<goals>
									<goal>run</goal>
								</goals>
							</execution>
							<execution>
								<id>disable-open-browser</id>
								<phase>process-test-sources</phase>
								<configuration>
									<target>
										<echo file="${liferay.home}/portal-ext.properties">browser.launcher.url=</echo>
									</target>
								</configuration>
								<goals>
									<goal>run</goal>
								</goals>
							</execution>
							<execution>
								<id>create-file</id>
								<phase>process-test-sources</phase>
								<configuration>
									<target>
										<touch file="${arquillian.liferay.bundle}/unziped-successfully" />
									</target>
								</configuration>
								<goals>
									<goal>run</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>windows-profile</id>
			<activation>
				<os>
					<family>windows</family>
				</os>
			</activation>
			<properties>
				<liferay.executable.start>${liferay.home}/tomcat-7.0.62/bin/startup.bat</liferay.executable.start>
				<liferay.executable.stop>${liferay.home}/tomcat-7.0.62/bin/shutdown.bat</liferay.executable.stop>
			</properties>
		</profile>
		<profile>
			<id>unix-profile</id>
			<activation>
				<os>
					<family>unix</family>
				</os>
			</activation>
			<properties>
				<liferay.executable.start>${liferay.home}/tomcat-7.0.62/bin/startup.sh</liferay.executable.start>
				<liferay.executable.stop>${liferay.home}/tomcat-7.0.62/bin/shutdown.sh</liferay.executable.stop>
			</properties>
		</profile>
		<profile>
			<id>firefox</id>
			<properties>
				<browser>firefox</browser>
			</properties>
		</profile>
		<profile>
			<id>chrome</id>
			<properties>
				<browser>chrome</browser>
			</properties>
		</profile>
		<profile>
			<id>start-tomcat</id>
			<activation>
				<property>
					<name>!skipStartTomcat</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>1.1</version>
						<executions>
							<execution>
								<id>clean-tomcat</id>
								<phase>test-compile</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
									<executable>${liferay.executable.stop}</executable>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>1.1</version>
						<executions>
							<execution>
								<id>start-tomcat</id>
								<phase>test-compile</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
									<executable>${liferay.executable.start}</executable>
								</configuration>
							</execution>
							<execution>
								<id>stop-tomcat</id>
								<phase>test</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
									<executable>${liferay.executable.stop}</executable>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>wait-maven-plugin</artifactId>
						<version>1.0</version>
						<executions>
							<execution>
								<id>tomcat-server</id>
								<phase>test-compile</phase>
								<goals>
									<goal>wait</goal>
								</goals>
								<configuration>
									<protocol>http</protocol>
									<host>localhost</host>
									<port>8080</port>
									<file>/</file>
									<maxcount>20</maxcount>
									<timeout>10000</timeout>
									<read>true</read>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<dependencies>
		<dependency>
			<groupId>com.liferay.portal</groupId>
			<artifactId>portal-service</artifactId>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.liferay.portal</groupId>
			<artifactId>util-bridges</artifactId>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.liferay.portal</groupId>
			<artifactId>util-taglib</artifactId>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.liferay.portal</groupId>
			<artifactId>util-java</artifactId>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.arquillian.liferay</groupId>
			<artifactId>arquillian-container-liferay</artifactId>
			<version>1.0.0.Alpha2</version>
			<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>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.arquillian.graphene</groupId>
			<artifactId>graphene-webdriver</artifactId>
			<version>2.1.0.Alpha2</version>
			<type>pom</type>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>asm</groupId>
					<artifactId>asm</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.osgi</groupId>
			<artifactId>org.osgi.core</artifactId>
			<version>5.0.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.osgi</groupId>
			<artifactId>org.osgi.compendium</artifactId>
			<version>5.0.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.portlet</groupId>
			<artifactId>portlet-api</artifactId>
			<version>2.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.0.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.shrinkwrap.osgi</groupId>
			<artifactId>shrinkwrap-osgi</artifactId>
			<version>1.0.0-alpha-1</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<resources>
			<resource>
				<targetPath>${liferay.home}</targetPath>
				<filtering>true</filtering>
				<directory>${test.resources}/liferay</directory>
				<includes><include>portal-setup-wizard.properties</include></includes>
			</resource>
		</resources>
		<testResources>
			<testResource>
				<directory>src/test/resources</directory>
				<filtering>true</filtering>
			</testResource>
		</testResources>
		<plugins>
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.7</version>
				<dependencies>
					<dependency>
						<groupId>org.apache.maven.shared</groupId>
						<artifactId>maven-filtering</artifactId>
						<version>1.3</version>
					</dependency>
				</dependencies>
				<executions>
					<execution>
						<id>copy--jmx-config</id>
						<phase>generate-test-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${liferay.home}/tomcat-7.0.62/bin</outputDirectory>
							<resources>
								<resource>
									<directory>${test.resources}/tomcat</directory>
									<filtering>true</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

</project>