|
- <?xml version="1.0"?>
- <!--
- 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.
- -->
- <project name="hostinfo-test" default="antunit"
- xmlns:au="antlib:org.apache.ant.antunit">
-
- <import file="../antunit-base.xml" />
-
- <property name="undef-name" value="nonexistenthost.nonexistentdomain" />
- <property name="undef-hostname" value="nonexistenthost" />
- <property name="undef-domainname" value="nonexistentdomain" />
-
- <property name="undef-ip4" value="0.0.0.0" />
- <property name="undef-ip6" value="::" />
-
- <property name="apache-hostname" value="www.apache.org" />
- <property name="apache-domain" value="apache.org" />
- <property name="apache-realhost" value="eos" />
- <property name="apache-ip4" value="140.211.11.131" />
-
- <property name="apache-realhost.gump" value="www" />
- <property name="apache-domain.gump" value="apache.org" />
-
- <property name="xs4all-hostname" value="www.xs4all.nl" />
- <property name="xs4all-domain" value="xs4all.nl" />
- <property name="xs4all-realhost" value="www" />
- <property name="xs4all-ip4" value="194.109.6.92" />
-
- <target name="setUp">
- </target>
-
- <target name="testLocal" depends="setUp">
- <hostinfo prefix="local" />
- <!-- Do not know what to expect here, machine dependent -->
- </target>
-
- <target name="testApache" depends="setUp">
- <hostinfo prefix="apache" host="${apache-hostname}"/>
- <au:assertTrue>
- <or>
- <equals arg1="${apache-realhost}" arg2="${apache.NAME}"/>
- <equals arg1="${apache-realhost.gump}" arg2="${apache.NAME}"/>
- </or>
- </au:assertTrue>
- <au:assertTrue>
- <or>
- <equals arg1="${apache-domain}" arg2="${apache.DOMAIN}"/>
- <equals arg1="${apache-domain.gump}" arg2="${apache.DOMAIN}"/>
- </or>
- </au:assertTrue>
- <au:assertEquals expected="${apache-ip4}" actual="${apache.ADDR4}"/>
- </target>
-
- <target name="testApacheNoPrefix" depends="setUp">
- <hostinfo host="${apache-hostname}"/>
- <au:assertTrue>
- <or>
- <equals arg1="${apache-realhost}" arg2="${NAME}"/>
- <equals arg1="${apache-realhost.gump}" arg2="${NAME}"/>
- </or>
- </au:assertTrue>
- <au:assertTrue>
- <or>
- <equals arg1="${apache-domain}" arg2="${DOMAIN}"/>
- <equals arg1="${apache-domain.gump}" arg2="${DOMAIN}"/>
- </or>
- </au:assertTrue>
- <au:assertEquals expected="${apache-ip4}" actual="${ADDR4}"/>
- </target>
-
- <target name="testReverse" depends="setUp">
- <hostinfo prefix="reverse" host="${xs4all-ip4}"/>
- <au:assertEquals expected="${xs4all-realhost}" actual="${reverse.NAME}"/>
- <au:assertEquals expected="${xs4all-domain}" actual="${reverse.DOMAIN}"/>
- <au:assertEquals expected="${xs4all-ip4}" actual="${reverse.ADDR4}"/>
- </target>
-
-
- <target name="testUndef" depends="setUp">
- <hostinfo prefix="undef" host="${undef-name}"/>
- <au:assertEquals expected="${undef-hostname}" actual="${undef.NAME}"/>
- <au:assertEquals expected="${undef-domainname}" actual="${undef.DOMAIN}"/>
- <au:assertEquals expected="${undef-ip4}" actual="${undef.ADDR4}"/>
- </target>
-
- </project>
|