|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.ProjectComponent | +--org.apache.tools.ant.Task | +--net.sf.antcontrib.logic.Assert
Based on the Sequential task. Similar to Java's 'assert' keyword, verifies that a given property has a given value. Throws a BuildException if the property value is not as expected or the property does not exist.
Also like Java's 'assert' keyword, the Assert task must be 'turned on' using the property "ant.enable.asserts". If not set, or is set to false, the Assert task works exactly like the Sequential task.
Can hold other tasks including Assert. Attributes:
The assert task supports a single nested BooleanCondition task, otherwise, the assert task does not support any nested elements apart from Ant tasks. Any valid Ant task may be embedded within the assert task.
Developed for use with Antelope, migrated to ant-contrib Oct 2003.
Field Summary |
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Constructor Summary | |
Assert()
|
Method Summary | |
void |
addBool(BooleanConditionTask boolTask)
|
void |
addTask(org.apache.tools.ant.Task task)
Add a nested task to execute. |
void |
execute()
Execute this task and all nested Tasks. |
static void |
main(java.lang.String[] args)
|
void |
maybeConfigure()
Override maybeConfigure in a way that leaves the nested tasks
unconfigured until they get executed. |
static int |
runTests()
|
void |
setExecute(java.lang.String execute)
Ant boolean, if true, execute any contained tasks. |
void |
setExists(java.lang.String exists)
Set the 'exists' attribute. |
void |
setFailonerror(java.lang.String fail)
Ant boolean, stop the build process if the assertion fails. |
void |
setMessage(java.lang.String msg)
|
void |
setName(java.lang.String name)
Set the name of the property to test. |
void |
setValue(java.lang.String value)
Set the expected value of the property. |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Assert()
Method Detail |
public void setName(java.lang.String name)
name
- the name of the property to test.public void setValue(java.lang.String value)
value
- the expected value of the property.public void setMessage(java.lang.String msg)
public void setExists(java.lang.String exists)
exists
- Ant boolean, whether the value must exist.public void setExecute(java.lang.String execute)
execute
- Ant boolean, whether to execute contained tasks.public void setFailonerror(java.lang.String fail)
fail
- Ant boolean, whether to stop the build on assertion error.public void maybeConfigure() throws org.apache.tools.ant.BuildException
maybeConfigure
in a way that leaves the nested tasks
unconfigured until they get executed.
maybeConfigure
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
public void addTask(org.apache.tools.ant.Task task)
addTask
in interface org.apache.tools.ant.TaskContainer
task
- Nested task to execute.
public void addBool(BooleanConditionTask boolTask)
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
public static int runTests()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |