| 1 |
<?xml version="1.0"?> |
| 2 |
|
| 3 |
<project name="limittest" basedir="." default="test1"> |
| 4 |
<description> |
| 5 |
test build file for the Limit task |
| 6 |
</description> |
| 7 |
|
| 8 |
<target name="init"> |
| 9 |
<taskdef resource="net/sf/antcontrib/antcontrib.properties"> |
| 10 |
<classpath location="${antcontrib.jar}"/> |
| 11 |
</taskdef> |
| 12 |
</target> |
| 13 |
|
| 14 |
<target name="test1" depends="init"> |
| 15 |
|
| 16 |
<limit maxwait="1"> |
| 17 |
<sleep seconds="5"/> |
| 18 |
<echo>_failed_</echo> |
| 19 |
<fail/> |
| 20 |
</limit> |
| 21 |
</target> |
| 22 |
|
| 23 |
<property name="ant.enable.asserts" value="true"/> |
| 24 |
<target name="test2" depends="init"> |
| 25 |
|
| 26 |
<stopwatch name="limit"/> |
| 27 |
<limit maxwait="5"> |
| 28 |
<sleep seconds="1"/> |
| 29 |
<echo>_passed_</echo> |
| 30 |
</limit> |
| 31 |
<stopwatch name="limit" action="total"/> |
| 32 |
<assert message="Too much time."> |
| 33 |
<bool> |
| 34 |
<islessthan arg1="${limit}" arg2="2"/> |
| 35 |
</bool> |
| 36 |
</assert> |
| 37 |
</target> |
| 38 |
|
| 39 |
<target name="test3" depends="init"> |
| 40 |
|
| 41 |
<limit maxwait="3" failonerror="true"> |
| 42 |
<fail message="_failed_"/> |
| 43 |
</limit> |
| 44 |
</target> |
| 45 |
|
| 46 |
<target name="test4" depends="init"> |
| 47 |
|
| 48 |
<limit maxwait="3"> |
| 49 |
<fail message="_failed_"/> |
| 50 |
</limit> |
| 51 |
</target> |
| 52 |
|
| 53 |
<target name="test5" depends="init"> |
| 54 |
<limit maxwait="1" unit="minute"> |
| 55 |
<sleep seconds="65"/> |
| 56 |
</limit> |
| 57 |
</target> |
| 58 |
|
| 59 |
<target name="test6" depends="init"> |
| 60 |
<limit seconds="6"> |
| 61 |
<sleep seconds="7"/> |
| 62 |
</limit> |
| 63 |
</target> |
| 64 |
|
| 65 |
</project> |