| <?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 default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> |
| <import file="../antunit-base.xml" /> |
| |
| <target name="testChecksumConditionWithFileSet"> |
| <mkdir dir="${output}"/> |
| <checksum todir="${output}"> |
| <fileset dir="."/> |
| </checksum> |
| <condition property="checksumsMatch"> |
| <checksum todir="${output}"> |
| <fileset dir="."/> |
| </checksum> |
| </condition> |
| <au:assertPropertySet name="checksumsMatch"/> |
| </target> |
| |
| <target name="testTotalPropertyAcrossPlatforms" |
| description="testcase for |
| https://issues.apache.org/bugzilla/show_bug.cgi?id=36748"> |
| <mkdir dir="${input}"/> |
| <echo file="${input}/a.txt">abc</echo> |
| <echo file="${input}/subdir/A.txt">def</echo> |
| <echo file="${input}/B.txt">xyz</echo> |
| <checksum totalproperty="total"> |
| <fileset dir="${input}"/> |
| </checksum> |
| <au:assertPropertyEquals name="total" |
| value="f4d688789d32e6ca6bc93c504dbc6b46"/> |
| </target> |
| |
| <target name="testChecksumPattern2"> |
| <mkdir dir="${output}"/> |
| <mkdir dir="${input}"/> |
| <echo file="${input}/a.txt">abc</echo> |
| <checksum todir="${output}" pattern="{2}"> |
| <fileset dir="${input}"/> |
| </checksum> |
| <au:assertResourceContains |
| resource="${output}/a.txt.MD5" |
| value="../testinput/a.txt"/> |
| </target> |
| |
| <target name="testChecksumPattern3"> |
| <mkdir dir="${output}"/> |
| <checksum todir="${output}" pattern="{3}"> |
| <fileset dir=".." includes="types/fileset-test.xml"/> |
| </checksum> |
| <au:assertResourceContains |
| resource="${output}/types/fileset-test.xml.MD5" |
| value="../types/fileset-test.xml"/> |
| </target> |
| |
| <target name="testChecksumPattern4"> |
| <mkdir dir="${output}"/> |
| <mkdir dir="${input}"/> |
| <property name="a" location="${input}/a.txt"/> |
| <echo file="${a}">abc</echo> |
| <checksum todir="${output}" pattern="{4}"> |
| <fileset dir="${input}"/> |
| </checksum> |
| <au:assertResourceContains |
| resource="${output}/a.txt.MD5" |
| value="${a}"/> |
| </target> |
| |
| </project> |