You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by cu...@apache.org on 2002/02/11 15:52:45 UTC

cvs commit: xml-xalan/test/tests/bugzilla Bugzilla6312.java Bugzilla6312.xml Bugzilla6312.xsl

curcuru     02/02/11 06:52:45

  Added:       test/tests/bugzilla Bugzilla6312.java Bugzilla6312.xml
                        Bugzilla6312.xsl
  Log:
  Reproduce Bugzilla6312
  
  Revision  Changes    Path
  1.1                  xml-xalan/test/tests/bugzilla/Bugzilla6312.java
  
  Index: Bugzilla6312.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;
  
  import org.xml.sax.InputSource;
  import org.xml.sax.SAXException;
  import org.xml.sax.XMLReader;
  
  import javax.xml.parsers.ParserConfigurationException;
  import javax.xml.parsers.SAXParserFactory;
  import javax.xml.transform.TransformerConfigurationException;
  import javax.xml.transform.TransformerException;
  import javax.xml.transform.TransformerFactory;
  import javax.xml.transform.sax.SAXTransformerFactory;
  import javax.xml.transform.sax.TemplatesHandler;
  import javax.xml.transform.stream.StreamResult;
  import javax.xml.transform.stream.StreamSource;
  import java.io.FileNotFoundException;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.util.Properties;
  
  
  /**
   * Testlet for reproducing Bugzilla reported bugs.
   *
   * @author dims@yahoo.com 
   * @author shane_curcuru@us.ibm.com
   */
  public class Bugzilla6312 extends TestletImpl
  {
      // Initialize our classname for TestletImpl's main() method - must be updated!
      static { thisClassName = "Bugzilla6312"; }
  
      /**
       * 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#6312");
  
          // Set the TransformerFactory system property to generate and use a translet.
          // Note: To make this sample more flexible, load properties from a properties file.    
          // The setting for the Xalan Transformer is "org.apache.xalan.processor.TransformerFactoryImpl"
          String key = "javax.xml.transform.TransformerFactory";
          String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
          Properties props = System.getProperties();
          props.put(key, value);
          System.setProperties(props);    
  
          String xslInURI = "Bugzilla6312.xsl";
          String xmlInURI = "Bugzilla6312.xml";
          String htmlOutURI = "Bugzilla6312.output";
          try
          {
              // Instantiate the TransformerFactory, and use it along with a SteamSource
              // XSL stylesheet to create a Transformer.
              SAXTransformerFactory tFactory = (SAXTransformerFactory)TransformerFactory.newInstance();
  
              //Transformer transformer = tFactory.newTransformer(new StreamSource(xslInURI));
              TemplatesHandler templatesHandler = tFactory.newTemplatesHandler();
              SAXParserFactory sFactory = SAXParserFactory.newInstance();
              sFactory.setNamespaceAware(true);
              XMLReader reader = sFactory.newSAXParser().getXMLReader();
              reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
              reader.setContentHandler(templatesHandler);
              reader.parse(new InputSource(xslInURI));
  
              // Perform the transformation from a StreamSource to a StreamResult;
              templatesHandler.getTemplates().newTransformer().transform(new StreamSource(xmlInURI),
                                  new StreamResult(new FileOutputStream(htmlOutURI)));  
  
              logger.logMsg(logger.STATUSMSG, "Successfully created " + htmlOutURI);
              logger.checkPass("Crash test: didn't throw exception (note: output file contents not validated");
          } 
          catch (Throwable t)
          {
              logger.logThrowable(logger.ERRORMSG, t, "Unexpected exception");
              logger.checkErr("Unexpected exception: " + t.toString());
          }
          
  	}
  
      /**
       * <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6312">
       * Link to Bugzilla report</a>
       * @return Problems with using JAXPTransletOneTransformation if we use XMLReader/TemplatesHandler.
       */
      public String getDescription()
      {
          return "Problems with using JAXPTransletOneTransformation if we use XMLReader/TemplatesHandler";
      }
  
  }  // end of class Bugzilla6312
  
  
  
  
  1.1                  xml-xalan/test/tests/bugzilla/Bugzilla6312.xml
  
  Index: Bugzilla6312.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <todo title="Things To Do" project="XSLTC" major-version="1">
  
    <devs>
     <person name="Jacek Ambroziak" email="jacek_ambroziak@yahoo.com" id="JA" expertise="code">
       Inventor, architect, former lead developer and evangelist.
     </person>  
     <person name="Tom Amiro" email="Tom.Amiro@Sun.COM" id="TA" expertise="testing">
       Testing.
     </person>  
     <person name="Morten J&#216;rgensen" email="morten@xml.apache.org" id="MJ" expertise="code, doc">
       Lead developer - key contributor on design documentation, ID/Keys, performance, JAXP, and continuing development in general.
     </person>
     <person name="G. Todd Miller" email="Glenn.Miller@Sun.COM" id="TM" expertise="code">
       Developer - key contributor on TrAX.
     </person>
     <person name="Santiago Pericas-Geertsen" email="santiago@cs.bu.edu" id="SP" expertise="code">
       Developer - key contributor on compilation strategy.
     </person>
    </devs>
   
    <actions>
  
     <target-release-description>
      <date>09/??/01</date>
      <level>????</level>
      <goal type="conformance">XSLT 1.0 compliant 100%.</goal>
      <goal type="performance">Maintain current level.</goal>
      <goal type="stability"> Stable, reasonable.</goal>
      <goal type="api">API Complete.</goal>
      <goal type="documentation">Documentation functionally complete.</goal>
     </target-release-description>
     
    <action context="test, packages:org.apache.xalan.xsltc"
            category="tests"
            who="TA, Shane"
            priority="high">
       Modify Xalan test enviroment to test XSLTC as a component of XalanJ2.
     </action>       
  
    <action context="code, packages:org.apache.xalan.xsltc"
            category="feature"
            who="MJ"
            priority="high">
         Finish the implementation of id() and key() in patterns.   
     </action>       
  
    <action context="code, packages:org.apache.xalan.xsltc"
            category="bug"
            who="??"
            priority="high">
        Continue to improve the handling of name spaces. There are a number of
        bugs that are independent of the lack of namespace nodes.  
       (bugzilla 1411, 1506, 1518, 2582, 2801, 2857, 2859, 2863, 2535, 2954, 2840)    
     </action>       
  
    <action context="code, packages:org.apache.xalan.xsltc"
            category="bug"
            who="??"
            priority="high">
      Fix bugs that impact the XSLTMark performance benchmark.
      (bugzilla 1376, 1498, 1512, 1532, 2351, 2517, 2553, 3065, 3066).          
     </action>
          
  
    <action context="code, packages:org.apache.xalan.xsltc"
            category="bugs"
            who="TM"
            priority="high">
         Fix bugs reflecting positional problems (1410, 1532, 2939).          
     </action>
  
    <action context="code, packages:org.apache.xalan.xsltc"
            category="bug"
            who="TM"
            priority="high">
        Fix bugs on dealing with XPATH/Axes expressions (1498, 2551, 2553, 2572, 2932).          
     </action>       
  
    <action context="code, packages:org.apache.xalan.xsltc"
            category="bug"
            who="??"
            priority="medium">
        Fix bugs involving template selection (1397, 2749, 2582, 2585, 2695, 2749, 2754, 2886, 2937).
     </action>
  
    <action context="code, packages:org.apache.xalan.xsltc"
            category="bug"
            who="??"
            priority="medium">
        Fix bugs affecting numbering (2901, 2931).
     </action>
  
    <action context="code, packages:org.apache.xalan.xsltc"
            category="bug"
            who="??"
            priority="medium">
        Fix bugs affecting comment and processing-intruction nodes (2599, 2834, 2858).
     </action>
  
    <action context="code, packages:org.apache.xalan.xsltc"
            category="feature"
            who="MJ"
            priority="low">
       Implement name space nodes (bugzilla 1379).
     </action>       
  
    <action context="code, packages:????"
            category="feature, integration with Xalan"
            who="??"
            priority="medium">
        Implement an extension to support the redirection of output to multiple
        output files from within a stylesheet (equivalent to xalan:redirect or
        saxon:output).  Note: Task may be implemented as a result of integrating Xsltc and Xalan 
       and using shared code.
     </action>       
  
  
    <action context="code, packages:????"
            category="feature, integration with Xalan"
            who="??"
            priority="medium">
       Implement a node-set extension to convert result tree fragments to
       node-sets. This enables sorting and grouping of nodes assigned to a tree 
       variable. Note: Task may be implemented as a result of integrating Xsltc and Xalan 
       and using shared code.
     </action>       
  
  
    <action context="code, packages:????"
            category="feature, integration with Xalan"
            who="??"
            priority="medium">
        Add support for nonstatic external Java functions.  
        Note: Task may be implemented as a result of integrating Xsltc and Xalan 
        and using shared code.
     </action>       
  
  
    <action context="code, packages:????"
            category="feature, integration with Xalan"
            who="??"
            priority="medium">
      Fix bugs affecting the correctness of ouput 
      (1439, 1504, 1512, 1516, 1520, 1525, 2517, 2520, 2578, 2948, 2951, 2952, 2954, 3005, 3065).
       Note: Task may be implemented as a result of integrating Xsltc and Xalan 
       and using shared code.
     </action>       
  
    <action context="code, AST"
            category="architecture"
            who="??"
            priority="medium">
      Use SAX to build the AST. The DOM builder
     (the real DOM builder, not our quasi-DOM builder) receives SAX
     events when it builds the DOM. The compiler.Parser class could
     possible receive these SAX events directly, and thereby eliminating
     the need for a DOM (saves loads of time and memory).
     </action>
     
     <action context="code, DOM"
             category="architecture"
             who="??"
             priority="medium">
        Consider building a DOM-2-'DOM' converter, perhaps by adding 
        a second DOM builder inner class to our DOM. Then we would have 
        one SAX DOM builder and one DOM DOM builder. I don't know if
        JAXP lets you supply the stylesheet as a DOM. If it doesn't, 
        we should assign this task a very low priority. There is no
        point in spending a lot of time on this if JAXP users will 
        never be able to use this functionality.
      </action>       
  
    </actions>
  </todo>
  
  
  
  1.1                  xml-xalan/test/tests/bugzilla/Bugzilla6312.xsl
  
  Index: Bugzilla6312.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:variable name="title" select="concat(todo/@project, ' ', todo/@major-version)"/>
    <xsl:template match="/">
      <HTML>
        <HEAD>
           <TITLE><xsl:value-of select="$title"/></TITLE>
        </HEAD>
        <BODY>
  
          <H2><xsl:value-of select="concat($title, ': ', todo/@title)"/></H2>
          <p><font size="-1">See a 
            <xsl:element name="a">
              <xsl:attribute name="href">#developer-list</xsl:attribute>
              <xsl:text>list of developers/initials.</xsl:text>
            </xsl:element>
          </font></p>
          <font size="-1"><p>Planned releases: 
              <BR/><xsl:for-each select="todo/actions/target-release-description">
                <xsl:element name="a">
                  <xsl:attribute name="href">#release-date-<xsl:value-of select="date"/></xsl:attribute>
                  <xsl:value-of select="date"/>
                </xsl:element><xsl:text> </xsl:text><xsl:text> </xsl:text>
              </xsl:for-each>
              <xsl:element name="a">
                  <xsl:attribute name="href">#release-date-completed</xsl:attribute>
                  <xsl:text>Completed</xsl:text>
                </xsl:element>
  
          </p></font>
          <xsl:for-each select="todo">
            <xsl:for-each select="actions">
                <xsl:for-each select="target-release-description">
                  <p>
                    <xsl:apply-templates/>
                  </p>
                </xsl:for-each>
                <xsl:for-each select="action">
                  <xsl:if test="normalize-space(.)">
                    <p>
                     <xsl:number/>) <xsl:apply-templates/>
                     <xsl:if test="@*">
                      <BR/>
                     </xsl:if>
                     <xsl:apply-templates select="@*"/>
                    </p>
                  </xsl:if>
              </xsl:for-each>
              <HR/>
            </xsl:for-each>
  
            <xsl:for-each select="completed">
                <xsl:element name="a">
                  <xsl:attribute name="name">release-date-completed</xsl:attribute>
                  <H3>Completed: </H3>
                </xsl:element>
              <xsl:for-each select="action">
                <xsl:if test="normalize-space(.)">
                  <p>
                   <xsl:number/>) <xsl:apply-templates/>
                   <xsl:if test="@*">
                    <BR/>
                   </xsl:if>
                   <xsl:apply-templates select="@*"/>
                  </p>
                </xsl:if>
            </xsl:for-each>
            <HR/>
          </xsl:for-each>
  
          <xsl:call-template name="developer-list"/>
         </xsl:for-each>
  
        </BODY>
      </HTML>
    </xsl:template>
  
    <xsl:template match="action/@*">
    <!-- Add link to the who attributes to corresponding item in developer-list -->
      <b><xsl:value-of select="name(.)"/>:</b><xsl:text> </xsl:text>
        <xsl:choose>
          <xsl:when test="name(.)='who'">
            <xsl:element name="a">
              <xsl:attribute name="href">#personref-<xsl:value-of select="."/></xsl:attribute>
              <xsl:value-of select="."/>
            </xsl:element>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="."/>
          </xsl:otherwise>
        </xsl:choose>
      <xsl:if test="not (position()=last())">
        <xsl:text>, </xsl:text>
      </xsl:if>
    </xsl:template>
  
    <xsl:template match="target-release-description/date">
        <xsl:element name="a">
          <xsl:attribute name="name">release-date-<xsl:value-of select="."/></xsl:attribute>
          <b><xsl:text>For release: </xsl:text><xsl:value-of select="."/></b>
        </xsl:element>
      
    </xsl:template>
  
    <xsl:template match="issue">
      <BR/><b>Issue </b><xsl:text>[</xsl:text><xsl:value-of select="@id"/>
      <xsl:text>]: </xsl:text>
      <xsl:apply-templates/>
    </xsl:template>
  
    <xsl:template match="target-release-description/level">
      <xsl:text>, </xsl:text><xsl:apply-templates/>
    </xsl:template>
  
    <xsl:template match="target-release-description/goal">
      <BR/><b>Goal </b><xsl:text>[</xsl:text><xsl:value-of select="@type"/>
      <xsl:text>]: </xsl:text>
      <xsl:apply-templates/>
    </xsl:template>
  
  
    <xsl:template name="developer-list">
      <H3>
        <xsl:element name="a">
          <xsl:attribute name="name">developer-list</xsl:attribute>
          <xsl:text>Developers:</xsl:text>
        </xsl:element>
      </H3>
      <p>A list of some of people currently working on working on <xsl:value-of select="/todo/@project"/>:</p>
      <ul>
      <xsl:for-each select="devs/person">
        <li>
          <a href="mailto:{@email}">
            <xsl:value-of select="@name"/>
          </a>
           <xsl:element name="a">
             <xsl:attribute name="name"><xsl:text>personref-</xsl:text><xsl:value-of select="@id"/></xsl:attribute>
             <xsl:text> (</xsl:text><xsl:value-of select="@id"/><xsl:text>)</xsl:text>
           </xsl:element>
           <BR/><xsl:value-of select="."/>
        </li>
      </xsl:for-each>
      </ul>
    </xsl:template>
  
  </xsl:stylesheet>
  
  
  

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