commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject cvs commit: jakarta-commons/jelly/src/test/org/apache/commons/jelly suite.jelly
Date Mon, 21 Jun 2004 11:18:30 GMT
polx        2004/06/21 04:18:30

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/core
                        CoreTagLibrary.java
               jelly/src/test/org/apache/commons/jelly suite.jelly
  Added:       jelly/src/java/org/apache/commons/jelly/tags/core
                        MuteTag.java
  Log:
  Adding a mute tag which should allow cleaner XML-output along with
  attachd unit-test.
  Example usage include <j:mute>${doSomethingThatReturnsSomethingButWhichYouDontWant}</j:mute>.
  paul
  
  Revision  Changes    Path
  1.31      +2 -1      jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/CoreTagLibrary.java
  
  Index: CoreTagLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/CoreTagLibrary.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- CoreTagLibrary.java	5 Jun 2004 02:23:41 -0000	1.30
  +++ CoreTagLibrary.java	21 Jun 2004 11:18:30 -0000	1.31
  @@ -47,6 +47,7 @@
           // other tags
           registerTag("include", IncludeTag.class);
           registerTag("import", ImportTag.class);
  +		registerTag("mute", MuteTag.class);
           
           // extensions to JSTL
           registerTag("arg", ArgTag.class);
  
  
  
  1.1                  jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/MuteTag.java
  
  Index: MuteTag.java
  ===================================================================
  /*
   * Copyright 2002,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.commons.jelly.tags.core;
  
  import org.apache.commons.jelly.JellyTagException;
  import org.apache.commons.jelly.TagSupport;
  import org.apache.commons.jelly.XMLOutput;
  import org.xml.sax.helpers.DefaultHandler;
  
  
  /** A tag which executes its body but passing no output.
   *  <p>
   * Using this tag will still take the time to perform toString on each object
   * returned to the output (but this toString value is discarded. 
   * A future version should go more internally so that this is avoided.
   * 
   * @author <a href="mailto:paul@activemath.org">Paul Libbrecht</a>
   * @version $Revision: 1.1 $
    */
  public class MuteTag extends TagSupport {
  	
  	public MuteTag() {
  		super();
  	}
  	
  	
  	public void doTag(XMLOutput output) throws JellyTagException {
  		super.invokeBody(makeMuteOutput());
  	}
  	
  	
  	private XMLOutput makeMuteOutput() {
  		return new XMLOutput(new DefaultHandler());
  	}
  	
  } // class TagSupport
  
  
  
  1.18      +9 -0      jakarta-commons/jelly/src/test/org/apache/commons/jelly/suite.jelly
  
  Index: suite.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/src/test/org/apache/commons/jelly/suite.jelly,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- suite.jelly	25 Feb 2004 04:57:16 -0000	1.17
  +++ suite.jelly	21 Jun 2004 11:18:30 -0000	1.18
  @@ -329,5 +329,14 @@
       <test:assertTrue test="${test1 == null}"/> 
   
     </test:case>
  +	
  +	
  +	
  +	
  +	<!-- tests wether the mute tag indeed outputs nothing -->
  +	<test:case name="testMuteTag">
  +		<j:set var="shouldBeNothing"><j:mute>blop</j:mute></j:set>
  +		<test:assertEquals expected="" actual="${shouldBeNothing}"/>
  +		</test:case>
       
   </test:suite>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message