xml-xalan-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curc...@apache.org
Subject cvs commit: xml-xalan/test/tests/bugzilla Bugzilla5609.gold Bugzilla5609.java Bugzilla5609.xml Bugzilla5609.xsl Bugzilla5609a.xml
Date Mon, 07 Jan 2002 15:25:03 GMT
curcuru     02/01/07 07:25:03

  Added:       test/tests/bugzilla Bugzilla5609.gold Bugzilla5609.java
                        Bugzilla5609.xml Bugzilla5609.xsl Bugzilla5609a.xml
  Log:
  Reproduce Bugzilla 5609 bug
  
  Revision  Changes    Path
  1.1                  xml-xalan/test/tests/bugzilla/Bugzilla5609.gold
  
  Index: Bugzilla5609.gold
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <html>
  <body>Hello 9115 World</body>
  </html>
  
  
  
  1.1                  xml-xalan/test/tests/bugzilla/Bugzilla5609.java
  
  Index: Bugzilla5609.java
  ===================================================================
  /*
   * Covered by The Apache Software License, Version 1.1
   * See xml-xalan/License
   */
  // Common Qetest / Xalan testing imports
  import org.apache.qetest.Datalet;
  import org.apache.qetest.Logger;
  import org.apache.qetest.TestletImpl;
  
  // REPLACE_imports needed for reproducing the bug
  import org.apache.qetest.CheckService;
  import org.apache.qetest.xsl.XHTFileCheckService;
  
  import javax.xml.transform.*;
  import javax.xml.transform.stream.*;
  import java.io.File;
  
  /**
   * Testlet for reproducing Bugzilla reported bugs.
   * @author howejr77@yahoo.com
   * @author shane_curcuru@us.ibm.com
   */
  public class Bugzilla5609 extends TestletImpl
  {
      // Initialize our classname for TestletImpl's main() method - must be updated!
      static { thisClassName = "Bugzilla5609"; }
  
      /**
       * Write Minimal code to reproduce your Bugzilla bug report.
       * Many Bugzilla tests won't bother with a datalet; they'll 
       * just have the data to reproduce the bug encoded by default.
       * @param d (optional) Datalet to use as data point for the test.
       */
      public void execute(Datalet d)
  	{
          // Use logger.logMsg(...) instead of System.out.println(...)
          logger.logMsg(Logger.STATUSMSG, "Reproducing Bugzilla#5609: Global Variable Initialization
across Multiple Transformations");
          CheckService fileChecker = new XHTFileCheckService();
          try
          {
              // Reproduce bug as-is: re-using transformer with global variable decl uses
wrong value
              TransformerFactory factory = TransformerFactory.newInstance();
              logger.logMsg(Logger.STATUSMSG, "About to newTransformer(Bugzilla5609.xsl)");
              Transformer transformer = factory.newTransformer(new StreamSource(new File("Bugzilla5609.xsl")));
              logger.logMsg(Logger.STATUSMSG, "About to transform#1 Bugzilla5609.xml into
.out");
              transformer.transform(new StreamSource(new File("Bugzilla5609.xml")), 
                                    new StreamResult(new File("Bugzilla5609.out")));
              fileChecker.check(logger, 
                      new File("Bugzilla5609.out"), 
                      new File("Bugzilla5609.gold"), 
                      "transform#1 into Bugzilla5609.out");
  
  
              logger.logMsg(Logger.STATUSMSG, "About to transform#2 ParamBugzilla5609a.xml
into .out");
              transformer.transform(new StreamSource(new File("Bugzilla5609a.xml")), 
                                    new StreamResult(new File("Bugzilla5609a.out")));
              fileChecker.check(logger, 
                      new File("Bugzilla5609a.out"), 
                      new File("Bugzilla5609a.gold"), 
                      "transform#2 into Bugzilla5609a.out; but is wrong var num is used");
              
          } 
          catch (Throwable t)
          {
              logger.logThrowable(Logger.WARNINGMSG, t, "Bugzilla#5609 threw");
              logger.checkErr("Bugzilla#5609 threw " + t.toString());
          }
  
          try
          {
              // Reproduce bug when getting single transformer from templates
              TransformerFactory factory = TransformerFactory.newInstance();
              logger.logMsg(Logger.STATUSMSG, "About to newTemplates(Bugzilla5609.xsl)");
              Templates templates = factory.newTemplates(new StreamSource(new File("Bugzilla5609.xsl")));
              logger.logMsg(Logger.STATUSMSG, "About to Templates.newTransformer()");
              Transformer transformer = templates.newTransformer();
              logger.logMsg(Logger.STATUSMSG, "About to transform#1 Bugzilla5609.xml into
.out");
              transformer.transform(new StreamSource(new File("Bugzilla5609.xml")), 
                                    new StreamResult(new File("Bugzilla5609.out")));
              fileChecker.check(logger, 
                      new File("Bugzilla5609.out"), 
                      new File("Bugzilla5609.gold"), 
                      "transform#1 into Bugzilla5609.out");
  
  
              logger.logMsg(Logger.STATUSMSG, "About to transform#2 Bugzilla5609a.xml into
.out");
              transformer.transform(new StreamSource(new File("Bugzilla5609a.xml")), 
                                    new StreamResult(new File("Bugzilla5609a.out")));
              fileChecker.check(logger, 
                      new File("Bugzilla5609a.out"), 
                      new File("Bugzilla5609a.gold"), 
                      "transform#2 into Bugzilla5609a.out; but is wrong var num is used");
              
          } 
          catch (Throwable t)
          {
              logger.logThrowable(Logger.WARNINGMSG, t, "Bugzilla#5609 threw");
              logger.checkErr("Bugzilla#5609 threw " + t.toString());
          }
  	}
  
      /**
       * <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5609">
       * Link to Bugzilla report</a>
       * @return Global Variable Initialization across Multiple Transformations.
       */
      public String getDescription()
      {
          return "Global Variable Initialization across Multiple Transformations";
      }
  
  }  // end of class Bugzilla5609
  
  
  
  
  1.1                  xml-xalan/test/tests/bugzilla/Bugzilla5609.xml
  
  Index: Bugzilla5609.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <Adjustments>
    <PageData>
      <HiddenForm>
        <Region>9115</Region>
      </HiddenForm>
    </PageData>
  </Adjustments>
  
  
  
  1.1                  xml-xalan/test/tests/bugzilla/Bugzilla5609.xsl
  
  Index: Bugzilla5609.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  	
    <xsl:variable name="regionNumber" select="/Adjustments/PageData/HiddenForm/Region"/>
  	
    <xsl:template match="/">
      <html>
        <body>Hello <xsl:value-of select="$regionNumber"/> World</body>
      </html>
    </xsl:template>
  	
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/bugzilla/Bugzilla5609a.xml
  
  Index: Bugzilla5609a.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <Adjustments>
    <PageData>
      <HiddenForm>
        <Region>9111</Region>
      </HiddenForm>
    </PageData>
  </Adjustments>
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message