2012-01-11 20:59:50 +04:00
|
|
|
<project name="selenium-grid" default="launch-node" basedir=".">
|
2011-02-18 02:29:36 +03:00
|
|
|
|
2011-02-26 03:57:06 +03:00
|
|
|
<property environment="env"/>
|
2011-03-08 00:55:20 +03:00
|
|
|
<exec executable="hostname" osfamily="unix" failifexecutionfails="false" outputproperty="env.COMPUTERNAME"/>
|
2011-02-26 03:57:06 +03:00
|
|
|
<property name="env.HOSTNAME" value="${env.COMPUTERNAME}"/> <!-- Windows vs. Linux -->
|
|
|
|
|
2011-07-06 13:52:30 +04:00
|
|
|
<property file="${basedir}/${env.HOSTNAME}.properties" />
|
|
|
|
<property file="${basedir}/default.properties"/>
|
2011-02-18 02:29:36 +03:00
|
|
|
|
2012-02-08 21:13:43 +04:00
|
|
|
<target name="fetch-dependencies">
|
|
|
|
<mkdir dir="lib"/>
|
2014-02-26 16:43:40 +04:00
|
|
|
<get src="http://selenium-release.storage.googleapis.com/${selenium.version.major}/selenium-server-standalone-${selenium.version.major}.${selenium.version.minor}.jar"
|
2012-02-08 21:13:43 +04:00
|
|
|
dest="lib"
|
2012-05-11 19:01:23 +04:00
|
|
|
usetimestamp="true"
|
|
|
|
ignoreerrors="yes"/>
|
|
|
|
|
2014-02-26 16:43:40 +04:00
|
|
|
<available file="lib/selenium-server-standalone-${selenium.version.major}.${selenium.version.minor}.jar" property="selenium.present"/>
|
2012-05-11 19:01:23 +04:00
|
|
|
|
2014-02-26 16:43:40 +04:00
|
|
|
<fail unless="selenium.present" message="Unable to locate lib/selenium-server-standalone-${selenium.version.major}.${selenium.version.minor}.jar"/>
|
2012-02-08 21:13:43 +04:00
|
|
|
</target>
|
|
|
|
|
2012-02-19 23:17:17 +04:00
|
|
|
<target name="set-config">
|
|
|
|
<echo>os.name: ${os.name}</echo>
|
|
|
|
<condition property="node.configuration.file" value="mac.json">
|
|
|
|
<contains string="${os.name}" substring="mac" casesensitive="false"/>
|
|
|
|
</condition>
|
|
|
|
<condition property="node.configuration.file" value="winvista.json">
|
|
|
|
<os name="Windows Vista"/>
|
|
|
|
</condition>
|
|
|
|
<condition property="node.configuration.file" value="win7.json">
|
|
|
|
<os name="Windows 7"/>
|
|
|
|
</condition>
|
|
|
|
<property name="node.configuration.file" value="default.json"/>
|
|
|
|
<echo>node.configuration.file: ${node.configuration.file}</echo>
|
|
|
|
</target>
|
|
|
|
|
2012-01-18 21:10:17 +04:00
|
|
|
<target name="set-hosts">
|
2015-08-04 18:41:22 +03:00
|
|
|
<!-- set the production hub host for the production environment -->
|
|
|
|
<condition property="hub.host" value="${production.hub.host}">
|
|
|
|
<matches pattern="^production$" string="${env}"/>
|
2012-02-19 22:47:41 +04:00
|
|
|
</condition>
|
|
|
|
|
2015-08-04 18:41:22 +03:00
|
|
|
<!-- set the staging hub host for the staging environment -->
|
|
|
|
<condition property="hub.host" value="${staging.hub.host}">
|
|
|
|
<matches pattern="^staging$" string="${env}"/>
|
2012-02-19 22:47:41 +04:00
|
|
|
</condition>
|
|
|
|
|
|
|
|
<!-- otherwise set to localhost (unless overridden) -->
|
2012-01-18 21:10:17 +04:00
|
|
|
<property name="hub.host" value="localhost"/>
|
2012-02-19 22:47:41 +04:00
|
|
|
|
|
|
|
<!-- if the hub is running on localhost then so must the node be -->
|
|
|
|
<condition property="node.host" value="localhost">
|
|
|
|
<matches pattern="localhost" string="${hub.host}"/>
|
|
|
|
</condition>
|
|
|
|
|
|
|
|
<!-- otherwise set to the hostname -->
|
|
|
|
<property name="node.host" value="${env.HOSTNAME}"/>
|
|
|
|
|
2012-01-18 20:42:19 +04:00
|
|
|
<echo>hub.host: ${hub.host}</echo>
|
2012-01-18 21:10:17 +04:00
|
|
|
<echo>node.host: ${node.host}</echo>
|
2012-01-11 20:59:50 +04:00
|
|
|
</target>
|
|
|
|
|
2011-05-12 02:07:29 +04:00
|
|
|
<path id="selenium.classpath">
|
2011-02-26 03:47:49 +03:00
|
|
|
<pathelement path="${basedir}/"/>
|
|
|
|
<fileset dir="${basedir}/lib">
|
2014-02-26 16:43:40 +04:00
|
|
|
<include name="selenium-server-standalone-${selenium.version.major}.${selenium.version.minor}.jar"/>
|
2011-02-26 03:47:49 +03:00
|
|
|
</fileset>
|
|
|
|
<pathelement path="${java.class.path}/"/>
|
|
|
|
</path>
|
|
|
|
|
2012-02-19 22:47:41 +04:00
|
|
|
<!-- debug target to show variables -->
|
2011-02-26 03:57:06 +03:00
|
|
|
<target name="debug">
|
|
|
|
<echoproperties/>
|
|
|
|
</target>
|
|
|
|
|
2012-02-08 21:13:43 +04:00
|
|
|
<target name="launch-hub"
|
|
|
|
description="Launch Selenium Hub"
|
|
|
|
depends="fetch-dependencies">
|
2011-05-10 17:16:58 +04:00
|
|
|
<java classname="org.openqa.grid.selenium.GridLauncher"
|
2011-05-12 02:07:29 +04:00
|
|
|
classpathref="selenium.classpath"
|
2011-02-26 03:47:49 +03:00
|
|
|
fork="true"
|
2011-05-10 17:16:58 +04:00
|
|
|
failonerror="true">
|
|
|
|
<arg value="-role"/>
|
|
|
|
<arg value="hub"/>
|
2011-07-06 13:52:30 +04:00
|
|
|
<arg value="-hubConfig"/>
|
|
|
|
<arg value="hub_configuration.json"/>
|
2011-05-10 17:16:58 +04:00
|
|
|
</java>
|
2011-02-26 03:47:49 +03:00
|
|
|
</target>
|
|
|
|
|
2014-08-01 20:13:47 +04:00
|
|
|
<target name="launch-hub-debug"
|
|
|
|
description="Launch Selenium Hub in debug mode"
|
|
|
|
depends="fetch-dependencies">
|
|
|
|
<java classname="org.openqa.grid.selenium.GridLauncher"
|
|
|
|
classpathref="selenium.classpath"
|
|
|
|
fork="true"
|
|
|
|
failonerror="true">
|
|
|
|
<arg value="-role"/>
|
|
|
|
<arg value="hub"/>
|
|
|
|
<arg value="-hubConfig"/>
|
|
|
|
<arg value="hub_configuration.json"/>
|
|
|
|
<arg value="-debug"/>
|
|
|
|
<arg value="-log"/>
|
|
|
|
<arg value="hub.log"/>
|
|
|
|
</java>
|
|
|
|
</target>
|
|
|
|
|
2011-11-11 00:40:38 +04:00
|
|
|
<target name="launch-node"
|
|
|
|
description="Launch Selenium Node"
|
2012-07-25 18:55:00 +04:00
|
|
|
depends="fetch-dependencies, set-config, set-hosts">
|
2011-05-12 02:07:29 +04:00
|
|
|
<java classpathref="selenium.classpath"
|
|
|
|
classname="org.openqa.grid.selenium.GridLauncher"
|
2011-02-26 03:47:49 +03:00
|
|
|
fork="true"
|
|
|
|
failonerror="true">
|
2015-11-10 13:46:45 +03:00
|
|
|
<sysproperty key="http.nonProxyHosts"
|
|
|
|
value="${hub.host}"/>
|
2011-05-12 02:07:29 +04:00
|
|
|
<arg value="-role"/>
|
2011-11-11 00:40:38 +04:00
|
|
|
<arg value="node"/>
|
2013-01-19 01:08:36 +04:00
|
|
|
<arg value="-id"/>
|
|
|
|
<arg value="${env.HOSTNAME}"/>
|
2011-05-12 02:07:29 +04:00
|
|
|
<arg value="-hub"/>
|
|
|
|
<arg value="http://${hub.host}:${hub.port}/grid/register"/>
|
2011-02-26 03:47:49 +03:00
|
|
|
<arg value="-host"/>
|
2011-07-13 15:22:01 +04:00
|
|
|
<arg value="${node.host}"/>
|
2011-07-06 13:52:30 +04:00
|
|
|
<arg value="-nodeConfig"/>
|
|
|
|
<arg value="${node.configuration.file}"/>
|
2011-02-26 03:47:49 +03:00
|
|
|
</java>
|
|
|
|
</target>
|
2014-08-01 20:13:47 +04:00
|
|
|
|
|
|
|
<target name="launch-node-debug"
|
|
|
|
description="Launch Selenium Node in debug mode"
|
|
|
|
depends="fetch-dependencies, set-config, set-hosts">
|
|
|
|
<java classpathref="selenium.classpath"
|
|
|
|
classname="org.openqa.grid.selenium.GridLauncher"
|
|
|
|
fork="true"
|
|
|
|
failonerror="true">
|
2015-11-10 13:46:45 +03:00
|
|
|
<sysproperty key="http.nonProxyHosts"
|
|
|
|
value="${hub.host}"/>
|
2014-08-01 20:13:47 +04:00
|
|
|
<arg value="-role"/>
|
|
|
|
<arg value="node"/>
|
|
|
|
<arg value="-id"/>
|
|
|
|
<arg value="${env.HOSTNAME}"/>
|
|
|
|
<arg value="-hub"/>
|
|
|
|
<arg value="http://${hub.host}:${hub.port}/grid/register"/>
|
|
|
|
<arg value="-host"/>
|
|
|
|
<arg value="${node.host}"/>
|
|
|
|
<arg value="-nodeConfig"/>
|
|
|
|
<arg value="${node.configuration.file}"/>
|
|
|
|
<arg value="-debug"/>
|
|
|
|
<arg value="-log"/>
|
|
|
|
<arg value="node.log"/>
|
|
|
|
</java>
|
|
|
|
</target>
|
2011-02-26 03:47:49 +03:00
|
|
|
</project>
|