aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/ant/apache-ant-1.9.6/src/etc/testcases/taskdefs/conditions/isreachable.xml
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/ant/apache-ant-1.9.6/src/etc/testcases/taskdefs/conditions/isreachable.xml')
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/etc/testcases/taskdefs/conditions/isreachable.xml105
1 files changed, 105 insertions, 0 deletions
diff --git a/framework/src/ant/apache-ant-1.9.6/src/etc/testcases/taskdefs/conditions/isreachable.xml b/framework/src/ant/apache-ant-1.9.6/src/etc/testcases/taskdefs/conditions/isreachable.xml
new file mode 100644
index 00000000..3f74aef7
--- /dev/null
+++ b/framework/src/ant/apache-ant-1.9.6/src/etc/testcases/taskdefs/conditions/isreachable.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+<project name="isreachable">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+ <macrodef name="assertHostReachable">
+ <attribute name="host"/>
+ <sequential>
+ <fail message="not reachable: @{host}">
+ <condition>
+ <not>
+ <isreachable host="@{host}"/>
+ </not>
+ </condition>
+ </fail>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="assertHostNotReachable">
+ <attribute name="host"/>
+ <sequential>
+ <fail message="unexpectedly reachable: @{host}">
+ <condition>
+ <isreachable host="@{host}"/>
+ </condition>
+ </fail>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="assertUrlReachable">
+ <attribute name="url"/>
+ <sequential>
+ <fail message="not reachable: @{url}">
+ <condition>
+ <not>
+ <isreachable url="@{url}"/>
+ </not>
+ </condition>
+ </fail>
+ </sequential>
+ </macrodef>
+
+ <target name="testLocalhost">
+ <assertHostReachable host="localhost"/>
+ </target>
+
+ <!-- bugs in XPSP2 mean this is the only IPv4 loopback addr allowed -->
+ <target name="testIpv4localhost">
+ <assertHostReachable host="127.0.0.1"/>
+ </target>
+
+ <target name="testBoth">
+ <condition property="both">
+ <isreachable host="localhost" url="http://localhost"/>
+ </condition>
+ <fail>Expected failure before here</fail>
+ </target>
+
+ <target name="testLocalhostURL">
+ <assertUrlReachable url="http://localhost"/>
+ </target>
+
+ <target name="testIpv4localhostURL">
+ <assertUrlReachable url="http://127.0.0.1/"/>
+ </target>
+
+ <target name="testFTPURL">
+ <assertUrlReachable url="ftp://localhost"/>
+ </target>
+
+ <target name="testFile">
+ <assertUrlReachable url="file://build.xml"/>
+ </target>
+
+ <target name="testBadURL">
+ <assertUrlReachable url="uuid:3349-4404-0ac0ddee"/>
+ </target>
+
+ <target name="testBadTimeout">
+ <condition property="testBadTimeout">
+ <isreachable host="localhost" timeout="-1"/>
+ </condition>
+ </target>
+
+ <target name="testNoTargets">
+ <condition property="none">
+ <isreachable/>
+ </condition>
+ </target>
+</project>