<?xml version="1.0"?> | |
<!-- | |
Copyright 2002,2004 The Apache Software Foundation. | |
Licensed 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. | |
--> | |
<!-- uses a JellyBean, which invokes the run() method --> | |
<j:jelly | |
xmlns:j="jelly:core" | |
xmlns:define="jelly:define" | |
xmlns:log="jelly:log" | |
xmlns:my="myDummyTagLib" | |
xmlns="jelly:ant"> | |
<testcase> | |
<log:info>Lets define a new tag library</log:info> | |
<define:taglib uri="myDummyTagLib"> | |
<define:jellybean name="foo" className="org.apache.commons.jelly.tags.define.MyRunnable"> | |
<define:attribute name="y" defaultValue="wine"/> | |
</define:jellybean> | |
<!-- | |
This was added to demonstrate a ClassCastException when a | |
dynamic tag is created that uses a dynamically jelly bean and | |
called more than once. You should be able to call the dynamically | |
created tag n times without problem now. | |
--> | |
<define:tag name="bar"> | |
<my:foo x="2" y="cheese"> | |
<fileset dir="."> | |
<include name="*.xml"/> | |
</fileset> | |
<fileset dir="src/java"> | |
<include name="*.java"/> | |
</fileset> | |
</my:foo> | |
</define:tag> | |
</define:taglib> | |
<log:info>Now lets invoke the new Jelly bean tag</log:info> | |
<my:foo x="2" y="cheese"> | |
<fileset dir="."> | |
<include name="*.xml"/> | |
</fileset> | |
<fileset dir="src/java"> | |
<include name="*.java"/> | |
</fileset> | |
</my:foo> | |
<log:info>Did that work?</log:info> | |
<my:foo x="2"> | |
<fileset dir="."> | |
<include name="*.xml"/> | |
</fileset> | |
</my:foo> | |
<!-- You should be able to run dynamic tags n times without ClassCastExceptions --> | |
<my:bar/> | |
<my:bar/> | |
</testcase> | |
</j:jelly> | |