ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r564788 - /ant/core/trunk/src/tests/antunit/types/resources/selectors/test-componentdef.xml
Date Fri, 10 Aug 2007 22:29:41 GMT
Author: peterreilly
Date: Fri Aug 10 15:29:39 2007
New Revision: 564788

URL: http://svn.apache.org/viewvc?view=rev&rev=564788
Log:
unit test for componentdef - well a copy of the resources one without namespaces

Added:
    ant/core/trunk/src/tests/antunit/types/resources/selectors/test-componentdef.xml

Added: ant/core/trunk/src/tests/antunit/types/resources/selectors/test-componentdef.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/resources/selectors/test-componentdef.xml?view=auto&rev=564788
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/resources/selectors/test-componentdef.xml (added)
+++ ant/core/trunk/src/tests/antunit/types/resources/selectors/test-componentdef.xml Fri Aug
10 15:29:39 2007
@@ -0,0 +1,441 @@
+<project default="all" xmlns:au="antlib:org.apache.ant.antunit">
+
+  <available property="jdk1.4+" classname="java.lang.CharSequence"/>  
+  <condition property="some.regexp.support">
+    <or>
+      <isset property="jdk1.4+"/>
+      <isset property="apache.regexp.present"/>
+      <isset property="apache.oro.present"/>
+    </or>
+  </condition>    
+    
+  <target name="testname1">
+    <au:assertTrue>
+      <resourcecount when="equal" count="2">
+        <restrict>
+          <resources>
+            <resource name="foo" />
+            <resource name="bar" />
+            <resource name="baz" />
+            <resource name="boo" />
+            <resource name="bang" />
+          </resources>
+          <name name="ba?" />
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testname2">
+    <au:assertTrue>
+      <resourcecount when="equal" count="3">
+        <restrict>
+          <resources>
+            <file file="foo" />
+            <resource name="foo" />
+            <file file="foo" basedir="${basedir}" />
+          </resources>
+          <name name="foo" />
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="name" depends="testname1,testname2" />
+
+  <target name="testexists">
+    <au:assertTrue>
+      <resourcecount when="equal" count="1">
+        <restrict>
+          <resources>
+            <file file="idonotexist" />
+            <resource name="foo" />
+            <resource name="foo" exists="false" />
+          </resources>
+          <exists />
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testinstanceoftype1">
+    <au:assertTrue>
+      <resourcecount when="equal" count="2">
+        <restrict>
+          <resources>
+            <file file="foo" />
+            <url url="http://ant.apache.org/index.html" />
+            <resource name="foo" />
+            <string value="foo" />
+            <file file="bar" />
+          </resources>
+          <instanceof type="file" />
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testinstanceoftype2">
+    <typedef name="file" uri="test"
+             classname="org.apache.tools.ant.types.resources.FileResource" />
+    <au:assertTrue>
+      <resourcecount when="equal" count="1">
+        <restrict>
+          <resources>
+            <url file="foo" />
+            <file file="bar" xmlns="test" />
+          </resources>
+          <instanceof type="test:file" />
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testinstanceoftype3">
+    <typedef name="file" uri="test"
+             classname="org.apache.tools.ant.types.resources.FileResource" />
+    <au:assertTrue>
+      <resourcecount when="equal" count="1">
+        <restrict>
+          <resources>
+            <url file="foo" />
+            <file file="bar" xmlns="test" />
+          </resources>
+          <instanceof type="file" uri="test" />
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="instanceoftype"
+    depends="testinstanceoftype1,testinstanceoftype2,testinstanceoftype3" />
+
+  <target name="testinstanceofclass">
+    <au:assertTrue>
+      <resourcecount when="equal" count="7">
+        <restrict>
+          <resources>
+            <filelist dir="${basedir}" files="a,b,c,d,e,f,g" />
+          </resources>
+          <instanceof class="org.apache.tools.ant.types.Resource" />
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="instanceof" depends="instanceoftype,testinstanceofclass" />
+
+  <target name="testtype">
+    <au:assertTrue>
+      <resourcecount when="equal" count="2">
+        <restrict>
+          <resources>
+             <file file="${basedir}" />
+             <file file="${ant.file}" />
+             <resource directory="true" />
+             <resource directory="false" />
+          </resources>
+          <type type="dir" />
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testdate">
+    <au:assertTrue>
+      <resourcecount when="equal" count="3">
+        <restrict>
+          <resources>
+             <resource lastmodified="4" />
+             <resource lastmodified="5" />
+             <resource lastmodified="6" />
+             <resource lastmodified="7" />
+             <resource lastmodified="8" />
+          </resources>
+          <date when="after" millis="5" granularity="0" />
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testsize">
+    <au:assertTrue>
+      <resourcecount when="equal" count="4">
+        <restrict>
+          <resources>
+             <resource size="4" />
+             <resource size="5" />
+             <resource size="6" />
+             <resource size="7" />
+             <resource size="8" />
+          </resources>
+          <size when="le" size="7" />
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testand">
+    <au:assertTrue>
+      <resourcecount when="equal" count="1">
+        <restrict>
+          <resources>
+            <string value="fee" />
+            <resource name="fi" size="3" />
+            <resource name="fo" />
+            <resource name="fum" />
+          </resources>
+          <and xmlns="antlib:org.apache.tools.ant.types.resources.selectors">
+            <name name="f?" />
+            <size size="3" />
+          </and>
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testor">
+    <au:assertTrue>
+      <resourcecount when="equal" count="3">
+        <restrict>
+          <resources>
+            <string value="fee" />
+            <resource name="fi" size="3" />
+            <resource name="fo" />
+            <resource name="fum" />
+          </resources>
+          <or xmlns="antlib:org.apache.tools.ant.types.resources.selectors">
+            <name name="f?" />
+            <size size="3" />
+          </or>
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testnot">
+    <au:assertTrue>
+      <resourcecount when="equal" count="2">
+        <restrict>
+          <resources>
+            <string value="fee" />
+            <resource name="fi" size="3" />
+            <resource name="fo" />
+            <resource name="fum" />
+          </resources>
+          <not xmlns="antlib:org.apache.tools.ant.types.resources.selectors">
+            <size size="3" />
+          </not>
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testnone">
+    <au:assertTrue>
+      <resourcecount when="equal" count="1">
+        <restrict>
+          <resources>
+            <string value="fee" />
+            <resource name="fi" size="3" />
+            <resource name="fo" />
+            <resource name="fum" />
+          </resources>
+          <none xmlns="antlib:org.apache.tools.ant.types.resources.selectors">
+            <name name="f?" />
+            <size size="3" />
+          </none>
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testmajority1">
+    <au:assertTrue>
+      <resourcecount when="equal" count="2">
+        <restrict>
+          <resources>
+            <string value="fee" />
+            <resource name="fi" size="3" />
+            <resource name="fo" />
+            <resource name="fum" />
+          </resources>
+          <majority xmlns="antlib:org.apache.tools.ant.types.resources.selectors">
+            <name name="f?" />
+            <size size="3" />
+            <instanceof type="string" />
+          </majority>
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testmajority2">
+    <au:assertTrue>
+      <resourcecount when="equal" count="3">
+        <restrict>
+          <resources>
+            <string value="fee" />
+            <resource name="fi" size="3" />
+            <resource name="fo" />
+            <resource name="fum" />
+          </resources>
+          <majority>
+            <name name="f?" />
+            <size size="3" />
+            <instanceof type="resource" />
+          </majority>
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testmajority3">
+    <au:assertTrue>
+      <resourcecount when="equal" count="3">
+        <restrict>
+          <resources>
+            <string value="fee" />
+            <resource name="fi" size="3" />
+            <resource name="fo" />
+            <resource name="fum" />
+          </resources>
+          <majority allowtie="true">
+            <name name="f?" />
+            <size size="3" />
+            <instanceof type="string" />
+            <exists />
+          </majority>
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testmajority4">
+    <au:assertTrue>
+      <resourcecount when="equal" count="2">
+        <restrict>
+          <resources>
+            <string value="fee" />
+            <resource name="fi" size="3" />
+            <resource name="fo" />
+            <resource name="fum" />
+          </resources>
+          <majority allowtie="false">
+            <name name="f?" />
+            <size size="3" />
+            <instanceof type="string" />
+            <exists />
+          </majority>
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testcontains">
+    <au:assertTrue>
+      <resourcecount when="equal" count="2">
+        <restrict>
+          <resources>
+            <string value="foo" />
+            <string value="bar" />
+            <string value="baz" />
+          </resources>
+          <contains text="b"/>
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testcontainsregexp" if="some.regexp.support">
+    <au:assertTrue>
+      <resourcecount when="equal" count="2">
+        <restrict>
+          <resources>
+            <string value="foo" />
+            <string value="bar" />
+            <string value="baz" />
+          </resources>
+          <containsregexp expression="^b..$"/>
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
+  <target name="testcompare">
+    <au:assertTrue>
+      <and>
+        <!-- basic test, natural ordering -->
+        <resourcecount count="3">
+          <restrict>
+            <compare when="greater" against="each">
+              <control><string value="b" /></control>
+            </compare>
+            <resources>
+              <string value="a" />
+              <string value="b" />
+              <string value="c" />
+              <string value="d" />
+              <string value="e" />
+            </resources>
+          </restrict>
+        </resourcecount>
+        <!-- one comparator, default when/against -->
+        <resourcecount count="5">
+          <restrict>
+            <compare>
+              <control><string value="." /></control>
+              <size />
+            </compare>
+            <resources>
+              <string value="a" />
+              <string value="b" />
+              <string value="c" />
+              <string value="d" />
+              <string value="e" />
+            </resources>
+          </restrict>
+        </resourcecount>
+        <!-- multiple controls, comparators -->
+        <resourcecount count="3">
+          <restrict>
+            <compare when="greater" against="each">
+              <control>
+                <string value="a" />
+                <string value="b" />
+                <string value="bb" />
+                <string value="c" />
+                <string value="ccc" />
+              </control>
+              <name />
+              <size />
+            </compare>
+            <resources>
+              <string value="a" />
+              <string value="bbbb" />
+              <string value="ccc" />
+              <string value="cccc" />
+              <string value="d" />
+              <string value="e" />
+            </resources>
+          </restrict>
+        </resourcecount>
+      </and>
+    </au:assertTrue>
+  </target>
+
+  <target name="majority"
+          depends="testmajority1,testmajority2,testmajority3,testmajority4" />
+
+  <target name="logical"
+          depends="testand,testor,testnone,testnot,majority" />
+
+  <target name="all"
+    depends="name,testexists,instanceof,testtype,testdate,testsize,testcontains,testcontainsregexp,logical,testcompare"
/>
+
+  <!-- 
+    The tests for oata.types.selectors.ModifiedSelectorTest as 
+    ResourceSelector are in its test-buildfile src\etc\testcases\types\selectors.xml. 
+  -->
+
+</project>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message