commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml XMLTagLibrary.java
Date Sat, 20 Jul 2002 08:12:04 GMT
jstrachan    2002/07/20 01:12:04

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/xml
                        XMLTagLibrary.java
  Added:       jelly/src/java/org/apache/commons/jelly/tags/junit
                        FailTag.java package.html JUnitTagLibrary.java
                        AssertTagSupport.java AssertTag.java
                        AssertEqualsTag.java
  Log:
  Added the core features of a JUnit library for Jelly.
  
  So usual JUnit style operations can be performed in an Ant script such as..
  
  <assert test="${foo.bar != null}">oh dear its broken</assert>
  
  or XPath assertions
  
  <assert xpath="/foo/bar[count(beer) != 0]">bar is dry!</assert>
  
  or a helper for testing equality
  
  <assertEquals actual="${foo}" expected="${xyz}"/>
  
  <fail>this test has failed</fail>
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/junit/FailTag.java
  
  Index: FailTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/FailTag.java,v
1.8 2002/07/06 13:53:39 dion Exp $
   * $Revision: 1.8 $
   * $Date: 2002/07/06 13:53:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: FailTag.java,v 1.8 2002/07/06 13:53:39 dion Exp $
   */
  package org.apache.commons.jelly.tags.junit;
  
  import org.apache.commons.jelly.XMLOutput;
  
  /** 
   * This tag causes a failure message. The message can either
   * be specified in the tags body or via the message attribute.
   *
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
   * @version $Revision: 1.8 $
   */
  public class FailTag extends AssertTagSupport {
  
      private String message;
  
      public FailTag() {
      }
  
      // Tag interface
      //------------------------------------------------------------------------- 
      public void doTag(XMLOutput output) throws Exception {
          String text = message;
          if ( text != null ) {
              text = getBodyText();
          }
          fail( text );
      }
      
      // Properties
      //-------------------------------------------------------------------------        
       
  
      /** 
       * Sets the failure message. If this attribute is not specified then the
       * body of this tag will be used instead.
       */
      public void setMessage(String message) {
          this.message = message;
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/junit/package.html
  
  Index: package.html
  ===================================================================
  <html>
  <head>
  </head>
  <body>
  
    <p>A collection of <a href="http://www.junit.org">JUnit</a> tags for

    	performing unit tests written in Jelly script.
    </p>
  </body>
  </html>
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/junit/JUnitTagLibrary.java
  
  Index: JUnitTagLibrary.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java,v
1.9 2002/06/18 08:31:02 jstrachan Exp $
   * $Revision: 1.9 $
   * $Date: 2002/06/18 08:31:02 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: XMLTagLibrary.java,v 1.9 2002/06/18 08:31:02 jstrachan Exp $
   */
  package org.apache.commons.jelly.tags.junit;
  
  import org.apache.commons.jelly.TagLibrary;
  
  import org.apache.commons.jelly.JellyException;
  import org.apache.commons.jelly.TagLibrary;
  import org.apache.commons.jelly.expression.Expression;
  import org.apache.commons.jelly.expression.ExpressionFactory;
  import org.apache.commons.jelly.tags.xml.XPathExpression;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  import org.jaxen.JaxenException;
  import org.jaxen.XPath;
  import org.jaxen.dom4j.Dom4jXPath;
  
  /** Describes the Taglib. This class could be generated by XDoclet
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.9 $
    */
  public class JUnitTagLibrary extends TagLibrary {
  
      /** The Log to which logging calls will be made. */
      private Log log = LogFactory.getLog(JUnitTagLibrary.class);
      
      public JUnitTagLibrary() {
          registerTag("assert", AssertTag.class);
          registerTag("assertEquals", AssertEqualsTag.class);
          registerTag("fail", FailTag.class);
      }
  
      public Expression createExpression(
          ExpressionFactory factory,
          String tagName,
          String attributeName,
          String attributeValue) throws Exception {
  
          // #### may need to include some namespace URI information in the XPath instance?
          
          if (attributeName.equals("xpath")) {            
              if ( log.isDebugEnabled() ) {
                  log.debug( "Parsing XPath expression: " + attributeValue );
              }
              
              try {
                  XPath xpath = new Dom4jXPath(attributeValue);
                  return new XPathExpression(xpath);
              }
              catch (JaxenException e) {
                  throw new JellyException( "Could not parse XPath expression: \"" + attributeValue
+ "\" reason: " + e, e );            
              }            
          }
          
          // will use the default expression instead
          return super.createExpression(factory, tagName, attributeName, attributeValue);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/junit/AssertTagSupport.java
  
  Index: AssertTagSupport.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/AssertTagSupport.java,v
1.8 2002/07/06 13:53:39 dion Exp $
   * $Revision: 1.8 $
   * $Date: 2002/07/06 13:53:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: AssertTagSupport.java,v 1.8 2002/07/06 13:53:39 dion Exp $
   */
  package org.apache.commons.jelly.tags.junit;
  
  import junit.framework.AssertionFailedError;
  
  import org.apache.commons.jelly.TagSupport;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.expression.Expression;
  
  /** 
   * The abstract base class of any assertion tag which is
   * useful for implementation inheritence.
   * 
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
   * @version $Revision: 1.8 $
   */
  public abstract class AssertTagSupport extends TagSupport {
  
      public AssertTagSupport() {
      }
  
      // Implementation methods
      //-------------------------------------------------------------------------        
       
      
      /**
       * Produces a failure assertion with the given message 
       */
      protected void fail(String message) throws AssertionFailedError {
          throw new AssertionFailedError(message);
      }
      
      /**
       * Produces a failure if the actual value was not equal to the expected value
       */
      protected void failNotEquals(String message, Object expected, Object actual) throws
AssertionFailedError {
          String formatted= "";
          if (message != null) {
              formatted = message +" ";
          }
          fail(formatted + "expected:<" + expected + "> but was:<" + actual + ">");
      }
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/junit/AssertTag.java
  
  Index: AssertTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/AssertTag.java,v
1.8 2002/07/06 13:53:39 dion Exp $
   * $Revision: 1.8 $
   * $Date: 2002/07/06 13:53:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: AssertTag.java,v 1.8 2002/07/06 13:53:39 dion Exp $
   */
  package org.apache.commons.jelly.tags.junit;
  
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.MissingAttributeException;
  import org.apache.commons.jelly.expression.Expression;
  
  /** 
   * Performs an assertion that a given boolean expression, or XPath expression is
   * true. If the expression returns false then this test fails.
   *
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
   * @version $Revision: 1.8 $
   */
  public class AssertTag extends AssertTagSupport {
  
      /** The expression to evaluate. */
      private Expression test;
      
      /** The XPath expression to evaluate */
      private Expression xpath;
  
      public AssertTag() {
      }
  
      // Tag interface
      //------------------------------------------------------------------------- 
      public void doTag(XMLOutput output) throws Exception {
          if (test == null && xpath == null) {
              throw new MissingAttributeException( "test" );
          }
          if (test != null) {
              if (! test.evaluateAsBoolean(context)) {
                  fail( getBodyText() );
              }
          }
          else {
              if (! xpath.evaluateAsBoolean(context)) {
                  fail( getBodyText() );
              }
          }
  
      }
      
      // Properties
      //-------------------------------------------------------------------------        
       
  
      /** 
       * Sets the boolean expression to evaluate. If this expression returns true
       * then the test succeeds otherwise if it returns false then the text will
       * fail with the content of the tag being the error message.
       */
      public void setTest(Expression test) {
          this.test = test;
      }
  
      /** 
       * Sets the boolean XPath expression to evaluate. If this expression returns true
       * then the test succeeds otherwise if it returns false then the text will
       * fail with the content of the tag being the error message.
       */
      public void setXpath(Expression xpath) {
          this.xpath = xpath;
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/junit/AssertEqualsTag.java
  
  Index: AssertEqualsTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/AssertTag.java,v
1.8 2002/07/06 13:53:39 dion Exp $
   * $Revision: 1.8 $
   * $Date: 2002/07/06 13:53:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: AssertTag.java,v 1.8 2002/07/06 13:53:39 dion Exp $
   */
  package org.apache.commons.jelly.tags.junit;
  
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.MissingAttributeException;
  import org.apache.commons.jelly.expression.Expression;
  
  /** 
   * Compares an actual object against an expected object and if they are different
   * then the test will fail.
   *
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
   * @version $Revision: 1.8 $
   */
  public class AssertEqualsTag extends AssertTagSupport {
  
      private Object actual;
      private Object expected;
      
  
      // Tag interface
      //------------------------------------------------------------------------- 
      public void doTag(XMLOutput output) throws Exception {
          String message = getBodyText();
          
          if (expected == null && actual == null) {
              return;
          }
          if (expected != null && expected.equals(actual)) {            
              return;
          }
  
          failNotEquals(message, expected, actual);
      }
      
      // Properties
      //-------------------------------------------------------------------------        
       
      
      /** 
       * Sets the actual value which will be compared against the 
       * expected value.
       */
      public void setActual(Object actual) {
          this.actual = actual;
      }
      
      /**
       * Sets the expected value to be tested against
       */
      public void setExpected(Object expected) {
          this.expected = expected;
      }
  }
  
  
  
  1.10      +5 -12     jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java
  
  Index: XMLTagLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XMLTagLibrary.java	18 Jun 2002 08:31:02 -0000	1.9
  +++ XMLTagLibrary.java	20 Jul 2002 08:12:04 -0000	1.10
  @@ -61,14 +61,7 @@
    */
   package org.apache.commons.jelly.tags.xml;
   
  -import java.io.IOException;
  -import java.io.Writer;
  -import java.util.Iterator;
  -import java.util.List;
  -
  -import org.apache.commons.jelly.JellyContext;
   import org.apache.commons.jelly.JellyException;
  -import org.apache.commons.jelly.Script;
   import org.apache.commons.jelly.TagLibrary;
   import org.apache.commons.jelly.expression.Expression;
   import org.apache.commons.jelly.expression.ExpressionFactory;
  
  
  

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


Mime
View raw message