[Jsptest-svn-commits] SF.net SVN: jsptest:[244] trunk
Status: Alpha
Brought to you by:
lkoskela
From: <lko...@us...> - 2008-11-08 06:33:32
|
Revision: 244 http://jsptest.svn.sourceforge.net/jsptest/?rev=244&view=rev Author: lkoskela Date: 2008-11-08 06:33:30 +0000 (Sat, 08 Nov 2008) Log Message: ----------- Refactored both types of 'mocked taglibs' to use TagKey as the hash key. This gives us consistency but also allows us to refactor the two HashMaps into one. Modified Paths: -------------- trunk/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/JspTestCase.java trunk/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/TagKey.java trunk/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/TagKeyTest.java trunk/jsptest-jsp20/src/main/java/org/apache/jasper/compiler/MockTagPluginManager.java Modified: trunk/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/JspTestCase.java =================================================================== --- trunk/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/JspTestCase.java 2008-11-07 23:00:53 UTC (rev 243) +++ trunk/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/JspTestCase.java 2008-11-08 06:33:30 UTC (rev 244) @@ -165,7 +165,7 @@ * The new (substitute) implementation to use. */ protected void substituteTaglib(String name, Class newImplementation) { - substituteTaglibs.put(name, newImplementation); + substituteTaglibs.put(new TagKey(name), newImplementation); } /** Modified: trunk/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/TagKey.java =================================================================== --- trunk/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/TagKey.java 2008-11-07 23:00:53 UTC (rev 243) +++ trunk/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/TagKey.java 2008-11-08 06:33:30 UTC (rev 244) @@ -8,6 +8,10 @@ private final String prefix; private final String name; + public TagKey(String prefix) { + this(prefix, "*"); + } + public TagKey(String prefix, String name) { this.prefix = prefix; this.name = name; Modified: trunk/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/TagKeyTest.java =================================================================== --- trunk/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/TagKeyTest.java 2008-11-07 23:00:53 UTC (rev 243) +++ trunk/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/TagKeyTest.java 2008-11-08 06:33:30 UTC (rev 244) @@ -26,4 +26,8 @@ public void testToStringPrettyPrints() throws Exception { assertEquals("prefix:name", new TagKey("prefix", "name").toString()); } + + public void testTagNameDefaultsToAsteriskIfNotSet() throws Exception { + assertEquals(new TagKey("prefix", "*"), new TagKey("prefix")); + } } Modified: trunk/jsptest-jsp20/src/main/java/org/apache/jasper/compiler/MockTagPluginManager.java =================================================================== --- trunk/jsptest-jsp20/src/main/java/org/apache/jasper/compiler/MockTagPluginManager.java 2008-11-07 23:00:53 UTC (rev 243) +++ trunk/jsptest-jsp20/src/main/java/org/apache/jasper/compiler/MockTagPluginManager.java 2008-11-08 06:33:30 UTC (rev 244) @@ -42,7 +42,7 @@ protected Class substitute(TagInfo tagInfo) { String tagName = tagInfo.getTagLibrary().getPrefixString(); - return (Class) mockTaglibs.get(tagName); + return (Class) mockTaglibs.get(new TagKey(tagName)); } }); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |