Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
10140 lines (8440 sloc) 286 KB
<?xml version="1.0"?>
<project basedir="." default="test" name="portal-test" xmlns:antelope="antlib:ise.antelope.tasks" xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="build.xml" />
<if>
<and>
<isset property="test.base.dir.name" />
<available file="${test.base.dir.name}/test.properties" />
</and>
<then>
<property file="${test.base.dir.name}/test.${user.name}.properties" />
<property file="${test.base.dir.name}/test.${env.COMPUTERNAME}.properties" />
<property file="${test.base.dir.name}/test.${env.HOST}.properties" />
<property file="${test.base.dir.name}/test.${env.HOSTNAME}.properties" />
<property file="${test.base.dir.name}/test.properties" />
</then>
</if>
<property file="${project.dir}/test.generated.properties" />
<property file="${project.dir}/test.${user.name}.properties" />
<property file="${project.dir}/test.${env.COMPUTERNAME}.properties" />
<property file="${project.dir}/test.${env.HOST}.properties" />
<property file="${project.dir}/test.${env.HOSTNAME}.properties" />
<property file="${project.dir}/test.properties" />
<propertycopy from="app.server.${app.server.type}.start.executable" name="app.server.start.executable" />
<propertycopy from="app.server.${app.server.type}.start.executable.arg.line" name="app.server.start.executable.arg.line" />
<propertycopy from="app.server.${app.server.type}.stop.executable" name="app.server.stop.executable" />
<propertycopy from="app.server.${app.server.type}.stop.executable.arg.line" name="app.server.stop.executable.arg.line" />
<propertycopy from="browser.${browser.type}.version" name="browser.version" />
<propertycopy from="java.jdk.${java.jdk.architecture}.version" name="java.jdk.version" />
<propertycopy from="liferay.portal.${liferay.portal.branch}.bundle" name="liferay.portal.bundle" />
<propertycopy from="operating.system.${operating.system.type}.version" name="operating.system.version" />
<property location="${project.dir}/tools/putty/plink.exe" name="plink.executable" />
<property location="${project.dir}/tools/putty/pscp.exe" name="pscp.executable" />
<macrodef name="apply-portal-ext-properties">
<sequential>
<if>
<and>
<contains string="${app.server.portal.dir}" substring="liferay-portal.war" />
<not>
<equals arg1="${app.server.type}" arg2="websphere" />
</not>
</and>
<then>
<property name="test.build.liferay.portal.zip.file.name" value="${app.server.portal.dir}" />
</then>
<elseif>
<equals arg1="${app.server.type}" arg2="glassfish" />
<then>
<property name="test.build.liferay.portal.zip.file.name" value="${app.server.glassfish.portal.war.name}" />
</then>
</elseif>
<elseif>
<equals arg1="${tcat.enabled}" arg2="true" />
<then>
<property name="test.build.liferay.portal.zip.file.name" value="${app.server.tcat.admin.dir}/tcat_init/webapps/${lp.version.dtd}/ROOT.war" />
</then>
</elseif>
</if>
<if>
<isset property="test.build.liferay.portal.zip.file.name" />
<then>
<tstamp>
<format pattern="yyyyMMddkkmmssSSS" property="tstamp.value" />
</tstamp>
<mkdir dir="${tstamp.value}" />
<unzip dest="${tstamp.value}" src="${test.build.liferay.portal.zip.file.name}" />
<copy
file="portal-impl/src/portal-ext.properties"
overwrite="true"
tofile="${tstamp.value}/WEB-INF/classes/portal-ext.properties"
/>
<echo append="true" file="${tstamp.value}/WEB-INF/classes/portal-ext.properties">
module.framework.properties.osgi.console=11312</echo>
<print-file file.name="${tstamp.value}/WEB-INF/classes/portal-ext.properties" />
<delete file="${test.build.liferay.portal.zip.file.name}" />
<zip basedir="${tstamp.value}" destfile="${test.build.liferay.portal.zip.file.name}" />
<delete dir="${tstamp.value}" />
<var name="tstamp.value" unset="true" />
</then>
<else>
<copy
file="portal-impl/src/portal-ext.properties"
overwrite="true"
tofile="${app.server.classes.portal.dir}/portal-ext.properties"
/>
<echo append="true" file="${app.server.classes.portal.dir}/portal-ext.properties">
module.framework.properties.osgi.console=11312</echo>
<print-file file.name="${app.server.classes.portal.dir}/portal-ext.properties" />
</else>
</if>
</sequential>
</macrodef>
<macrodef name="check-config">
<sequential>
<if>
<not>
<or>
<equals arg1="${app.server.type}" arg2="glassfish" />
<equals arg1="${app.server.type}" arg2="jboss" />
<equals arg1="${app.server.type}" arg2="jetty" />
<equals arg1="${app.server.type}" arg2="jonas" />
<equals arg1="${app.server.type}" arg2="resin" />
<equals arg1="${app.server.type}" arg2="tcserver" />
<equals arg1="${app.server.type}" arg2="tomcat" />
<equals arg1="${app.server.type}" arg2="weblogic" />
<equals arg1="${app.server.type}" arg2="websphere" />
<equals arg1="${app.server.type}" arg2="wildfly" />
</or>
</not>
<then>
<fail>Please set "app.server.type" to one of the following:${line.separator}, glassfish, jboss, jetty, jonas, resin, tcserver, tomcat, weblogic, websphere, or wildfly.</fail>
</then>
</if>
<if>
<not>
<or>
<equals arg1="${browser.type}" arg2="android" />
<equals arg1="${browser.type}" arg2="androidchrome" />
<equals arg1="${browser.type}" arg2="chrome" />
<equals arg1="${browser.type}" arg2="edge" />
<equals arg1="${browser.type}" arg2="firefox" />
<equals arg1="${browser.type}" arg2="internetexplorer" />
<equals arg1="${browser.type}" arg2="iossafari" />
<equals arg1="${browser.type}" arg2="safari" />
</or>
</not>
<then>
<fail>Please set "browser.type" to one of the following:${line.separator}android, androidchrome, chrome, edge, firefox, internetexplorer, iossafari, or safari.</fail>
</then>
</if>
<if>
<not>
<or>
<equals arg1="${database.type}" arg2="db2" />
<equals arg1="${database.type}" arg2="hypersonic" />
<equals arg1="${database.type}" arg2="mariadb" />
<equals arg1="${database.type}" arg2="mysql" />
<equals arg1="${database.type}" arg2="oracle" />
<equals arg1="${database.type}" arg2="postgresql" />
<equals arg1="${database.type}" arg2="sqlserver" />
<equals arg1="${database.type}" arg2="sybase" />
</or>
</not>
<then>
<fail>Please set "database.type" to one of the following:${line.separator}db2, hypersonic, mariadb, mysql, oracle, postgresql, sqlserver, sybase.</fail>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="generate-gulp-user-config-json">
<attribute name="portlet.name" />
<attribute default="${app.server.type}" name="app.server.type" />
<attribute default="${app.server.@{app.server.type}.dir}" name="app.server.dir" />
<attribute default="user-config.json" name="file.name" />
<attribute default="portlets/@{portlet.name}/docroot/js/tests/util" name="file.path" />
<attribute default="${lp.plugins.dir}" name="plugins.dir" />
<attribute default="${project.dir}" name="portal.dir" />
<sequential>
<echo file="@{plugins.dir}/@{file.path}/@{file.name}"><![CDATA[{
"bundle": "@{app.server.dir}",
"deployDir": "@{app.server.dir}/webapps/ROOT",
"source": "@{portal.dir}"
}]]></echo>
</sequential>
</macrodef>
<macrodef name="generate-jdbc-properties">
<attribute name="properties.file" />
<element name="post-action" optional="true" />
<sequential>
<get-database-property property.name="database.driver" />
<get-database-property property.name="database.password" />
<get-database-property property.name="database.url" />
<get-database-property property.name="database.username" />
<echo file="@{properties.file}"><![CDATA[liferay.home=${liferay.home}
jdbc.default.driverClassName=${database.driver}
jdbc.default.url=${database.url}
jdbc.default.username=${database.username}
jdbc.default.password=${database.password}
// HikariCP
jdbc.default.connectionTimeout=600000
jdbc.default.maximumPoolSize=20
jdbc.default.minimumIdle=0
jdbc.counter.maximumPoolSize=5
jdbc.counter.minimumIdle=0
// Tomcat
jdbc.default.initialSize=0
jdbc.default.maxActive=20
jdbc.default.maxIdle=0
jdbc.default.minIdle=0
jdbc.counter.initialSize=0
jdbc.counter.maxActive=5
jdbc.counter.maxIdle=0
jdbc.counter.minIdle=0
counter.jdbc.prefix=jdbc.counter.]]></echo>
<if>
<equals arg1="${database.type}" arg2="oracle" />
<then>
<echo append="true" file="@{properties.file}"><![CDATA[
jdbc.default.connectionProperties=oracle.jdbc.ReadTimeout=0;oracle.net.CONNECT_TIMEOUT=0
jdbc.counter.connectionProperties=oracle.jdbc.ReadTimeout=0;oracle.net.CONNECT_TIMEOUT=0]]></echo>
</then>
</if>
<post-action />
</sequential>
</macrodef>
<macrodef name="get-auto-deploy-dir">
<sequential>
<var name="auto.deploy.dir" unset="true" />
<if>
<isset property="test.class" />
<then>
<get-testcase-property property.name="plugins.deployment.type" />
</then>
</if>
<if>
<equals arg1="${plugins.deployment.type}" arg2="osgi" />
<then>
<var name="auto.deploy.dir" value="${liferay.home}/osgi/modules" />
</then>
<else>
<var name="auto.deploy.dir" value="${liferay.home}/deploy" />
</else>
</if>
</sequential>
</macrodef>
<macrodef name="get-database-property">
<attribute name="property.name" />
<sequential>
<check-config />
<var name="property.name" unset="true" />
<var name="@{property.name}" unset="true" />
<property name="property.name" value="@{property.name}" />
<beanshell>
<![CDATA[
String propertyName = project.getProperty("property.name");
StringBuilder sb = new StringBuilder();
sb.append("database.");
sb.append(project.getProperty("database.type"));
sb.append(".");
sb.append(propertyName.substring(9));
propertyValue = project.getProperty(sb.toString());
project.setProperty(propertyName, propertyValue);
]]>
</beanshell>
</sequential>
</macrodef>
<macrodef name="get-env-app-server">
<sequential>
<propertyregex
input="${app.server.version}"
override="true"
property="app.server.major.version"
regexp="(\d+\.\d+).*"
replace="\1"
/>
<propertyregex
defaultValue="${app.server.major.version}"
global="true"
input="${app.server.major.version}"
override="true"
property="app.server.major.version.build"
regexp="\."
replace=""
/>
<propertycopy
from="env.option.app.server.${app.server.type}${app.server.major.version.build}"
name="env.option.app.server"
override="true"
/>
</sequential>
</macrodef>
<macrodef name="get-env-browser">
<sequential>
<propertyregex
input="${browser.version}"
override="true"
property="browser.major.version"
regexp="(\d+\.\d+).*"
replace="\1"
/>
<propertyregex
defaultValue="${browser.major.version}"
global="true"
input="${browser.major.version}"
override="true"
property="browser.major.version.build"
regexp="\."
replace=""
/>
<propertycopy
from="env.option.browser.${browser.type}${browser.major.version.build}"
name="env.option.browser"
override="true"
/>
</sequential>
</macrodef>
<macrodef name="get-env-database">
<sequential>
<get-database-property property.name="database.version" />
<propertyregex
input="${database.version}"
override="true"
property="database.major.version"
regexp="(\d+\.?\d+?(r2)?).*"
replace="\1"
/>
<propertyregex
defaultValue="${database.major.version}"
global="true"
input="${database.major.version}"
override="true"
property="database.major.version.build"
regexp="\."
replace=""
/>
<propertycopy
from="env.option.database.${database.type}${database.major.version.build}"
name="env.option.database"
override="true"
/>
</sequential>
</macrodef>
<macrodef name="get-env-java-jdk">
<sequential>
<propertycopy
from="env.option.java.jdk.${java.jdk.type}.${java.jdk.version}.${java.jdk.architecture}"
name="env.option.java.jdk"
override="true"
/>
</sequential>
</macrodef>
<macrodef name="get-env-liferay-portal">
<sequential>
<if>
<not>
<available file="git-commit-portal" />
</not>
<then>
<record-git-commit-portal />
</then>
</if>
<loadfile
property="liferay.plugins.git.id"
srcfile="git-commit-plugins"
/>
<loadfile
property="liferay.portal.git.id"
srcfile="git-commit-portal"
/>
<if>
<or>
<not>
<isset property="env.SOURCE_JOB_BUILD_NUMBER" />
</not>
<equals arg1="${env.SOURCE_JOB_BUILD_NUMBER}" arg2="1" />
</or>
<then>
<property name="liferay.previous.plugins.git.id" value="${liferay.plugins.git.id}" />
<property name="liferay.previous.portal.git.id" value="${liferay.portal.git.id}" />
</then>
<else>
<math
datatype="int"
operand1="${env.SOURCE_JOB_BUILD_NUMBER}"
operand2="1"
operation="-"
result="previous.build.number"
/>
<property name="previous.commit.id.dir" value="${jenkins.shared.user.content.dir}/jobs/${env.SOURCE_JOB_NAME}/builds/${previous.build.number}" />
<loadfile failonerror="false" property="liferay.previous.plugins.git.id" srcfile="${previous.commit.id.dir}/git-commit-plugins">
<filterchain>
<striplinebreaks/>
</filterchain>
</loadfile>
<loadfile failonerror="false" property="liferay.previous.portal.git.id" srcfile="${previous.commit.id.dir}/git-commit-portal">
<filterchain>
<striplinebreaks/>
</filterchain>
</loadfile>
</else>
</if>
<property name="liferay.compare.urls" value="https://github.com/liferay/liferay-plugins-ee/compare/${liferay.previous.plugins.git.id}...${liferay.plugins.git.id},https://github.com/liferay/liferay-portal-ee/compare/${liferay.previous.portal.git.id}...${liferay.portal.git.id}" />
</sequential>
</macrodef>
<macrodef name="get-env-operating-system">
<sequential>
<propertyregex
defaultValue="${operating.system.version}"
global="true"
input="${operating.system.version}"
override="true"
property="operating.system.version.build"
regexp="\."
replace=""
/>
<propertycopy
from="env.option.operating.system.${operating.system.type}${operating.system.version.build}"
name="env.option.operating.system"
override="true"
/>
</sequential>
</macrodef>
<macrodef name="get-ip-address">
<sequential>
<if>
<isset property="ip.address" />
<then>
<var name="ip.address" value="${ip.address}" />
</then>
<elseif>
<os family="mac" />
<then>
<exec executable="/bin/bash" outputproperty="ip.address">
<arg value="-c" />
<arg value="ifconfig | grep 'inet ' | grep -v 127.0.0.1 | cut -d\ -f2" />
</exec>
</then>
</elseif>
<elseif>
<os family="unix" />
<then>
<exec executable="/bin/bash" os="${os.unix}" outputproperty="ip.address">
<arg value="-c" />
<arg value="ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'" />
</exec>
</then>
</elseif>
<else>
<fail message="Please set the property ${ip.address}." />
</else>
</if>
</sequential>
</macrodef>
<macrodef name="get-jstack-output">
<attribute name="process.name" />
<sequential>
<var name="jstack.output" unset="true" />
<execute>
<![CDATA[
jps > jps_output
]]>
</execute>
<local name="jps.output" />
<loadfile property="jps.output" srcfile="jps_output" />
<if>
<contains string="${jps.output}" substring="@{process.name}" />
<then>
<local name="bootstrap.pid" />
<propertyregex
input="${jps.output}"
override="true"
property="bootstrap.pid"
regexp="(|[\S\s]*\n)([0-9]+) @{process.name}[\S\s]*"
replace="\2"
/>
<execute>
<![CDATA[
jstack ${bootstrap.pid} > jstack_output
]]>
</execute>
<loadfile property="jstack.output" srcfile="jstack_output" />
</then>
</if>
<delete file="jps_output" />
<delete file="jstack_output" />
</sequential>
</macrodef>
<macrodef name="get-master-hostname">
<attribute default="${env.JENKINS_URL}" name="jenkins.url" />
<sequential>
<var name="master.hostname" unset="true" />
<propertyregex
input="@{jenkins.url}"
override="true"
property="master.hostname"
regexp="https://(test-[0-9]+-[0-9]+).liferay.com/"
replace="\1"
/>
<if>
<not>
<isset property="master.hostname" />
</not>
<then>
<propertyregex
input="@{jenkins.url}"
override="true"
property="master.hostname"
regexp="https://test.liferay.com/([0-9]+)/"
replace="test-\1"
/>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="get-module-base-dir-from-subrepository-name">
<attribute name="subrepository.name" />
<sequential>
<var name="module.base.dir" unset="true" />
<antelope:stringutil property="subrepository.name" string="@{subrepository.name}">
<antelope:replace regex="(.+)-private" replacement="$1" />
</antelope:stringutil>
<for param="gitrepo.file">
<fileset dir="${project.dir}/modules" erroronmissingdir="false" id="fileset.id">
<include name="**/.gitrepo" />
</fileset>
<sequential>
<local name="gitrepo.file.content" />
<loadfile property="gitrepo.file.content" srcfile="@{gitrepo.file}" />
<if>
<or>
<contains string="${gitrepo.file.content}" substring="git@github.com:liferay/${subrepository.name}.git" />
<contains string="${gitrepo.file.content}" substring="git@github.com:liferay/${subrepository.name}-private.git" />
</or>
<then>
<antelope:stringutil property="module.base.dir" string="@{gitrepo.file}">
<antelope:replace regex="\\" replacement="/" />
</antelope:stringutil>
<antelope:stringutil property="module.base.dir" string="${module.base.dir}">
<antelope:replace regex="(.+)\/\.gitrepo" replacement="$1" />
</antelope:stringutil>
</then>
</if>
</sequential>
</for>
<fail message="No module base directory found for '@{subrepository.name}'." unless="module.base.dir" />
</sequential>
</macrodef>
<macrodef name="get-patch-requirements">
<attribute name="patch.file.zip.url" />
<sequential>
<var name="patch.requirements" unset="true" />
<local name="tstamp.value" />
<tstamp>
<format pattern="yyyyMMddkkmmssSSS" property="tstamp.value" />
</tstamp>
<mirrors-get dest="${tstamp.value}.zip" src="@{patch.file.zip.url}" />
<mkdir dir="${tstamp.value}-dir" />
<unzip dest="${tstamp.value}-dir" src="${tstamp.value}.zip" />
<xmlproperty file="${tstamp.value}-dir/fixpack_documentation.xml" />
<antelope:stringutil property="patch.requirements" string="${patch.requirements}">
<antelope:replace regex="!" replacement="" />
<antelope:replace regex="&gt;=" replacement="-" />
<antelope:replace regex="=" replacement="-" />
</antelope:stringutil>
<delete dir="${tstamp.value}-dir" />
<delete file="${tstamp.value}.zip" />
</sequential>
</macrodef>
<macrodef name="get-poshi-class-name">
<sequential>
<fail message="Please set the property ${test.class}." unless="test.class" />
<var name="poshi.class.name" unset="true" />
<get-test-simple-class-name />