You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2006/05/30 17:19:24 UTC

svn commit: r410302 - /cocoon/branches/BRANCH_2_1_X/src/test/org/apache/cocoon/matching/WildcardURIMatcherTestCase.java

Author: cziegeler
Date: Tue May 30 08:19:24 2006
New Revision: 410302

URL: http://svn.apache.org/viewvc?rev=410302&view=rev
Log:
Add testcase that show a bug in the wildcard matcher!

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=410302&r1=410301&r2=410302&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 May 30 08:19:24 2006
@@ -28,14 +28,33 @@
         Parameters parameters = new Parameters();
 
         Map result = match("wildcard-uri", "**", parameters);
-        System.out.println(result);
         assertNotNull("Test if resource exists", result);
         assertEquals("Test for **", "test/foo/bla/end", result.get("1"));
         
         result = match("wildcard-uri", "**/bla/*", parameters);
-        System.out.println(result);
         assertNotNull("Test if resource exists", result);
         assertEquals("Test for **/bla/* {1}", "test/foo", result.get("1"));
         assertEquals("Test for **/bla/* {2}", "end", result.get("2"));
+    }
+
+    public void testWildcardURIMatchSimplePattern() throws Exception {
+        getRequest().setRequestURI("/test");
+
+        final Parameters parameters = new Parameters();
+
+        Map result = match("wildcard-uri", "*", parameters);
+        assertNotNull("Test if resource exists", result);
+        assertEquals("Test for *", "test", result.get("1"));
+    }
+
+    public void testWildcardURIMatchDoublePattern() throws Exception {
+        getRequest().setRequestURI("/test/something.xmlbla.xml");
+
+        final Parameters parameters = new Parameters();
+
+        Map result = match("wildcard-uri", "*/*.xml", parameters);
+        assertNotNull("Test if resource exists", result);
+        assertEquals("Test for */*.xml", "test", result.get("1"));
+        assertEquals("Test for */*.xml", "something.xmlbla", result.get("2"));
     }
 }