|
- <?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" />
-
- <mkdir dir="${input}/a/b"/>
- <mkdir dir="${input}/a/c"/>
- <echo file="${input}/a/b/outer.xml"><![CDATA[
- <project name="outer">
- <import file="../c/inner.xml"/>
- </project>
- ]]></echo>
- <echo file="${input}/a/c/inner.xml"><![CDATA[
- <project name="inner">
- <target name="foo">
- <echo>In inner</echo>
- <echo>ant.file.inner is ${ant.file.inner}</echo>
- <echo>type is ${ant.file.type.inner}</echo>
- <loadproperties>
- <url baseUrl="${ant.file.inner}" relativePath="test.properties"/>
- </loadproperties>
- <echo>foo is ${foo}</echo>
- </target>
- </project>]]></echo>
- <echo file="${input}/a/c/test.properties"><![CDATA[
- foo=bar
- ]]></echo>
- <mkdir dir="${output}"/>
- <jar destfile="${output}/test.jar">
- <fileset dir="${input}"/>
- </jar>
- <delete dir="${input}"/>
-
- <import>
- <javaresource name="a/b/outer.xml">
- <classpath location="${output}/test.jar"/>
- </javaresource>
- </import>
-
- <target name="testImportOfNestedFile" depends="foo">
- <au:assertLogContains text="In inner"/>
- <au:assertLogContains text="type is url"/>
- <au:assertLogContains text="foo is bar"/>
- </target>
-
- <target name="tearDown" depends="close, antunit-base.tearDown"/>
-
- <target name="close">
- <taskdef name="close"
- classname="org.apache.tools.ant.taskdefs.CloseResources"/>
- <close>
- <javaresource name="a/b/outer.xml">
- <classpath location="${output}/test.jar"/>
- </javaresource>
- </close>
- </target>
- </project>
|