blob: 810ad33aa5fbe886080cef15dfeb3db172767efd [file] [log] [blame]
<?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 xmlns:au="antlib:org.apache.ant.antunit" default="antunit">
<import file="../antunit-base.xml"/>
<extension-point name="testExtensionPointWorksLikeTarget"
depends="setProperty, assertProperty"/>
<target name="setProperty">
<property name="foo" value="bar"/>
</target>
<target name="assertProperty">
<au:assertPropertyEquals name="foo" value="bar"/>
</target>
<target name="testExtensionPointMustBeEmpty">
<mkdir dir="${output}"/>
<echo file="${output}/build.xml"><![CDATA[
<project>
<extension-point name="foo">
<echo>bar</echo>
</extension-point>
</project>]]></echo>
<au:expectfailure
expectedMessage="you must not nest child elements into an extension-point">
<ant dir="${output}"/>
</au:expectfailure>
</target>
<target name="testAddToExtensionPoint">
<mkdir dir="${output}"/>
<echo file="${output}/build.xml"><![CDATA[
<project default="foo">
<extension-point name="foo"/>
<target name="bar" extensionOf="foo">
<echo>In target bar</echo>
</target>
</project>]]></echo>
<ant dir="${output}"/>
<au:assertLogContains text="In target bar"/>
</target>
<target name="testCantAddToPlainTarget">
<mkdir dir="${output}"/>
<echo file="${output}/build.xml"><![CDATA[
<project default="foo">
<target name="foo"/>
<target name="bar" extensionOf="foo"/>
</project>]]></echo>
<au:expectfailure
expectedMessage="referenced target foo is not an extension-point">
<ant dir="${output}"/>
</au:expectfailure>
</target>
<target name="testExtensionPointInImportedBuildfile" description="Bug 48804">
<mkdir dir="${output}"/>
<echo file="${output}/master.xml"><![CDATA[
<project default="bar">
<extension-point name="foo"/>
<target name="bar" depends="foo"/>
</project>]]></echo>
<echo file="${output}/build.xml"><![CDATA[
<project>
<import file="master.xml"/>
<target name="prepare" extensionOf="foo">
<echo>in target prepare</echo>
</target>
</project>]]></echo>
<ant dir="${output}" target="bar"/>
<au:assertLogContains text="in target prepare"/>
</target>
</project>