| <?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 |
| |
| https://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="xxx-test" basedir="." default="test1"> |
| |
| <import file="../buildfiletest-base.xml"/> |
| |
| <target name="setUp"> |
| <mkdir dir="${output}"/> |
| </target> |
| |
| |
| <target name="test1"> |
| <unzip/> |
| </target> |
| |
| <target name="test2"> |
| <unzip src=""/> |
| </target> |
| |
| <target name="test3"> |
| <unzip dest=""/> |
| </target> |
| |
| <target name="testZipTask"> |
| <ant antfile="zip.xml" target="feather" /> |
| <unzip src="${output}/asf-logo.gif.zip" dest="${output}" /> |
| </target> |
| |
| <target name="testUncompressedZipTask"> |
| <ant antfile="zip.xml" target="uncompressed-feather" /> |
| <unzip src="${output}/asf-logo.gif.zip" dest="${output}" /> |
| </target> |
| |
| <target name="realTest"> |
| <unzip src="expected/asf-logo.gif.zip" dest="${output}" /> |
| </target> |
| |
| <target name="prepareTestZip"> |
| <mkdir dir="${output}/unziptestin/1"/> |
| <mkdir dir="${output}/unziptestin/2"/> |
| <touch file="${output}/unziptestin/1/foo"/> |
| <touch file="${output}/unziptestin/2/bar"/> |
| <zip destfile="${output}/unziptest.zip" basedir="${output}/unziptestin"/> |
| </target> |
| |
| <target name="testPatternSetExcludeOnly" depends="prepareTestZip"> |
| <unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> |
| <patternset> |
| <exclude name="1/**"/> |
| </patternset> |
| </unzip> |
| </target> |
| |
| <target name="testPatternSetIncludeOnly" depends="prepareTestZip"> |
| <unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> |
| <patternset> |
| <include name="2/**"/> |
| </patternset> |
| </unzip> |
| </target> |
| |
| <target name="testPatternSetIncludeAndExclude" depends="prepareTestZip"> |
| <unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> |
| <patternset> |
| <include name="2/**"/> |
| <exclude name="2/**"/> |
| </patternset> |
| </unzip> |
| </target> |
| |
| <target name="testTwoPatternSets" depends="prepareTestZip"> |
| <unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> |
| <patternset> |
| <include name="2/**"/> |
| </patternset> |
| <patternset> |
| <include name="3/**"/> |
| </patternset> |
| </unzip> |
| </target> |
| |
| <target name="testTwoPatternSetsWithExcludes" depends="prepareTestZip"> |
| <unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> |
| <patternset> |
| <include name="2/**"/> |
| </patternset> |
| <patternset> |
| <exclude name="1/**"/> |
| <exclude name="2/**"/> |
| </patternset> |
| </unzip> |
| </target> |
| |
| <target name="selfExtractingArchive"> |
| <mkdir dir="${output}/unziptestout"/> |
| <unzip dest="${output}/unziptestout" src="zip/test.exe"/> |
| </target> |
| |
| <!-- Bugzilla Report 20969 --> |
| <target name="testPatternSetSlashOnly" depends="prepareTestZip"> |
| <unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> |
| <patternset> |
| <include name="2/"/> |
| </patternset> |
| </unzip> |
| </target> |
| |
| <!-- Bugzilla Report 10504 --> |
| <target name="encodingTest"> |
| <mkdir dir="${output}/unziptestin"/> |
| <touch file="${output}/unziptestin/foo"/> |
| <zip zipfile="${output}/unziptest.zip" basedir="${output}/unziptestin" encoding="UnicodeBig"/> |
| <mkdir dir="${output}/unziptestout"/> |
| <unzip src="${output}/unziptest.zip" dest="${output}/unziptestout" encoding="UnicodeBig"/> |
| </target> |
| |
| <!-- Bugzilla Report 21996 --> |
| <target name="testFlattenMapper" depends="prepareTestZip"> |
| <unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> |
| <patternset> |
| <include name="1/**"/> |
| </patternset> |
| <mapper type="flatten"/> |
| </unzip> |
| </target> |
| |
| <!-- Bugzilla Report 21996 --> |
| <target name="testGlobMapper" depends="prepareTestZip"> |
| <unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> |
| <patternset> |
| <include name="1/**"/> |
| </patternset> |
| <mapper type="glob" from="*" to="*.txt"/> |
| </unzip> |
| </target> |
| |
| <target name="testTwoMappers" depends="prepareTestZip"> |
| <unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> |
| <patternset> |
| <include name="1/**"/> |
| </patternset> |
| <mapper type="glob" from="*" to="*.txt"/> |
| <mapper type="flatten"/> |
| </unzip> |
| </target> |
| |
| <target name="testResourceCollection"> |
| <unzip dest="${output}/unziptestout"> |
| <patternset> |
| <include name="junit/**"/> |
| </patternset> |
| <restrict> |
| <path path="${java.class.path}"/> |
| <type type="file" xmlns="antlib:org.apache.tools.ant.types.resources.selectors"/> |
| </restrict> |
| </unzip> |
| </target> |
| |
| <target name="testDocumentationClaimsOnCopy" depends="prepareTestZip"> |
| <copy todir="${output}/unziptestout" preservelastmodified="true"> |
| <zipfileset src="${output}/unziptest.zip"> |
| <patternset> |
| <include name="2/"/> |
| </patternset> |
| </zipfileset> |
| </copy> |
| </target> |
| </project> |