You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2006/06/27 17:39:35 UTC
svn commit: r417489 -
/cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java
Author: andreas
Date: Tue Jun 27 08:39:35 2006
New Revision: 417489
URL: http://svn.apache.org/viewvc?rev=417489&view=rev
Log:
Added failing test to WildcardURIMatcherTestCase: **/*.html results in wrong wildcard replacements
Modified:
cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java
Modified: cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java?rev=417489&r1=417488&r2=417489&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java Tue Jun 27 08:39:35 2006
@@ -57,4 +57,16 @@
assertEquals("Test for */*.xml", "test", result.get("1"));
assertEquals("Test for */*.xml", "something.xmlbla", result.get("2"));
}
+
+ public void testWildcardURIMatchMultiSinglePattern() throws Exception {
+ getRequest().setRequestURI("foo/bar/baz.html");
+
+ final Parameters parameters = new Parameters();
+
+ Map result = match("wildcard-uri", "**/*.html", parameters);
+ assertNotNull("Test if resource exists", result);
+ assertEquals("Test for {1} in **/*.html", "foo/bar", result.get("1"));
+ assertEquals("Test for {2} in **/*.html", "baz", result.get("2"));
+ }
+
}
Re: svn commit: r417489 -
/cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java
Posted by Giacomo Pati <gi...@apache.org>.
On Tue, 27 Jun 2006, andreas@apache.org wrote:
> Date: Tue, 27 Jun 2006 15:39:35 -0000
> From: andreas@apache.org
> Reply-To: dev@cocoon.apache.org
> To: cvs@cocoon.apache.org
> Subject: svn commit: r417489 -
> /cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/Wildcard
> URIMatcherTestCase.java
>
> Author: andreas
> Date: Tue Jun 27 08:39:35 2006
> New Revision: 417489
>
> URL: http://svn.apache.org/viewvc?rev=417489&view=rev
> Log:
> Added failing test to WildcardURIMatcherTestCase: **/*.html results in wrong wildcard replacements
I'll have a look at it tomorrow. Thanks for spotting it :-)
Ciao
Giacomo
Re: svn commit: r417489 -
/cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java
Posted by Giacomo Pati <gi...@apache.org>.
On Tue, 27 Jun 2006, andreas@apache.org wrote:
> Date: Tue, 27 Jun 2006 15:39:35 -0000
> From: andreas@apache.org
> Reply-To: dev@cocoon.apache.org
> To: cvs@cocoon.apache.org
> Subject: svn commit: r417489 -
> /cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/Wildcard
> URIMatcherTestCase.java
>
> Author: andreas
> Date: Tue Jun 27 08:39:35 2006
> New Revision: 417489
>
> URL: http://svn.apache.org/viewvc?rev=417489&view=rev
> Log:
> Added failing test to WildcardURIMatcherTestCase: **/*.html results in wrong wildcard replacements
I'll have a look at it tomorrow. Thanks for spotting it :-)
Ciao
Giacomo
Re: svn commit: r417489 -
/cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java
Posted by Giacomo Pati <gi...@apache.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, 28 Jun 2006, Giacomo Pati wrote:
> Date: Wed, 28 Jun 2006 09:55:59 +0200 (CEST)
> From: Giacomo Pati <gi...@apache.org>
> Reply-To: dev@cocoon.apache.org
> To: dev@cocoon.apache.org
> Subject: Re: svn commit: r417489 -
> /cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/Wildcard
> URIMatcherTestCase.java
>
> --[PinePGP]--------------------------------------------------[begin]--
> On Wed, 28 Jun 2006, Andreas Hartmann wrote:
>
>> Date: Wed, 28 Jun 2006 09:21:54 +0200
>> From: Andreas Hartmann <an...@apache.org>
>> Reply-To: dev@cocoon.apache.org
>> To: dev@cocoon.apache.org
>> Subject: Re: svn commit: r417489 -
>> /cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/Wildcard
>> URIMatcherTestCase.java
>>
>> Giacomo Pati wrote:
>> > On Tue, 27 Jun 2006, andreas@apache.org wrote:
>> >
>> > > Date: Tue, 27 Jun 2006 15:39:35 -0000
>> > > From: andreas@apache.org
>> > > Reply-To: dev@cocoon.apache.org
>> > > To: cvs@cocoon.apache.org
>> > > Subject: svn commit: r417489 -
>> > > /cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/Wildcard
>> > >
>> > > URIMatcherTestCase.java
>> > >
>> > > Author: andreas
>> > > Date: Tue Jun 27 08:39:35 2006
>> > > New Revision: 417489
>> > >
>> > > URL: http://svn.apache.org/viewvc?rev=417489&view=rev
>> > > Log:
>> > > Added failing test to WildcardURIMatcherTestCase: **/*.html results
>> > > in
>> > > wrong wildcard replacements
>> >
>> > I'll have a look at it tomorrow.
>>
>> That would be great, thanks a lot!
>>
>> I took a quick look at WildcardMatcherHelper.Matcher.match(), but it
>> looked a little to complex. I guess the problem is that the double
My hope was that the comments in there would be fair enough for someone
else to understand (sure some serious study is needed anyway for such
algorithms) and fix it if it's broken :-)
It should be fixed now. Please try to find another test case that
doesn't work as this Wilcard matching is a tricky thing anyway and
because it is a replacement from scratch it might have another bug not
yet discovered (but I'm confident we got it now).
Ciao
Giacomo
- --
Giacomo Pati
Otego AG, Switzerland - http://www.otego.com
Orixo, the XML business alliance - http://www.orixo.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
iD8DBQFEojjFLNdJvZjjVZARAingAJ9VHZhrvB9mfNeDpEb8FCScGtlDPQCfRyq4
I2nKu0Lla3mPGu0/2OJf8XQ=
=AyQh
-----END PGP SIGNATURE-----
Re: svn commit: r417489 -
/cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java
Posted by Giacomo Pati <gi...@apache.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, 28 Jun 2006, Andreas Hartmann wrote:
> Date: Wed, 28 Jun 2006 09:21:54 +0200
> From: Andreas Hartmann <an...@apache.org>
> Reply-To: dev@cocoon.apache.org
> To: dev@cocoon.apache.org
> Subject: Re: svn commit: r417489 -
> /cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/Wildcard
> URIMatcherTestCase.java
>
> Giacomo Pati wrote:
>> On Tue, 27 Jun 2006, andreas@apache.org wrote:
>>
>> > Date: Tue, 27 Jun 2006 15:39:35 -0000
>> > From: andreas@apache.org
>> > Reply-To: dev@cocoon.apache.org
>> > To: cvs@cocoon.apache.org
>> > Subject: svn commit: r417489 -
>> > /cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/Wildcard
>> >
>> > URIMatcherTestCase.java
>> >
>> > Author: andreas
>> > Date: Tue Jun 27 08:39:35 2006
>> > New Revision: 417489
>> >
>> > URL: http://svn.apache.org/viewvc?rev=417489&view=rev
>> > Log:
>> > Added failing test to WildcardURIMatcherTestCase: **/*.html results in
>> > wrong wildcard replacements
>>
>> I'll have a look at it tomorrow.
>
> That would be great, thanks a lot!
>
> I took a quick look at WildcardMatcherHelper.Matcher.match(), but it
> looked a little to complex. I guess the problem is that the double
> asterisk is not greedy enough, but I have no idea how to fix it :)
Yes, it's exaclty that. I've changed the greedyness of the '**' wildcard
with the consequence that other test cases now won't deliver same
results (all having multiple '**' wildcards, and thus have changed them
accordingly).
> I wondered, though, that the Javadocs say that the method works from
> the end to the start, but it looks like it actually works from the
> start to the end - maybe it's related to that?
Hmm.. I thought I've changed all the javadocs accordingly. The first
algorithm was processing from end to start but this as shown to be more
complex in the end so I've change it from start to end. I'll checck the
javadocs again. Tnanks.
Ciao
Giacomo
- --
Giacomo Pati
Otego AG, Switzerland - http://www.otego.com
Orixo, the XML business alliance - http://www.orixo.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
iD8DBQFEojYRLNdJvZjjVZARAnb2AKDVR+Rm11Ir6eWkTC/6gGBVkESguACgvOuu
HN/hL5O/xrLB8PrMIyA8Nu4=
=zZur
-----END PGP SIGNATURE-----
Re: svn commit: r417489 - /cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java
Posted by Andreas Hartmann <an...@apache.org>.
Giacomo Pati wrote:
> On Tue, 27 Jun 2006, andreas@apache.org wrote:
>
>> Date: Tue, 27 Jun 2006 15:39:35 -0000
>> From: andreas@apache.org
>> Reply-To: dev@cocoon.apache.org
>> To: cvs@cocoon.apache.org
>> Subject: svn commit: r417489 -
>>
>> /cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/Wildcard
>>
>> URIMatcherTestCase.java
>>
>> Author: andreas
>> Date: Tue Jun 27 08:39:35 2006
>> New Revision: 417489
>>
>> URL: http://svn.apache.org/viewvc?rev=417489&view=rev
>> Log:
>> Added failing test to WildcardURIMatcherTestCase: **/*.html results in
>> wrong wildcard replacements
>
> I'll have a look at it tomorrow.
That would be great, thanks a lot!
I took a quick look at WildcardMatcherHelper.Matcher.match(), but it
looked a little to complex. I guess the problem is that the double
asterisk is not greedy enough, but I have no idea how to fix it :)
I wondered, though, that the Javadocs say that the method works from
the end to the start, but it looks like it actually works from the
start to the end - maybe it's related to that?
-- Andreas
--
Andreas Hartmann
Wyona Inc. - Open Source Content Management - Apache Lenya
http://www.wyona.com http://lenya.apache.org
andreas.hartmann@wyona.com andreas@apache.org