pom.xml 7.63 KB
<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.alfresco</groupId>
        <artifactId>alfresco-super-pom</artifactId>
        <version>7</version>
    </parent>
    <groupId>org.alfresco.test</groupId>
    <artifactId>alfresco-api-test-utils</artifactId>
    <version>1.3-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>alfresco-test-utils</name>
    <description>Alfresco's utility lib used for end to end functional test project</description>
	
	<properties>
		<java.version>1.8</java.version>
		<remote.api.version>5.1.g</remote.api.version>
		<testng.xml>src/test/resources/testngEnterprise.xml</testng.xml>
		<uniqueTestRunName>test</uniqueTestRunName>
		<enterprise.installer.path>/data/bamboo/artifacts/${enterprise.build.plan}/ALL/alfresco-enterprise-*-installer-linux-x64.???</enterprise.installer.path>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>httpclient</artifactId>
			<version>4.3.3</version>
		</dependency>
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20140107</version>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
<!-- -->			<version>2.4</version> 
		</dependency>
		<dependency>
			<groupId>org.testng</groupId>
			<artifactId>testng</artifactId>
			<version>6.8.8</version>
			<!-- <scope>test</scope>-->
		</dependency>
		<dependency>
			<groupId>net.sourceforge.jexcelapi</groupId>
			<artifactId>jxl</artifactId>
			<version>2.6.12</version>
		</dependency>
		<dependency>
			<groupId>org.alfresco</groupId>
			<artifactId>alfresco-remote-api</artifactId>
			<version>${remote.api.version}</version>
		</dependency>
		<dependency>
			<groupId>org.alfresco</groupId>
			<artifactId>alfresco-remote-api</artifactId>
			<version>${remote.api.version}</version>
			<classifier>tests</classifier>
		</dependency>
	</dependencies>
	<!-- Plug back default Maven source folders -->
	<build>
		<directory>target/${uniqueTestRunName}</directory>
		<sourceDirectory>src/main/java</sourceDirectory>
		<testSourceDirectory>src/test/java</testSourceDirectory>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
		</resources>
		<testResources>
			<testResource>
				<directory>src/test/resources</directory>
			</testResource>
		</testResources>
		<plugins>
			<plugin>
				<artifactId>maven-surefire-plugin</artifactId>
					<configuration>
						<suiteXmlFiles>
							<suiteXmlFile>${testng.xml}</suiteXmlFile>
						</suiteXmlFiles>
						<excludedGroups>${test.exclude}</excludedGroups>
						<groups>${test.include}</groups>
						<runOrder>alphabetical</runOrder>
						<workingDirectory>${basedir}</workingDirectory>
						<redirectTestOutputToFile>false</redirectTestOutputToFile>
						<parallel>classes</parallel>
					</configuration>
				</plugin>
			<plugin>
				<!-- Configuration triggered by mvn antrun:run, used by Bamboo to stop server -->
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<id>default-cli</id>
						<configuration>
							<target>
								<echo>Stopping Alfresco...</echo>
								<exec executable="${basedir}/target/alf-installation/alfresco.sh" dir="target/alf-installation" failonerror="true">
									<arg value="stop" />
								</exec>
							</target>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<profiles>
		<profile>
			<id>install-alfresco</id>
			<build>
				<plugins>
					<!-- Download and install the latest enterprise alfresco installer -->
					<plugin>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<id>fetch-installer</id>
								<phase>generate-test-resources</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<target>
										<echo>Recreating database...</echo>
										<sql autocommit="true" driver="org.postgresql.Driver" password="alfresco" url="jdbc:postgresql:template1" userid="alfresco">drop
											database if exists alfresco; create database alfresco</sql>
										<echo>Downloading Alfresco installer...</echo>
										<sshexec command="ls -rt ${enterprise.installer.path} | tail -1 | tr ' ' '?' " host="pbam01.alfresco.com" keyfile="${user.home}/.ssh/id_rsa" outputproperty="installerPath" username="tomcat" />
										<scp keyfile="${user.home}/.ssh/id_rsa" localTofile="target/alf-installer.bin" remoteFile="tomcat@pbam01.alfresco.com:${installerPath}" />
										<chmod file="target/alf-installer.bin" perm="a+x" verbose="true" />
										<echo>Installing Alfresco...</echo>
										<exec dir="target" executable="${basedir}/target/alf-installer.bin" failonerror="true">
											<arg line="--mode unattended --alfresco_admin_password admin --disable-components postgres,alfrescowcmqs --jdbc_username alfresco --jdbc_password alfresco --prefix ${basedir}/target/alf-installation" />
										</exec>
									</target>
								</configuration>
							</execution>
						</executions>
						<dependencies>
							<dependency>
								<groupId>org.apache.ant</groupId>
								<artifactId>ant-jsch</artifactId>
								<version>1.8.2</version>
							</dependency>
							<dependency>
								<groupId>postgresql</groupId>
								<artifactId>postgresql</artifactId>
								<version>9.1-901-1.jdbc4</version>
							</dependency>
						</dependencies>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>run-alfresco</id>
			<build>
				<plugins>
					<!-- Starts/stop the installed Alfresco -->
					<plugin>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<id>start-alfresco</id>
								<phase>process-test-classes</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<target>
										<echo>Starting Alfresco...</echo>
										<exec dir="target/alf-installation" executable="${basedir}/target/alf-installation/alfresco.sh" failonerror="true">
											<arg value="start" />
											<env key="CATALINA_OPTS" value="${argLine}" />
										</exec>
										<sleep minutes="5" />
									</target>
								</configuration>
							</execution>
							<execution>
								<id>stop-alfresco</id>
								<phase>post-integration-test</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<target>
										<echo>Stopping Alfresco...</echo>
										<exec dir="target/alf-installation" executable="${basedir}/target/alf-installation/alfresco.sh" failonerror="true">
											<arg value="stop" />
										</exec>
									</target>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
	<scm>
        <connection>scm:git:https://gitlab.alfresco.com/engineering/alfresco-api-test-utils.git</connection>
        <developerConnection>scm:git:https://gitlab.alfresco.com/engineering/alfresco-api-test-utils.git</developerConnection>
        <url>https://gitlab.alfresco.com/engineering/alfresco-api-test-utils</url>
	  <tag>HEAD</tag>
  </scm>
	<distributionManagement>
		<repository>
			<id>alfresco-internal</id>
			<url>https://nexus.alfresco.com/nexus/content/repositories/releases</url>
		</repository>
		<snapshotRepository>
			<id>alfresco-internal-snapshots</id>
			<url>https://nexus.alfresco.com/nexus/content/repositories/snapshots</url>
		</snapshotRepository>
	</distributionManagement>
</project>