| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| 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" |
| xmlns:cond="antlib:org.apache.tools.ant.types.conditions" |
| xmlns:cmp="antlib:org.apache.ant.compress"> |
| |
| <import file="antunit-base.xml" /> |
| |
| <target name="setUp"> |
| <mkdir dir="${output}" /> |
| <mkdir dir="${output}/empty" /> |
| <touch file="${output}/fileone" /> |
| <touch file="${output}/filetwo" /> |
| </target> |
| |
| <target name="testFailNone" depends="setUp"> |
| <au:expectfailure expectedmessage="source is required."> |
| <cmp:gzip destfile="${output}/file.gz"> |
| <fileset dir="${output}/empty" /> |
| </cmp:gzip> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testFailTwo" depends="setUp"> |
| <au:expectfailure expectedmessage="Can only have one source."> |
| <cmp:gzip destfile="${output}/file.gz"> |
| <fileset dir="${output}" /> |
| </cmp:gzip> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testFailNoDest" depends="setUp"> |
| <au:expectfailure expectedmessage="dest resource is required."> |
| <cmp:gzip src="${output}/fileone"> |
| <dest> |
| <fileset dir="${output}/empty" /> |
| </dest> |
| </cmp:gzip> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testFailTwoDests" depends="setUp"> |
| <au:expectfailure expectedmessage="Can only have one destination resource."> |
| <cmp:gzip src="${output}/fileone"> |
| <dest> |
| <fileset dir="${output}" /> |
| </dest> |
| </cmp:gzip> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testRealTest" depends="setUp"> |
| <cmp:gzip src="../resources/asf-logo.gif" |
| destfile="${output}/asf-logo.gif.gz" /> |
| <au:assertLogContains text="Building: asf-logo.gif.gz"/> |
| <au:assertFileExists file="${output}/asf-logo.gif.gz"/> |
| </target> |
| |
| <target name="testRealTestWithResource" depends="setUp"> |
| <cmp:gzip destfile="${output}/asf-logo.gif.gz"> |
| <file file="../resources/asf-logo.gif"/> |
| </cmp:gzip> |
| <au:assertLogContains text="Building: asf-logo.gif.gz"/> |
| <au:assertFileExists file="${output}/asf-logo.gif.gz"/> |
| </target> |
| |
| <target name="testDateCheck" depends="setUp"> |
| <touch file="${output}/asf-logo.gif.gz"/> |
| <cmp:gzip src="../resources/asf-logo.gif" |
| destfile="${output}/asf-logo.gif.gz" /> |
| <au:assertLogContains text="Nothing to do: asf-logo.gif.gz is up to date."/> |
| </target> |
| |
| <target name="testNestedTask" depends="setUp"> |
| <cmp:gzip destfile="${output}/asf-logo.tar.gz"> |
| <cmp:tar> |
| <cmp:cpiofileset src="../resources/asf-logo.gif.bin.cpio" |
| includes="asf-logo.gif"/> |
| </cmp:tar> |
| </cmp:gzip> |
| <au:assertFileExists file="${output}/asf-logo.tar.gz"/> |
| <au:assertTrue> |
| <cond:islastmodified datetime="2009-07-31-20:11:13 +0200" |
| pattern="yyyy-MM-dd-HH:mm:ss Z"> |
| <cmp:tarentry name="asf-logo.gif"> |
| <gzipresource> |
| <file file="${output}/asf-logo.tar.gz"/> |
| </gzipresource> |
| </cmp:tarentry> |
| </cond:islastmodified> |
| </au:assertTrue> |
| </target> |
| </project> |