You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by mo...@apache.org on 2001/09/04 19:22:32 UTC

cvs commit: jakarta-taglibs-sandbox/latka-taglib/xml latka-taglib.xml

morgand     01/09/04 10:22:32

  Modified:    latka-taglib/src/org/apache/taglibs/latka
                        ExecuteSuiteTag.java
               latka-taglib/xml latka-taglib.xml
  Log:
  XML validation now configurable
  
  Revision  Changes    Path
  1.8       +20 -7     jakarta-taglibs-sandbox/latka-taglib/src/org/apache/taglibs/latka/ExecuteSuiteTag.java
  
  Index: ExecuteSuiteTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs-sandbox/latka-taglib/src/org/apache/taglibs/latka/ExecuteSuiteTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ExecuteSuiteTag.java	2001/08/31 18:15:49	1.7
  +++ ExecuteSuiteTag.java	2001/09/04 17:22:32	1.8
  @@ -30,13 +30,8 @@
   
     protected String _testFile = null;
     protected Reader _xmlSuiteReader = null;
  +  protected boolean _validate = true;
   
  -  // since many containers use thread pooling,
  -  // we have to store away the properties
  -  // and then restore the initial values
  -  // with every invocation
  -  // this may be more elegant if we implement 
  -  // trycatchfinally
     protected Properties _props = 
       (Properties) LatkaProperties.getProperties();
   
  @@ -52,6 +47,16 @@
     }
   
     /**
  +   * Whether or not to perform validation on this
  +   * suite XML.  The default value is true.
  +   *
  +   * @param validate whether or not to validate the XML
  +   */
  +  public void setValidate(boolean validate) {
  +    _validate = validate;
  +  }
  +
  +  /**
      * Given the name of a Property attribute, this method 
      * will add all the contained properties to Latka before
      * executing a test.  Note: these properties will NOT be
  @@ -82,6 +87,7 @@
   
     public int doEndTag() throws JspTagException {
   
  +    
       // latka stuff here
       Suite suite = null;
       if (_testFile != null) {
  @@ -91,7 +97,8 @@
       }
   
       Latka latka = new Latka();
  -    latka.setValidating(false);
  +    latka.setValidating(_validate);
  +
       XMLReporter listener = new XMLReporter();
       try {
         latka.runTests(suite,listener);
  @@ -99,6 +106,11 @@
         e.printStackTrace();
         throw new JspTagException(e.toString());
       } finally {
  +      // since many containers use thread pooling,
  +      // we have to restore the initial values
  +      // with every invocation
  +      // this may be more elegant if we implement 
  +      // trycatchfinally
         LatkaProperties.resetProperties();
       }
   
  @@ -134,6 +146,7 @@
     public void release() {
       _testFile = null;
       _xmlSuiteReader = null;
  +    _validate = true;
     }
   
   }
  
  
  
  1.6       +13 -2     jakarta-taglibs-sandbox/latka-taglib/xml/latka-taglib.xml
  
  Index: latka-taglib.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs-sandbox/latka-taglib/xml/latka-taglib.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- latka-taglib.xml	2001/08/31 20:08:25	1.5
  +++ latka-taglib.xml	2001/09/04 17:22:32	1.6
  @@ -94,14 +94,25 @@
           </description>
           <availability>1.0</availability>
         </attribute>
  -            
  +      
  +      <attribute>
  +        <name>validate</name>
  +        <required>no</required>
  +        <rtexprvalue>yes</rtexprvalue>
  +        <description>
  +           Whether or not to perform validation on this
  +           suite's XML.  The default value is true.
  +        </description>
  +        <availability>1.0</availability>
  +      </attribute>
  +      
         <example>
           <usage>
             <code>
   <![CDATA[
   <!-- use just the file name; all suites will be in the same directory 
        (or relative to the base test directory?) -->
  -<latka:executeSuite testFile="TestSubscription.xml"/>
  +<latka:executeSuite testFile="TestSubscription.xml" validate="true"/>
   ]]>
             </code>
           </usage>