blob: 0811369e699a8f6916cfe185a4265afb22e60939 [file] [log] [blame]
<?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:lzma destfile="${output}/file.lzma">
<fileset dir="${output}/empty" />
</cmp:lzma>
</au:expectfailure>
</target>
<target name="testFailTwo" depends="setUp">
<au:expectfailure expectedmessage="Can only have one source.">
<cmp:lzma destfile="${output}/file.lzma">
<fileset dir="${output}" />
</cmp:lzma>
</au:expectfailure>
</target>
<target name="testFailNoDest" depends="setUp">
<au:expectfailure expectedmessage="dest resource is required.">
<cmp:lzma src="${output}/fileone">
<dest>
<fileset dir="${output}/empty" />
</dest>
</cmp:lzma>
</au:expectfailure>
</target>
<target name="testFailTwoDests" depends="setUp">
<au:expectfailure expectedmessage="Can only have one destination resource.">
<cmp:lzma src="${output}/fileone">
<dest>
<fileset dir="${output}" />
</dest>
</cmp:lzma>
</au:expectfailure>
</target>
<target name="testRealTest" depends="setUp">
<cmp:lzma src="../resources/asf-logo.gif"
destfile="${output}/asf-logo.gif.lzma" />
<au:assertLogContains text="Building: asf-logo.gif.lzma"/>
<au:assertFileExists file="${output}/asf-logo.gif.lzma"/>
</target>
<target name="testRealTestWithResource" depends="setUp">
<cmp:lzma destfile="${output}/asf-logo.gif.lzma">
<file file="../resources/asf-logo.gif"/>
</cmp:lzma>
<au:assertLogContains text="Building: asf-logo.gif.lzma"/>
<au:assertFileExists file="${output}/asf-logo.gif.lzma"/>
</target>
<target name="testDateCheck" depends="setUp">
<touch file="${output}/asf-logo.gif.lzma"/>
<cmp:lzma src="../resources/asf-logo.gif"
destfile="${output}/asf-logo.gif.lzma" />
<au:assertLogContains text="Nothing to do: asf-logo.gif.lzma is up to date."/>
</target>
<target name="testNestedTask" depends="setUp">
<cmp:lzma destfile="${output}/asf-logo.tar.lzma">
<cmp:tar>
<cmp:cpiofileset src="../resources/asf-logo.gif.bin.cpio"
includes="asf-logo.gif"/>
</cmp:tar>
</cmp:lzma>
<au:assertFileExists file="${output}/asf-logo.tar.lzma"/>
<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">
<cmp:lzmaresource>
<file file="${output}/asf-logo.tar.lzma"/>
</cmp:lzmaresource>
</cmp:tarentry>
</cond:islastmodified>
</au:assertTrue>
</target>
</project>