From: "Peter Lynch" <[EMAIL PROTECTED]>
> Hello,
>
> I tried to write a Jelly Unit test case for Ant filtersets. Thanks James
> Strachan for the pointers.
>
> Here is my test case I used:
>
> <!-- test case to show how filtersets are broken -->
> <test:case name="antFilterset">
>
>   <ant:filterset id="maven.webserver.filterset.default">
>       <ant:filter token="maven.webserver.home" value="some dir" />
>   </ant:filterset>
>   <ant:copy file="src/test/org/apache/commons/jelly/ant/AntFilterset.txt"
>
tofile="src/test/org/apache/commons/jelly/ant/AntFilterset.properties">
>     <ant:filterset refid="maven.webserver.filterset.default" />
>   </ant:copy>
> </test:case>
>
>
> [java] [ERROR] AntTag - -Class org.apache.commons.jelly.tags.junit.CaseTag
> doesn't support the nested "filterset" element.
>     [java]      [echo]
>     [java]      [echo]
>     [java]      [copy] Copying 1 file to
>
G:\cygwin\home\plynch\dev\apache\jakarta-commons-sandbox\jelly\src\test\org\
apac
> he\commons\jelly\ant
>
>
> Before the copy AntFilterset.txt file contains simply:
>
> [EMAIL PROTECTED]@
>
> After the copy, u guessed it:
>
> [EMAIL PROTECTED]@
>
>
> Needless to say the filter token was not replaced in the copied file.
Something
> needs to be done in order for the filterset to be nested in the case tag
for
> starters.


Sorry this took such a while to get to and figure out. The short answer is I
think I've fixed this now.

I took your JellyUnit test cases and got them working as well as adding a
test both for a nested <filterset> and a <filterset id=".." and nested
<filterset refid="..."/>. You can see the JellyUnit test case here (named
copy and copyWithReference)

http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/jelly/src/test/org/apa
che/commons/jelly/ant/suite.jelly?rev=HEAD


The short explaination for why this was a bug was that the nested <filter>
element was incorrectly being treated as a Task in the logic, rather than as
a nested property. (AntTag handles the 2 cases differenty).

Now we will only treat Ant tags as being a Task if they are the root Ant
element and if the tags name is a known Task name, otherwise its treated as
either an Ant datatype or a nested property.

I'm a little worried this change could break Maven since

* some Maven plugins might now break since filtering actually works now
* I always worry I might break something whenever I change AntTag

So I've only made this change in CVS HEAD for now.

James
-------
http://radio.weblogs.com/0112098/


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to