Actually, resources as attributes don't work very well

git-svn-id: https://svn.apache.org/repos/asf/ant/antlibs/antunit/trunk@1351063 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Bodewig 2012-06-17 07:05:30 +00:00
parent e9b4bb4ae9
commit 1bdfe608f6
4 changed files with 132 additions and 0 deletions

View File

@ -44,6 +44,7 @@ public class ResourceExists extends ProjectComponent implements Condition {
throw new BuildException("Only one resource can be tested.");
}
resource = r;
System.err.println("R: " + r);
}
/**

View File

@ -0,0 +1,39 @@
<?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="antunit-base">
<property name="antunit.tmpdir" location="${java.io.tmpdir}"/>
<property name="input" location="${antunit.tmpdir}/testinput"/>
<property name="output" location="${antunit.tmpdir}/testoutput"/>
<condition property="build.sysclasspath.only">
<equals arg1="${build.sysclasspath}" arg2="only"/>
</condition>
<target name="tearDown">
<delete dir="${input}"/>
<delete dir="${output}"/>
</target>
<target name="antunit">
<antunit xmlns="antlib:org.apache.ant.antunit">
<plainlistener />
<file file="${ant.file}" xmlns="antlib:org.apache.tools.ant" />
</antunit>
</target>
</project>

View File

@ -0,0 +1,33 @@
<?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 xmlns:au="antlib:org.apache.ant.antunit" default="antunit">
<import file="antunit-base.xml"/>
<target name="NOtestURL"
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=53383">
<au:assertResourceExists resource="http://ant.apache.org/index.html"/>
</target>
<target name="NOtestURLUsingRef"
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=53383">
<url url="http://ant.apache.org/index.html" id="antsite"/>
<au:assertResourceExists resource="${ant.refid:antsite}"/>
</target>
</project>

View File

@ -0,0 +1,59 @@
<?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 xmlns:au="antlib:org.apache.ant.antunit" default="antunit">
<import file="antunit-base.xml"/>
<target name="test-yes">
<au:assertTrue>
<au:resourceExists>
<file file="resourceexists-test.xml"/>
</au:resourceExists>
</au:assertTrue>
</target>
<target name="test-no">
<au:assertFalse>
<au:resourceExists>
<file file="resourceexists-test-not-there.xml"/>
</au:resourceExists>
</au:assertFalse>
</target>
<target name="testURL">
<au:assertTrue>
<au:resourceExists>
<url url="http://ant.apache.org/index.html"/>
</au:resourceExists>
</au:assertTrue>
</target>
<target name="NOtestURLAttribute">
<au:assertTrue>
<au:resourceExists resource="http://ant.apache.org/index.html"/>
</au:assertTrue>
</target>
<target name="testURLAttributeUsingRef">
<url url="http://ant.apache.org/index.html" id="antsite"/>
<au:assertTrue>
<au:resourceExists resource="${ant.refid:antsite}"/>
</au:assertTrue>
</target>
</project>