Author: polx Date: Sat Dec 6 14:53:57 2008 New Revision: 724048 URL: http://svn.apache.org/viewvc?rev=724048&view=rev Log: getTagLibrary > getTagLib thus avoiding the conflict with tag-libs' tags which had their own getTagLibrary (returning their own tag-lib-class!). Added BaseJellyTest's addCustomTagLib which allows the remaining tests of John Spackman to be working (as reported on JELLY-286. Hopefully the first part of this fix solves the gump issues. paul
Modified: commons/proper/jelly/trunk/project.xml commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/Tag.java commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/TagSupport.java commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/impl/TagScript.java commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/test/BaseJellyTest.java commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestNamespacePrefixes.java commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestUnknownTags.java commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/expression/TestCustomExpressionFactory.java Modified: commons/proper/jelly/trunk/project.xml URL: http://svn.apache.org/viewvc/commons/proper/jelly/trunk/project.xml?rev=724048&r1=724047&r2=724048&view=diff ============================================================================== --- commons/proper/jelly/trunk/project.xml (original) +++ commons/proper/jelly/trunk/project.xml Sat Dec 6 14:53:57 2008 @@ -418,9 +418,6 @@ </includes> <excludes> <exclude>**/TestCoreMemoryLeak.java</exclude> - <exclude>**/TestNamespacePrefixes.java</exclude> - <exclude>**/TestUnknownTags.java</exclude> - <exclude>**/TestCustomExpressionFactory.java</exclude> <!-- --> <exclude>**/TestNestedExceptions.java</exclude> Modified: commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/Tag.java URL: http://svn.apache.org/viewvc/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/Tag.java?rev=724048&r1=724047&r2=724048&view=diff ============================================================================== --- commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/Tag.java (original) +++ commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/Tag.java Sat Dec 6 14:53:57 2008 @@ -45,13 +45,13 @@ * (ie a StaticTag) * @return */ - public TagLibrary getTagLibrary(); + public TagLibrary getTagLib(); /** * Sets the tag library * @param tagLibrary */ - public void setTagLibrary(TagLibrary tagLibrary); + public void setTagLib(TagLibrary tagLibrary); /** * @return the body of the tag Modified: commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/TagSupport.java URL: http://svn.apache.org/viewvc/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/TagSupport.java?rev=724048&r1=724047&r2=724048&view=diff ============================================================================== --- commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/TagSupport.java (original) +++ commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/TagSupport.java Sat Dec 6 14:53:57 2008 @@ -157,18 +157,18 @@ } /* (non-Javadoc) - * @see org.apache.commons.jelly.Tag#getTagLibrary() + * @see org.apache.commons.jelly.Tag#getTagLib() */ - public TagLibrary getTagLibrary() { + public TagLibrary getTagLib() { return tagLibrary; } /* (non-Javadoc) - * @see org.apache.commons.jelly.Tag#setTagLibrary(org.apache.commons.jelly.TagLibrary) + * @see org.apache.commons.jelly.Tag#setTagLib(org.apache.commons.jelly.TagLibrary) */ - public void setTagLibrary(TagLibrary tagLibrary) { + public void setTagLib(TagLibrary tagLibrary) { if (this.tagLibrary != null && tagLibrary != this.tagLibrary) - throw new IllegalArgumentException("Cannot setTagLibrary once set"); + throw new IllegalArgumentException("Cannot setTagLib once set"); this.tagLibrary = tagLibrary; } Modified: commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/impl/TagScript.java URL: http://svn.apache.org/viewvc/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/impl/TagScript.java?rev=724048&r1=724047&r2=724048&view=diff ============================================================================== --- commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/impl/TagScript.java (original) +++ commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/impl/TagScript.java Sat Dec 6 14:53:57 2008 @@ -530,7 +530,7 @@ * Compiles a newly created tag if required, sets its parent and body. */ protected void configureTag(Tag tag, JellyContext context) throws JellyException { - tag.setTagLibrary(tagLibrary); + tag.setTagLib(tagLibrary); if (tag instanceof CompilableTag) { ((CompilableTag) tag).compile(); } Modified: commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/test/BaseJellyTest.java URL: http://svn.apache.org/viewvc/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/test/BaseJellyTest.java?rev=724048&r1=724047&r2=724048&view=diff ============================================================================== --- commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/test/BaseJellyTest.java (original) +++ commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/test/BaseJellyTest.java Sat Dec 6 14:53:57 2008 @@ -39,11 +39,15 @@ super.setUp(); jelly = new Jelly(); context = new JellyContext(); + addCustomTagLib(context); jelly.setJellyContext(context); strOutput = new StringWriter(); xmlOutput = XMLOutput.createXMLOutput(strOutput); } + protected void addCustomTagLib(JellyContext context) { + } + protected void setUpScript(String scriptname) throws Exception { URL url = this.getClass().getResource(scriptname); if(null == url) { Modified: commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestNamespacePrefixes.java URL: http://svn.apache.org/viewvc/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestNamespacePrefixes.java?rev=724048&r1=724047&r2=724048&view=diff ============================================================================== --- commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestNamespacePrefixes.java (original) +++ commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestNamespacePrefixes.java Sat Dec 6 14:53:57 2008 @@ -27,6 +27,7 @@ import org.apache.commons.jelly.JellyContext; import org.apache.commons.jelly.Script; +import org.apache.commons.jelly.TJTagLibrary; import org.apache.commons.jelly.parser.XMLParser; import org.apache.commons.jelly.test.BaseJellyTest; import org.xml.sax.InputSource; @@ -48,6 +49,12 @@ return new TestSuite(TestNamespacePrefixes.class); } + protected void addCustomTagLib(JellyContext context) { + context.registerTagLibrary(TJTagLibrary.NS, TJTagLibrary.class.getName()); + } + + + public void testNamespacePrefixes() throws Exception { SAXParserFactory pf = SAXParserFactory.newInstance(); pf.setValidating(false); Modified: commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestUnknownTags.java URL: http://svn.apache.org/viewvc/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestUnknownTags.java?rev=724048&r1=724047&r2=724048&view=diff ============================================================================== --- commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestUnknownTags.java (original) +++ commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestUnknownTags.java Sat Dec 6 14:53:57 2008 @@ -20,6 +20,8 @@ import org.apache.commons.jelly.JellyException; import org.apache.commons.jelly.Script; +import org.apache.commons.jelly.JellyContext; +import org.apache.commons.jelly.TJTagLibrary; import org.apache.commons.jelly.test.BaseJellyTest; import org.xml.sax.SAXParseException; @@ -39,6 +41,10 @@ return new TestSuite(TestUnknownTags.class); } + protected void addCustomTagLib(JellyContext context) { + context.registerTagLibrary(TJTagLibrary.NS, TJTagLibrary.class.getName()); + } + public void testUnknownTags() throws Exception { setUpScript("testUnknownTags.xml"); try { Modified: commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/expression/TestCustomExpressionFactory.java URL: http://svn.apache.org/viewvc/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/expression/TestCustomExpressionFactory.java?rev=724048&r1=724047&r2=724048&view=diff ============================================================================== --- commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/expression/TestCustomExpressionFactory.java (original) +++ commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/expression/TestCustomExpressionFactory.java Sat Dec 6 14:53:57 2008 @@ -9,10 +9,7 @@ import junit.framework.TestSuite; import junit.textui.TestRunner; -import org.apache.commons.jelly.JellyContext; -import org.apache.commons.jelly.Script; -import org.apache.commons.jelly.TJTagLibrary; -import org.apache.commons.jelly.XMLOutput; +import org.apache.commons.jelly.*; import org.apache.commons.jelly.test.BaseJellyTest; public class TestCustomExpressionFactory extends BaseJellyTest { @@ -24,6 +21,11 @@ super("TestCustomExpressionFactory"); } + protected void addCustomTagLib(JellyContext context) { + context.registerTagLibrary(TJTagLibrary.NS, TJTagLibrary.class.getName()); + } + + public void testCustomFactory() throws Exception { setUpScript("jelly1.xml"); Script script = getJelly().compileScript();