[Jsptest-svn-commits] SF.net SVN: jsptest:[242] trunk
Status: Alpha
Brought to you by:
lkoskela
From: <lko...@us...> - 2008-11-07 22:21:37
|
Revision: 242 http://jsptest.svn.sourceforge.net/jsptest/?rev=242&view=rev Author: lkoskela Date: 2008-11-07 22:21:33 +0000 (Fri, 07 Nov 2008) Log Message: ----------- Implemented a patch from Meinert Schwartau with minor modifications. JspTest now has the ability to stub/mock/fake individual tags, not just whole tag libraries. Modified Paths: -------------- trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/JspCompilationInfo.java trunk/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspCompiler.java trunk/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/JspTestCase.java trunk/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/compiler/dummy/FakeJspCompiler.java trunk/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspCompilerImpl.java trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JasperCompiler.java trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JasperExecution.java trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JspCompilerImpl.java trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/mock/MockOptions.java trunk/jsptest-jsp20/src/main/java/org/apache/jasper/compiler/MockTagPluginManager.java trunk/jsptest-jsp21/src/main/java/net/sf/jsptest/compiler/jsp21/JspCompilerImpl.java Added Paths: ----------- 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 Modified: trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java =================================================================== --- trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java 2008-11-07 22:05:06 UTC (rev 241) +++ trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java 2008-11-07 22:21:33 UTC (rev 242) @@ -22,6 +22,7 @@ /** * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) */ public class TestMockingTaglibs extends JspTestCase { @@ -34,7 +35,7 @@ } /** - * This taglib class gets to replace the real thing. + * This taglib class gets to replace the real thing (<c:_/>). */ public static class MockCustomTag extends CustomTag { @@ -52,9 +53,39 @@ } } - public void testRenderingJspUsingCustomTaglibs() throws Exception { + /** + * This taglib class gets to replace the real thing (<c:out/>). + */ + public static class MockCustomOutTag extends CustomTag { + + public void setValue(String value) { + } + + public int doStartTag() throws JspException { + try { + JspWriter out = pageContext.getOut(); + out.print("replaced"); + } catch (Exception e) { + throw new JspException(e); + } + return TagSupport.SKIP_BODY; + } + + public int doEndTag() throws JspException { + return TagSupport.EVAL_PAGE; + } + } + + public void testSubstitutingCustomTaglibs() throws Exception { substituteTaglib("custom", MockCustomTag.class); get("/taglibs/custom-taglib.jsp"); output().shouldContain("This content is coming from the mock CustomTag"); } + + public void testSubstitutingSpecificTagWithinTagLibrary() throws Exception { + substituteTag("c", "out", MockCustomOutTag.class); + get("/taglibs/standard-taglibs.jsp"); + output().shouldNotContain("loop-1"); + output().shouldContain("replaced-replaced"); + } } Modified: trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/JspCompilationInfo.java =================================================================== --- trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/JspCompilationInfo.java 2008-11-07 22:05:06 UTC (rev 241) +++ trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/JspCompilationInfo.java 2008-11-07 22:21:33 UTC (rev 242) @@ -25,6 +25,7 @@ * find input) and add newly created information (where the output went). * * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) */ public class JspCompilationInfo { @@ -36,10 +37,12 @@ private String classOutputDir; private String webRoot; private Map taglibs; + private Map tags; private static Map compilationHistory = new HashMap(); public JspCompilationInfo() { this.taglibs = new HashMap(); + this.tags = new HashMap(); } private String absolute(String path) { @@ -116,6 +119,26 @@ this.webRoot = webRoot; } + public Map getTaglibs() { + return taglibs; + } + + public void setTaglibs(Map taglibs) { + this.taglibs = new HashMap(taglibs); + } + + public Map getTags() { + return tags; + } + + public void setTags(Map tags) { + this.tags = new HashMap(tags); + } + + public synchronized void compilationWasSuccessful() { + compilationHistory.put(jspSourceLocation, new LastCompile(taglibs, tags)); + } + public synchronized boolean jspCompilationRequired() { // TODO: only avoid compilation if there is a matching MD5 for the .jsp // file in a cache or if the file is missing altogether. @@ -123,21 +146,23 @@ File java = new File(javaSourceLocation); File clazz = new File(classFileLocation); return (doesNotExistOrIsTooOld(clazz) || doesNotExistOrIsTooOld(java) - || jsp.lastModified() > java.lastModified() || taglibsHaveChangedSinceLastCompile()); + || jsp.lastModified() > java.lastModified() || taglibsHaveChangedSinceLastCompile() || tagsHaveChangedSinceLastCompile()); } private boolean taglibsHaveChangedSinceLastCompile() { - Map taglibs = (Map) compilationHistory.get(getJspSource()); - if (taglibs == null) { - // first compilation -> must compile + LastCompile lastCompile = (LastCompile) compilationHistory.get(getJspSource()); + if (lastCompile == null) { return true; } - if (!taglibs.equals(getTaglibs())) { - // not the first compilation but taglibs were configured differently - // for the previous compilation so we need a new one + return !lastCompile.getTaglibs().equals(getTaglibs()); + } + + private boolean tagsHaveChangedSinceLastCompile() { + LastCompile lastCompile = (LastCompile) compilationHistory.get(getJspSource()); + if (lastCompile == null) { return true; } - return false; + return !lastCompile.getTags().equals(getTags()); } private boolean doesNotExistOrIsTooOld(File file) { @@ -146,15 +171,27 @@ return file.exists() == false || file.lastModified() < expirationThreshold; } - public void setTaglibs(Map taglibs) { - this.taglibs = new HashMap(taglibs); - } + /** + * Represents the tag configuration of a prior compilation. + * + * @author Meinert Schwartau (scwar32) + */ + private static final class LastCompile { - public Map getTaglibs() { - return taglibs; - } + private final Map taglibs; + private final Map tags; - public synchronized void compilationWasSuccessful() { - compilationHistory.put(jspSourceLocation, taglibs); + public LastCompile(Map taglibs, Map tags) { + this.taglibs = taglibs; + this.tags = tags; + } + + public Map getTags() { + return tags; + } + + public Map getTaglibs() { + return taglibs; + } } } Modified: trunk/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspCompiler.java =================================================================== --- trunk/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspCompiler.java 2008-11-07 22:05:06 UTC (rev 241) +++ trunk/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspCompiler.java 2008-11-07 22:21:33 UTC (rev 242) @@ -2,9 +2,13 @@ import java.util.Map; +/** + * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) + */ public interface JspCompiler { - Jsp compile(String path, Map taglibs); + Jsp compile(String path, Map taglibs, Map tags); void setWebRoot(String directory); 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 22:05:06 UTC (rev 241) +++ trunk/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/JspTestCase.java 2008-11-07 22:21:33 UTC (rev 242) @@ -32,6 +32,7 @@ * renders the expected kind of output. * * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) */ public abstract class JspTestCase extends TestCase { @@ -39,6 +40,7 @@ private Map requestAttributes; private Map sessionAttributes; private Map substituteTaglibs; + private Map substituteTags; private JspExecution execution; public JspTestCase() { @@ -53,6 +55,7 @@ requestAttributes = new HashMap(); sessionAttributes = new HashMap(); substituteTaglibs = new HashMap(); + substituteTags = new HashMap(); } /** @@ -124,7 +127,7 @@ + new File(getWebRoot()).getAbsolutePath()); compiler.setWebRoot(getWebRoot()); compiler.setOutputDirectory(getOutputDirectory()); - Jsp jsp = compiler.compile(path, substituteTaglibs); + Jsp jsp = compiler.compile(path, substituteTaglibs, substituteTags); log.debug("Simulating a request to " + path); execution = jsp.request(httpMethod, requestAttributes, sessionAttributes); } @@ -164,4 +167,16 @@ protected void substituteTaglib(String name, Class newImplementation) { substituteTaglibs.put(name, newImplementation); } + + /** + * Invoke this method to substitute the specified taglib with the given implementation. + * + * @param name + * The name of the taglib to replace. + * @param newImplementation + * The new (substitute) implementation to use. + */ + protected void substituteTag(String prefix, String name, Class newImplementation) { + substituteTags.put(new TagKey(prefix, name), newImplementation); + } } Added: 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 (rev 0) +++ trunk/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/TagKey.java 2008-11-07 22:21:33 UTC (rev 242) @@ -0,0 +1,55 @@ +package net.sf.jsptest; + +/** + * @author Meinert Schwartau (scwar32) + */ +public class TagKey { + + private final String prefix; + private final String name; + + public TagKey(String prefix, String name) { + this.prefix = prefix; + this.name = name; + } + + public String toString() { + return prefix + ":" + name; + } + + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((prefix == null) ? 0 : prefix.hashCode()); + return result; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final TagKey other = (TagKey) obj; + if (name == null) { + if (other.name != null) { + return false; + } + } else if (!name.equals(other.name)) { + return false; + } + if (prefix == null) { + if (other.prefix != null) { + return false; + } + } else if (!prefix.equals(other.prefix)) { + return false; + } + return true; + } +} Added: 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 (rev 0) +++ trunk/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/TagKeyTest.java 2008-11-07 22:21:33 UTC (rev 242) @@ -0,0 +1,29 @@ +package net.sf.jsptest; + +import junit.framework.TestCase; + +/** + * @author Lasse Koskela + */ +public class TagKeyTest extends TestCase { + + public void testEqualsAndHashcode() throws Exception { + // TODO: add EqualsTester to the class path and use that + TagKey subject = new TagKey("prefix", "name"); + TagKey samePrefixSameName = new TagKey("prefix", "name"); + TagKey samePrefixDifferentName = new TagKey("prefix", "different"); + TagKey differentPrefixDifferentName = new TagKey("different", "different"); + TagKey differentPrefixSameName = new TagKey("different", "different"); + assertTrue(subject.equals(subject)); + assertEquals(subject.hashCode(), subject.hashCode()); + assertTrue(subject.equals(samePrefixSameName)); + assertEquals(subject.hashCode(), samePrefixSameName.hashCode()); + assertFalse(subject.equals(samePrefixDifferentName)); + assertFalse(subject.equals(differentPrefixSameName)); + assertFalse(subject.equals(differentPrefixDifferentName)); + } + + public void testToStringPrettyPrints() throws Exception { + assertEquals("prefix:name", new TagKey("prefix", "name").toString()); + } +} Modified: trunk/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/compiler/dummy/FakeJspCompiler.java =================================================================== --- trunk/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/compiler/dummy/FakeJspCompiler.java 2008-11-07 22:05:06 UTC (rev 241) +++ trunk/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/compiler/dummy/FakeJspCompiler.java 2008-11-07 22:21:33 UTC (rev 242) @@ -5,6 +5,10 @@ import net.sf.jsptest.compiler.api.JspCompiler; import net.sf.jsptest.compiler.api.JspExecution; +/** + * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) + */ public class FakeJspCompiler implements JspCompiler { private static StringBuffer fakedOutput = new StringBuffer(2000); @@ -28,7 +32,7 @@ fakedOutput.append(content); } - public Jsp compile(String path, Map taglibs) { + public Jsp compile(String path, Map taglibs, Map tags) { lastCompiledWebRoot = getWebRoot(); lastCompiledPath = path; return new Jsp() { Modified: trunk/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspCompilerImpl.java =================================================================== --- trunk/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspCompilerImpl.java 2008-11-07 22:05:06 UTC (rev 241) +++ trunk/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspCompilerImpl.java 2008-11-07 22:21:33 UTC (rev 242) @@ -4,9 +4,13 @@ import net.sf.jsptest.compiler.api.Jsp; import net.sf.jsptest.compiler.api.JspCompiler; +/** + * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) + */ public class JspCompilerImpl implements JspCompiler { - public Jsp compile(String path, Map taglibs) { + public Jsp compile(String path, Map taglibs, Map tags) { throw new RuntimeException("Not implemented"); } Modified: trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JasperCompiler.java =================================================================== --- trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JasperCompiler.java 2008-11-07 22:05:06 UTC (rev 241) +++ trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JasperCompiler.java 2008-11-07 22:21:33 UTC (rev 242) @@ -70,6 +70,7 @@ * "front_page_jsp.class" the normalized class name derived from the source JSP file's name. * * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) */ public class JasperCompiler { @@ -105,10 +106,12 @@ * @param path * The path to the JSP source file to compile, given relative to the web root. * @param mockTaglibs - * Mapping of tagnames to tag handler classes + * Mapping of tag names to tag handler classes + * @param mockTags + * Mapping of <tt>TagKey</tt>s to tag handler classes */ - public JspCompilationInfo compile(String path, Map mockTaglibs) throws Exception { - JspCompilationInfo info = createJspCompilationInfo(path, mockTaglibs); + public JspCompilationInfo compile(String path, Map mockTaglibs, Map mockTags) throws Exception { + JspCompilationInfo info = createJspCompilationInfo(path, mockTaglibs, mockTags); if (info.jspCompilationRequired()) { compileJsp(info); compileJavaToBytecode(info); @@ -136,13 +139,14 @@ } } - private JspCompilationInfo createJspCompilationInfo(String jsp, Map mockTaglibs) { + private JspCompilationInfo createJspCompilationInfo(String jsp, Map mockTaglibs, Map mockTags) { JspCompilationInfo info = new JspCompilationInfo(); info.setJspPath(jsp); info.setClassOutputDir(classOutputBaseDir); info.setJspSource(resolveJspSourceFile(jsp)); info.setWebRoot(getWebRoot()); info.setTaglibs(mockTaglibs); + info.setTags(mockTags); resolveJavaSourceFile(info); resolveClassFileLocation(info); resolveClassName(info); @@ -232,7 +236,7 @@ private Options createOptions(ServletContext ctx, ServletConfig cfg, JspCompilationInfo info) { Options options = new EmbeddedServletOptions(cfg, ctx); - return new MockOptions(options, ctx, info.getTaglibs()); + return new MockOptions(options, ctx, info); } private void resolveJavaSourceFile(JspCompilationInfo info) { Modified: trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JasperExecution.java =================================================================== --- trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JasperExecution.java 2008-11-07 22:05:06 UTC (rev 241) +++ trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JasperExecution.java 2008-11-07 22:21:33 UTC (rev 242) @@ -50,6 +50,7 @@ * system. * * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) */ public abstract class JasperExecution extends TestCase { @@ -184,10 +185,15 @@ } private Class compileToClass(String path) throws Exception, ClassNotFoundException { - JspCompilationInfo compilation = getCompiler().compile(path, mockTaglibs); + // TODO: why are the mocks for taglibs and tags handled differently here? + JspCompilationInfo compilation = getCompiler().compile(path, mockTaglibs, getMockTags()); return loadJspClass(compilation.getClassName()); } + protected Map getMockTags() { + return new HashMap(); + } + private JasperCompiler getCompiler() { compiler.setWebRoot(getWebRoot()); compiler.setClassOutputBaseDir(getClassOutputBaseDir()); Modified: trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JspCompilerImpl.java =================================================================== --- trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JspCompilerImpl.java 2008-11-07 22:05:06 UTC (rev 241) +++ trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JspCompilerImpl.java 2008-11-07 22:21:33 UTC (rev 242) @@ -7,6 +7,10 @@ import net.sf.jsptest.compiler.api.JspCompiler; import net.sf.jsptest.utils.CustomClassLoader; +/** + * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) + */ public class JspCompilerImpl implements JspCompiler { private String outputDirectory = new File(System.getProperty("java.io.tmpdir"), @@ -29,12 +33,12 @@ return webRoot; } - public Jsp compile(final String jspPath, Map taglibs) { + public Jsp compile(final String jspPath, Map taglibs, Map tags) { try { JasperCompiler compiler = new JasperCompiler(); compiler.setWebRoot(getWebRoot()); compiler.setClassOutputBaseDir(getOutputDirectory()); - JspCompilationInfo info = compiler.compile(jspPath, taglibs); + JspCompilationInfo info = compiler.compile(jspPath, taglibs, tags); final Class servletClass = compileToClass(info); return new JspImpl(servletClass); } catch (Exception e) { Modified: trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/mock/MockOptions.java =================================================================== --- trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/mock/MockOptions.java 2008-11-07 22:05:06 UTC (rev 241) +++ trunk/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/mock/MockOptions.java 2008-11-07 22:21:33 UTC (rev 242) @@ -18,6 +18,7 @@ import java.io.File; import java.util.Map; import javax.servlet.ServletContext; +import net.sf.jsptest.compiler.JspCompilationInfo; import net.sf.jsptest.compiler.jsp20.mock.taglibs.MockTldLocationsCache; import org.apache.jasper.Options; import org.apache.jasper.compiler.JspConfig; @@ -27,17 +28,18 @@ /** * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) */ public class MockOptions implements Options { private Options options; private ServletContext servletContext; - private Map taglibs; + private JspCompilationInfo compilationInfo; - public MockOptions(Options options, ServletContext context, Map taglibs) { + public MockOptions(Options options, ServletContext context, JspCompilationInfo compilationInfo) { this.options = options; this.servletContext = context; - this.taglibs = taglibs; + this.compilationInfo = compilationInfo; } public boolean getErrorOnUseBeanInvalidClassAttribute() { @@ -130,7 +132,8 @@ } public TagPluginManager getTagPluginManager() { - return new MockTagPluginManager(servletContext, options.getTagPluginManager(), taglibs); + return new MockTagPluginManager(servletContext, options.getTagPluginManager(), + compilationInfo.getTaglibs(), compilationInfo.getTags()); } public boolean genStringAsCharArray() { 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 22:05:06 UTC (rev 241) +++ trunk/jsptest-jsp20/src/main/java/org/apache/jasper/compiler/MockTagPluginManager.java 2008-11-07 22:21:33 UTC (rev 242) @@ -5,16 +5,23 @@ import java.util.HashMap; import java.util.Map; import javax.servlet.ServletContext; +import net.sf.jsptest.TagKey; import org.apache.jasper.JasperException; import org.apache.jasper.compiler.Node.Nodes; +/** + * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) + */ public class MockTagPluginManager extends TagPluginManager { protected Map mockTaglibs; + protected Map mockTags; - public MockTagPluginManager(ServletContext ctx, TagPluginManager tagPluginManager, Map taglibs) { + public MockTagPluginManager(ServletContext ctx, TagPluginManager manager, Map taglibs, Map tags) { super(ctx); mockTaglibs = new HashMap(taglibs); + mockTags = new HashMap(tags); } public void apply(Nodes nodes, ErrorDispatcher errorDispatcher, PageInfo pageInfo) @@ -25,6 +32,11 @@ } private void visitPageNodes(Nodes nodes) throws JasperException { + replaceTaglibs(nodes); + replaceTags(nodes); + } + + private void replaceTaglibs(Nodes nodes) throws JasperException { nodes.visit(new Node.Visitor() { public void visit(Node.CustomTag n) throws JasperException { @@ -38,6 +50,21 @@ }); } + private void replaceTags(Nodes nodes) throws JasperException { + nodes.visit(new Node.Visitor() { + + public void visit(Node.CustomTag n) throws JasperException { + String prefix = n.getTagInfo().getTagLibrary().getPrefixString(); + String name = n.getTagInfo().getTagName(); + Class mockClass = (Class) mockTags.get(new TagKey(prefix, name)); + if (mockClass != null) { + n.setTagHandlerClass(mockClass); + } + super.visit(n); + } + }); + } + private void assignToPrivateField(String fieldName, Object value) { try { Field field = getClass().getSuperclass().getDeclaredField(fieldName); Modified: trunk/jsptest-jsp21/src/main/java/net/sf/jsptest/compiler/jsp21/JspCompilerImpl.java =================================================================== --- trunk/jsptest-jsp21/src/main/java/net/sf/jsptest/compiler/jsp21/JspCompilerImpl.java 2008-11-07 22:05:06 UTC (rev 241) +++ trunk/jsptest-jsp21/src/main/java/net/sf/jsptest/compiler/jsp21/JspCompilerImpl.java 2008-11-07 22:21:33 UTC (rev 242) @@ -4,9 +4,13 @@ import net.sf.jsptest.compiler.api.Jsp; import net.sf.jsptest.compiler.api.JspCompiler; +/** + * @author Lasse Koskela + * @author Meinert Schwartau (scwar32) + */ public class JspCompilerImpl implements JspCompiler { - public Jsp compile(String path, Map taglibs) { + public Jsp compile(String path, Map taglibs, Map tags) { throw new RuntimeException("Not implemented"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |