Locking an environment by using an Ant task

You can lock an environment by using the HCL Quality Server Ant tasks.

Here is an example syntax:
<taskdef name="lockEnvironment" classname="com.ghc.ghTester.ant.LockEnvironment" classpathref="tasklib" />

<lockEnvironment domain="<Domain name>" environment="<Environment name>"
username="<User name>" reason="<Reason>" duration="<Number of minutes>" serverUrl="https://Host name or IP address:5443/RTCP/" />
The following example usage files for the Ant tasks are available in the AntClient.zip package that can be downloaded from HCL Quality Server. For more information, see HCL OneTest API tool packages.
  • create-update-delete-environment.xml
  • lock-unlock-environment.xml
  • publish-stubs.xml
  • start-stop-scenario.xml
  • start-stop-stub.xml

The following table lists the attributes that you can use with the lockEnvironment Ant task for locking an environment.

Table 1. List of available attributes
Attribute Description Required
serverUrl URL of the HCL Quality Server Yes
domain Domain name Yes
environment Environment name Yes
username The user name under which to perform the operation. No
reason The reason for locking the environment. No
duration The number of minutes that you expect to keep the environment locked. No.
force Attempt to first unlock the environment if another user has the lock (flag). No, default is false.
securityToken The value of the security token to use for authentication with HCL Quality Server when domain security is enabled (optional). For more information, see Domain level security. No, default is to send no token.
haltOnFailure Set to true to fail the Ant script if the environment fails to lock (flag). No, default is false.

The name of a property that is set in the event of a failure.

waitFor If the environment is already locked, to specify the number of seconds that the task should wait for to allow the environment to be unlocked. If the environment gets unlocked during this period, the task locks the environment.

A value of 0 indicates the task to wait indefinitely.


Error codes

For details of any error codes, see Exit codes for Command-line client and Ant client.