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 2001/02/08 18:50:21 UTC

cvs commit: xml-xalan/test/java/src/org/apache/qetest/trax/stream StreamSourceAPITest.java

curcuru     01/02/08 09:50:16

  Modified:    test/java/src/org/apache/qetest/trax
                        SystemIdImpInclTest.java TransformerAPITest.java
               test/java/src/org/apache/qetest/trax/dom
                        DOMResultAPITest.java
               test/java/src/org/apache/qetest/trax/sax
                        SAXResultAPITest.java
                        SAXTransformerFactoryAPITest.java
                        TemplatesHandlerAPITest.java
               test/java/src/org/apache/qetest/trax/stream
                        StreamSourceAPITest.java
  Log:
  Update various Results to close FileOutputStreams after transforms and before validating files
  
  Revision  Changes    Path
  1.4       +26 -16    xml-xalan/test/java/src/org/apache/qetest/trax/SystemIdImpInclTest.java
  
  Index: SystemIdImpInclTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/SystemIdImpInclTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SystemIdImpInclTest.java	2001/01/26 14:45:29	1.3
  +++ SystemIdImpInclTest.java	2001/02/08 17:48:58	1.4
  @@ -107,7 +107,7 @@
    * (which will require network resources available).
    *
    * @author shane_curcuru@lotus.com
  - * @version $Id: SystemIdImpInclTest.java,v 1.3 2001/01/26 14:45:29 curcuru Exp $
  + * @version $Id: SystemIdImpInclTest.java,v 1.4 2001/02/08 17:48:58 curcuru Exp $
    */
   public class SystemIdImpInclTest extends XSLProcessorTestBase
   {
  @@ -256,11 +256,13 @@
               Transformer transformer1 = templates1.newTransformer();
               reporter.logInfoMsg("About to transform, systemId(level1)");
               transformer1.transform(xmlSource1, result1);
  -            int result = fileChecker.check(reporter, 
  +            fos1.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT
  +                != fileChecker.check(reporter, 
                                 new File(outNames.currentName()), 
                                 new File(goldFileLevel1), 
  -                              "transform after setSystemId(level1) into " + outNames.currentName());
  -            if (result == reporter.FAIL_RESULT)
  +                              "transform after setSystemId(level1) into " + outNames.currentName())
  +               )
                   reporter.logInfoMsg("transform after setSystemId(level1)... failure reason:" + fileChecker.getExtendedInfo());
           }
           catch (Throwable t)
  @@ -290,11 +292,13 @@
               Transformer transformer1 = templates1.newTransformer();
               reporter.logInfoMsg("About to transform, systemId(level0)");
               transformer1.transform(xmlSource1, result1);
  -            int result = fileChecker.check(reporter, 
  +            fos1.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT
  +                != fileChecker.check(reporter, 
                                 new File(outNames.currentName()), 
                                 new File(goldFileLevel0), 
  -                              "transform after setSystemId(level0) into " + outNames.currentName());
  -            if (result == reporter.FAIL_RESULT)
  +                              "transform after setSystemId(level0) into " + outNames.currentName())
  +               )
                   reporter.logInfoMsg("transform after setSystemId(level0)... failure reason:" + fileChecker.getExtendedInfo());
           }
           catch (Throwable t)
  @@ -324,11 +328,13 @@
               Transformer transformer1 = templates1.newTransformer();
               reporter.logInfoMsg("About to transform, systemId(level2)");
               transformer1.transform(xmlSource1, result1);
  -            int result = fileChecker.check(reporter, 
  +            fos1.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT
  +                != fileChecker.check(reporter, 
                                 new File(outNames.currentName()), 
                                 new File(goldFileLevel2), 
  -                              "transform after setSystemId(level2) into " + outNames.currentName());
  -            if (result == reporter.FAIL_RESULT)
  +                              "transform after setSystemId(level2) into " + outNames.currentName())
  +               )
                   reporter.logInfoMsg("transform after setSystemId(level2)... failure reason:" + fileChecker.getExtendedInfo());
           }
           catch (Throwable t)
  @@ -358,11 +364,13 @@
               Transformer transformer1 = templates1.newTransformer();
               reporter.logInfoMsg("About to transform, systemId(xslonly level2)");
               transformer1.transform(xmlSource1, result1);
  -            int result = fileChecker.check(reporter, 
  +            fos1.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT
  +                != fileChecker.check(reporter, 
                                 new File(outNames.currentName()), 
                                 new File(goldFileLevel2), 
  -                              "transform after setSystemId(xslonly level2) into " + outNames.currentName());
  -            if (result == reporter.FAIL_RESULT)
  +                              "transform after setSystemId(xslonly level2) into " + outNames.currentName())
  +               )
                   reporter.logInfoMsg("transform after setSystemId(xslonly level2)... failure reason:" + fileChecker.getExtendedInfo());
           }
           catch (Throwable t)
  @@ -816,11 +824,13 @@
               Templates templates = factory.newTemplates(xslSrc);
               Transformer transformer = templates.newTransformer();
               transformer.transform(xmlSrc, outputResult);
  -            int result = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT
  +                != fileChecker.check(reporter, 
                                 new File(outNames.currentName()), 
                                 new File(goldFileName), 
  -                              desc + " (" + systemId + ") into: " + outNames.currentName());
  -            if (result == reporter.FAIL_RESULT)
  +                              desc + " (" + systemId + ") into: " + outNames.currentName())
  +               )
                   reporter.logInfoMsg(desc + "... failure reason:" + fileChecker.getExtendedInfo());
           }
           catch (Throwable t)
  
  
  
  1.9       +28 -13    xml-xalan/test/java/src/org/apache/qetest/trax/TransformerAPITest.java
  
  Index: TransformerAPITest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/TransformerAPITest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TransformerAPITest.java	2001/01/03 01:46:30	1.8
  +++ TransformerAPITest.java	2001/02/08 17:49:04	1.9
  @@ -453,15 +453,20 @@
               transformer.setParameter(PARAM1N, new Integer(1234));
               // Verify basic params actually affect transformation
               //   Use the transformer we set the params onto above!
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
               if (doTransform(transformer,
                               new StreamSource(paramTest.xmlName), 
  -                            new StreamResult(new FileOutputStream(outNames.nextName()))))
  +                            new StreamResult(fos)))
               {
  +                fos.close(); // must close ostreams we own
                   // @todo should update goldFile!
  -                fileChecker.check(reporter, 
  -                                  new File(outNames.currentName()), 
  -                                  new File(paramTest.goldName), 
  -                                  "transform with param1s,param1n into: " + outNames.currentName());
  +                if (Logger.PASS_RESULT
  +                    != fileChecker.check(reporter, 
  +                        new File(outNames.currentName()), 
  +                        new File(paramTest.goldName), 
  +                        "transform with param1s,param1n into: " + outNames.currentName())
  +                   )
  +                    reporter.logInfoMsg("transform with param1s,param1n failure reason:" + fileChecker.getExtendedInfo());
               }
               String gotStr = (String)transformer.getParameter(PARAM1S);
               reporter.check(gotStr, "'test-param-1s'", 
  @@ -615,15 +620,20 @@
               reporter.check(encoding, "UTF-8", "outputTransformer set/getOutputProperty value to ?" + encoding + "?");
               // Try doing another transform (will be UTF-8), to get some output
               // Verify that other output properties stay the same
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
               if (doTransform(outputTransformer, 
                               new StreamSource(outputFormatTest.xmlName), 
  -                            new StreamResult(new FileOutputStream(outNames.nextName()))))
  +                            new StreamResult(fos)))
               {
  +                fos.close(); // must close ostreams we own
                   // @todo should update goldFile!
  -                fileChecker.check(reporter, 
  -                                  new File(outNames.currentName()), 
  -                                  new File(outputFormatTestUTF8), 
  -                                  "transform(UTF-8) outputParams into: " + outNames.currentName());
  +                if (Logger.PASS_RESULT
  +                    != fileChecker.check(reporter, 
  +                        new File(outNames.currentName()), 
  +                        new File(outputFormatTestUTF8), 
  +                        "transform(UTF-8) outputParams into: " + outNames.currentName())
  +                   )
  +                    reporter.logInfoMsg("transform(UTF-8) outputParams failure reason:" + fileChecker.getExtendedInfo());
               }
               // Try getting the whole block and logging it out, just to see what's there
               Properties moreOutProps = outputTransformer.getOutputProperties();
  @@ -773,14 +783,19 @@
               reporter.logTraceMsg("myURIres.getCounterString = " + myURIResolver.getCounterString());
   
               // Assumes we support Streams
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
               if (doTransform(transformer, 
                               new StreamSource(simpleTest.xmlName), 
  -                            new StreamResult(new FileOutputStream(outNames.nextName()))))
  +                            new StreamResult(fos)))
               {
  -                fileChecker.check(reporter, 
  +                fos.close(); // must close ostreams we own
  +                if (Logger.PASS_RESULT
  +                    != fileChecker.check(reporter, 
                                     new File(outNames.currentName()), 
                                     new File(simpleTest.goldName), 
  -                                  "transform(Stream, Stream) into: " + outNames.currentName());
  +                                  "transform(Stream, Stream) into: " + outNames.currentName())
  +                   )
  +                    reporter.logInfoMsg("transform(Stream, Stream) failure reason:" + fileChecker.getExtendedInfo());
               }
               reporter.logTraceMsg("myURIres.getCounterString = " + myURIResolver.getCounterString());
   
  
  
  
  1.6       +4 -2      xml-xalan/test/java/src/org/apache/qetest/trax/dom/DOMResultAPITest.java
  
  Index: DOMResultAPITest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/dom/DOMResultAPITest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DOMResultAPITest.java	2000/12/19 15:01:43	1.5
  +++ DOMResultAPITest.java	2001/02/08 17:49:21	1.6
  @@ -88,7 +88,7 @@
   /**
    * API Coverage test for the DOMResult class of TRAX.
    * @author shane_curcuru@lotus.com
  - * @version $Id: DOMResultAPITest.java,v 1.5 2000/12/19 15:01:43 curcuru Exp $
  + * @version $Id: DOMResultAPITest.java,v 1.6 2001/02/08 17:49:21 curcuru Exp $
    */
   public class DOMResultAPITest extends XSLProcessorTestBase
   {
  @@ -377,10 +377,12 @@
               {
                   // Use identity transformer to serialize
                   Transformer identityTransformer = factory.newTransformer();
  -                StreamResult streamResult = new StreamResult(new FileOutputStream(outNames.nextName()));
  +                FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +                StreamResult streamResult = new StreamResult(fos);
                   DOMSource nodeSource = new DOMSource(dom);
                   reporter.logTraceMsg("serializeDOMAndCheck() into " + outNames.currentName());
                   identityTransformer.transform(nodeSource, streamResult);
  +                fos.close(); // must close ostreams we own
                   fileChecker.check(reporter, 
                                     new File(outNames.currentName()), 
                                     new File(goldFileName), 
  
  
  
  1.2       +5 -3      xml-xalan/test/java/src/org/apache/qetest/trax/sax/SAXResultAPITest.java
  
  Index: SAXResultAPITest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/sax/SAXResultAPITest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SAXResultAPITest.java	2001/01/05 18:33:15	1.1
  +++ SAXResultAPITest.java	2001/02/08 17:49:36	1.2
  @@ -97,7 +97,7 @@
   /**
    * API Coverage test for the SAXResult class of TRAX.
    * @author shane_curcuru@lotus.com
  - * @version $Id: SAXResultAPITest.java,v 1.1 2001/01/05 18:33:15 curcuru Exp $
  + * @version $Id: SAXResultAPITest.java,v 1.2 2001/02/08 17:49:36 curcuru Exp $
    */
   public class SAXResultAPITest extends XSLProcessorTestBase
   {
  @@ -327,14 +327,16 @@
               //  the stylesheet's output properties into it
               Properties outProps = streamTemplates.getOutputProperties();
               Serializer serializer = SerializerFactory.getSerializer(outProps);
  -            reporter.logTraceMsg("serializer.setOutputStream(new FileOutputStream(" + outNames.nextName() + ")");
  -            serializer.setOutputStream(new FileOutputStream(outNames.currentName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            reporter.logTraceMsg("serializer.setOutputStream(new FileOutputStream(" + outNames.currentName() + ")");
  +            serializer.setOutputStream(fos);
               SAXResult saxResult = new SAXResult(serializer.asContentHandler());
               
               // Just do a normal transform to this result
               Transformer transformer = streamTemplates.newTransformer();
               reporter.logTraceMsg("transform(new StreamSource(" + xmlURI + "), saxResult)");
               transformer.transform(new StreamSource(xmlURI), saxResult);
  +            fos.close(); // must close ostreams we own
               fileChecker.check(reporter, 
                                 new File(outNames.currentName()), 
                                 new File(testFileInfo.goldName), 
  
  
  
  1.4       +79 -130   xml-xalan/test/java/src/org/apache/qetest/trax/sax/SAXTransformerFactoryAPITest.java
  
  Index: SAXTransformerFactoryAPITest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/sax/SAXTransformerFactoryAPITest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SAXTransformerFactoryAPITest.java	2001/01/26 14:43:44	1.3
  +++ SAXTransformerFactoryAPITest.java	2001/02/08 17:49:42	1.4
  @@ -103,7 +103,7 @@
    * API Coverage test for SAXTransformerFactory.
    * @author Krishna.Meduri@eng.sun.com
    * @author shane_curcuru@lotus.com
  - * @version $Id: SAXTransformerFactoryAPITest.java,v 1.3 2001/01/26 14:43:44 curcuru Exp $
  + * @version $Id: SAXTransformerFactoryAPITest.java,v 1.4 2001/02/08 17:49:42 curcuru Exp $
    */
   public class SAXTransformerFactoryAPITest extends XSLProcessorTestBase
   {
  @@ -244,7 +244,6 @@
       {
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest001: This tests newTransformerhandler() method which takes StreamSource as argument. This is a positive test");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           try 
  @@ -256,7 +255,8 @@
                           new StreamSource(filenameToURL(xslName)));
               //Result result = new StreamResult(System.out);
               // Send results out to the next output name
  -            Result result = new StreamResult(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            Result result = new StreamResult(fos);
   
               handler.setResult(result);
               reader.setContentHandler(handler);
  @@ -264,17 +264,14 @@
               reporter.logInfoMsg("reader.parse() into: " + outNames.currentName());
               reader.parse(filenameToURL(xmlName));
               // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  -                                            new File(outNames.currentName()), 
  -                                            new File(goldName), 
  -                                            "SAXTFactoryTest001: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT
  +                != fileChecker.check(reporter, 
  +                        new File(outNames.currentName()), 
  +                        new File(goldName), 
  +                        "SAXTFactoryTest001: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest001: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  @@ -292,7 +289,6 @@
       {
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest002: This tests newTransformerhandler() method which takes SAXSource as argument. This is a positive test");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           try 
  @@ -305,7 +301,8 @@
               ss.setInputSource(is);
   
               TransformerHandler handler =  saxTFactory.newTransformerHandler(ss);
  -            Result result = new StreamResult(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            Result result = new StreamResult(fos);
   
               handler.setResult(result);
               reader.setContentHandler(handler);
  @@ -315,17 +312,13 @@
               reader.parse(filenameToURL(xmlName));
   
               // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT != fileChecker.check(reporter, 
                                               new File(outNames.currentName()), 
                                               new File(goldName), 
  -                                            "SAXTFactoryTest002: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +                                            "SAXTFactoryTest002: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest002: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  @@ -343,7 +336,6 @@
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest003: This tests newTransformerhandler() method which takes DOMSource as argument. No relative URIs used. This is a positive test");
           reporter.logStatusMsg("Note: Need to verify that URI's are still correct from porting -sc");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           LoggingErrorListener loggingErrListener = new LoggingErrorListener(reporter);
  @@ -362,7 +354,8 @@
               SAXTransformerFactory saxTFactory = (SAXTransformerFactory)tfactory;
               TransformerHandler handler = saxTFactory.newTransformerHandler(domSource);
   
  -            Result result = new StreamResult(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            Result result = new StreamResult(fos);
               handler.setResult(result);
   
               XMLReader reader = XMLReaderFactory.createXMLReader();
  @@ -373,17 +366,13 @@
               reader.parse(filenameToURL(xmlName));
   
               // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT != fileChecker.check(reporter, 
                                               new File(outNames.currentName()), 
                                               new File(goldName), 
  -                                            "SAXTFactoryTest003: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +                                            "SAXTFactoryTest003: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest003: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  @@ -403,7 +392,6 @@
           reporter.logStatusMsg("SAXTFactoryTest004: This tests newTransformerhandler() method which takes DOMSource as argument. Here a relative URI is used in citiesinclude.xsl file. setSystemId is not used for DOMSource. It should throw an exception. This is a negative test");
           // Grab an extra outName, so the numbers line up - purely cosmetic, not really needed
           String tmpOutName = outNames.nextName();
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           LoggingErrorListener loggingErrListener = new LoggingErrorListener(reporter);
  @@ -422,7 +410,8 @@
               SAXTransformerFactory saxTFactory = (SAXTransformerFactory) tfactory;
               TransformerHandler handler = saxTFactory.newTransformerHandler(domSource);
   
  -            Result result = new StreamResult(new FileOutputStream(tmpOutName));
  +            FileOutputStream fos = new FileOutputStream(tmpOutName);
  +            Result result = new StreamResult(fos);
               handler.setResult(result);
   
               XMLReader reader = XMLReaderFactory.createXMLReader();
  @@ -431,13 +420,9 @@
               // Log what output is about to be created
               reporter.logTraceMsg("reader.parse(" + filenameToURL(xmlName) + ") into: " + outNames.currentName());
               reader.parse(filenameToURL(xmlName));
  +            fos.close(); // just to be complete
   
               reporter.checkFail("Should have thrown exception because systemId not set!");
  -            // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  -                                            new File(outNames.currentName()), 
  -                                            new File(goldName), 
  -                                            "SAXTFactoryTest004: into " + outNames.currentName());
           } 
           catch (Throwable t) 
           {
  @@ -456,7 +441,6 @@
       {
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest005: This tests newTransformerhandler() method which takes DOMSource as argument.  Here a relative URI is used in citiesinclude.xsl file. setSystemId is used for DOMSource. It should run well. This is a positive test");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           LoggingErrorListener loggingErrListener = new LoggingErrorListener(reporter);
  @@ -477,7 +461,8 @@
   
               TransformerHandler handler = saxTFactory.newTransformerHandler(domSource);
   
  -            Result result = new StreamResult(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            Result result = new StreamResult(fos);
               handler.setResult(result);
   
               XMLReader reader = XMLReaderFactory.createXMLReader();
  @@ -488,17 +473,13 @@
               reader.parse(filenameToURL(xmlName));
   
               // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT != fileChecker.check(reporter, 
                                               new File(outNames.currentName()), 
                                               new File(goldName), 
  -                                            "SAXTFactoryTest005: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +                                            "SAXTFactoryTest005: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest005: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  @@ -516,7 +497,6 @@
       {
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest006: This tests newTransformerhandler() method which takes DOMSource as argument.  Here a relative URI is used in citiesinclude.xsl file. setSystemId is used for DOMSource. Here Constructor that takes systemId as argument is used for creating DOMSource. It should run well. This is a positive test");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           try 
  @@ -534,7 +514,8 @@
   
               TransformerHandler handler = saxTFactory.newTransformerHandler(domSource);
   
  -            Result result = new StreamResult(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            Result result = new StreamResult(fos);
               handler.setResult(result);
   
               XMLReader reader = XMLReaderFactory.createXMLReader();
  @@ -545,17 +526,13 @@
               reader.parse(filenameToURL(xmlName));
   
               // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT != fileChecker.check(reporter, 
                                               new File(outNames.currentName()), 
                                               new File(goldName), 
  -                                            "SAXTFactoryTest006: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +                                            "SAXTFactoryTest006: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest006: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  @@ -573,7 +550,6 @@
       {
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest007: This tests newTransformerhandler() method which takes DOMSource as argument.  Here a relative URI is used in citiesinclude.xsl file. setSystemId is used for DOMSource. Here Constructor that takes systemId as argument is used for creating DOMSource. It should run well. This is a positive test");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           try 
  @@ -599,7 +575,8 @@
               TransformerHandler handler = saxTFactory.newTransformerHandler();
               Transformer transformer = handler.getTransformer();
   
  -            Result result = new StreamResult(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            Result result = new StreamResult(fos);
   
               // Log what output is about to be created
               reporter.logTraceMsg("transformer.transform(xmlDomSource, StreamResult) into: " + outNames.currentName());
  @@ -608,17 +585,13 @@
               // Validate the output by comparing against gold
               // 18-Dec-00 Note: need to check what we should be 
               //  validating first - this test case seems incomplete
  -            returnValue = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT != fileChecker.check(reporter, 
                                               new File(outNames.currentName()), 
                                               new File(NOT_DEFINED), 
  -                                            "SAXTFactoryTest007: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +                                            "SAXTFactoryTest007: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest007: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  @@ -636,7 +609,6 @@
       {
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest008: XDESCRIPTION");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           try 
  @@ -651,7 +623,8 @@
   
               TransformerHandler tfhandler = saxTFactory.newTransformerHandler(thandler.getTemplates());
   
  -            Result result = new StreamResult(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            Result result = new StreamResult(fos);
   
               tfhandler.setResult(result);
               reader.setContentHandler(tfhandler);
  @@ -660,17 +633,13 @@
               reader.parse(filenameToURL(xmlName));
   
               // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT != fileChecker.check(reporter, 
                                               new File(outNames.currentName()), 
                                               new File(goldName), 
  -                                            "SAXTFactoryTest008: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +                                            "SAXTFactoryTest008: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest008: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  @@ -688,7 +657,6 @@
       {
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest009: XDESCRIPTION");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           try 
  @@ -707,7 +675,8 @@
               TransformerHandler tfhandler =
                   saxTFactory.newTransformerHandler(thandler.getTemplates());
   
  -            Result result = new StreamResult(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            Result result = new StreamResult(fos);
               tfhandler.setResult(result);
               reader.setContentHandler(tfhandler);
   
  @@ -716,17 +685,13 @@
               reader.parse(filenameToURL(xmlName));
   
               // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT != fileChecker.check(reporter, 
                                               new File(outNames.currentName()), 
                                               new File(goldName), 
  -                                            "SAXTFactoryTest009: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +                                            "SAXTFactoryTest009: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest009: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  @@ -744,7 +709,6 @@
       {
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest010: The transformer will use a SAX parser as it's reader");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           try 
  @@ -754,7 +718,8 @@
               // Set the result handling to be a serialization to the file output stream.
               Serializer serializer = SerializerFactory.getSerializer
                                       (OutputProperties.getDefaultMethodProperties("xml"));
  -            serializer.setOutputStream(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            serializer.setOutputStream(fos);
   //            reader.setContentHandler(new ExampleContentHandler(outNames.nextName())); // @todo update content handler!!!!
               reader.setContentHandler(serializer.asContentHandler()); // @todo update content handler!!!!
   
  @@ -772,17 +737,13 @@
               filter.parse(new InputSource(filenameToURL(xmlName)));
   
               // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT != fileChecker.check(reporter, 
                                               new File(outNames.currentName()), 
                                               new File(citiesSerializedFileName), 
  -                                            "SAXTFactoryTest010: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +                                            "SAXTFactoryTest010: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest010: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  @@ -800,7 +761,6 @@
       {
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest011: The transformer will use a SAX parser as it's reader");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           try 
  @@ -821,7 +781,8 @@
               // Set the result handling to be a serialization to the file output stream.
               Serializer serializer = SerializerFactory.getSerializer
                                       (OutputProperties.getDefaultMethodProperties("xml"));
  -            serializer.setOutputStream(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            serializer.setOutputStream(fos);
   //            reader.setContentHandler(new ExampleContentHandler(outNames.nextName())); // @todo update content handler!!!!
               reader.setContentHandler(serializer.asContentHandler()); // @todo update content handler!!!!
   
  @@ -836,17 +797,13 @@
               filter.parse(new InputSource(filenameToURL(xmlName)));
   
               // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT != fileChecker.check(reporter, 
                                               new File(outNames.currentName()), 
                                               new File(citiesSerializedFileName), 
  -                                            "SAXTFactoryTest011: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +                                            "SAXTFactoryTest011: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest011: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  @@ -864,7 +821,6 @@
       {
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest012: The transformer will use a SAX parser as it's reader");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           try 
  @@ -883,7 +839,8 @@
               // Set the result handling to be a serialization to the file output stream.
               Serializer serializer = SerializerFactory.getSerializer
                                       (OutputProperties.getDefaultMethodProperties("xml"));
  -            serializer.setOutputStream(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            serializer.setOutputStream(fos);
   //            reader.setContentHandler(new ExampleContentHandler(outNames.nextName())); // @todo update content handler!!!!
               reader.setContentHandler(serializer.asContentHandler()); // @todo update content handler!!!!
               filter.setParent(reader);
  @@ -896,17 +853,13 @@
               filter.parse(new InputSource(filenameToURL(xmlName)));
   
               // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT != fileChecker.check(reporter, 
                                               new File(outNames.currentName()), 
                                               new File(citiesSerializedFileName), 
  -                                            "SAXTFactoryTest012: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +                                            "SAXTFactoryTest012: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest012: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  @@ -924,7 +877,6 @@
       {
           // Log the test we're about to do
           reporter.logStatusMsg("SAXTFactoryTest013: The transformer will use a SAX parser as it's reader");
  -        int returnValue = Logger.INCP_RESULT;
   
           TransformerFactory tfactory = TransformerFactory.newInstance();
           try 
  @@ -949,7 +901,8 @@
               // Set the result handling to be a serialization to the file output stream.
               Serializer serializer = SerializerFactory.getSerializer
                                       (OutputProperties.getDefaultMethodProperties("xml"));
  -            serializer.setOutputStream(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            serializer.setOutputStream(fos);
   //            filter.setContentHandler(new ExampleContentHandler(outNames.nextName())); // @todo update content handler!!!!
               filter.setContentHandler(serializer.asContentHandler()); // @todo update content handler!!!!
   
  @@ -958,17 +911,13 @@
               filter.parse(new InputSource(new FileInputStream(xmlName)));
   
               // Validate the output by comparing against gold
  -            returnValue = fileChecker.check(reporter, 
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT != fileChecker.check(reporter, 
                                               new File(outNames.currentName()), 
                                               new File(citiesSerializedFileName), 
  -                                            "SAXTFactoryTest013: into " + outNames.currentName());
  -            // If validation failed or had a problem, also log out
  -            //  the reason for the fail or error
  -            if ((returnValue == Logger.FAIL_RESULT)
  -                || (returnValue == Logger.ERRR_RESULT))
  -            {
  +                                            "SAXTFactoryTest013: into " + outNames.currentName())
  +               )
                   reporter.logStatusMsg("SAXTFactoryTest013: failure reason:" + fileChecker.getExtendedInfo());
  -            }
           } 
           catch (Throwable t) 
           {
  
  
  
  1.3       +21 -15    xml-xalan/test/java/src/org/apache/qetest/trax/sax/TemplatesHandlerAPITest.java
  
  Index: TemplatesHandlerAPITest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/sax/TemplatesHandlerAPITest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TemplatesHandlerAPITest.java	2001/01/29 21:24:30	1.2
  +++ TemplatesHandlerAPITest.java	2001/02/08 17:49:46	1.3
  @@ -99,7 +99,7 @@
   /**
    * API Coverage test for the TemplatesHandler class of TRAX.
    * @author shane_curcuru@lotus.com
  - * @version $Id: TemplatesHandlerAPITest.java,v 1.2 2001/01/29 21:24:30 curcuru Exp $
  + * @version $Id: TemplatesHandlerAPITest.java,v 1.3 2001/02/08 17:49:46 curcuru Exp $
    */
   public class TemplatesHandlerAPITest extends XSLProcessorTestBase
   {
  @@ -280,15 +280,18 @@
               reporter.check((transformer != null), true, "getTemplates().newTransformer() returns non-null with valid stylesheet");
   
               // Validate that this transformer actually works
  -            Result result = new StreamResult(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            Result result = new StreamResult(fos);
               Source xmlSource = new StreamSource(xmlURI);
               transformer.transform(xmlSource, result);
  -            int res = fileChecker.check(reporter, 
  -                              new File(outNames.currentName()), 
  -                              new File(testFileInfo.goldName), 
  -                              "SAX-built simple transform into: " + outNames.currentName());
  -            if (res == reporter.FAIL_RESULT)
  -                reporter.logInfoMsg("SAX-built simple transform failure reason:" + fileChecker.getExtendedInfo());
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT
  +                != fileChecker.check(reporter, 
  +                        new File(outNames.currentName()), 
  +                        new File(testFileInfo.goldName), 
  +                        "SAX-built simple transform into: " + outNames.currentName())
  +                )
  +                 reporter.logInfoMsg("SAX-built simple transform failure reason:" + fileChecker.getExtendedInfo());
           }
           catch (Throwable t)
           {
  @@ -320,15 +323,18 @@
               reporter.check((transformer != null), true, "getTemplates().newTransformer() returns non-null with impincl stylesheet");
   
               // Validate that this transformer actually works
  -            Result result = new StreamResult(new FileOutputStream(outNames.nextName()));
  +            FileOutputStream fos = new FileOutputStream(outNames.nextName());
  +            Result result = new StreamResult(fos);
               Source xmlSource = new StreamSource(xmlImpInclURI);
               transformer.transform(xmlSource, result);
  -            int res = fileChecker.check(reporter, 
  -                              new File(outNames.currentName()), 
  -                              new File(impInclFileInfo.goldName), 
  -                              "SAX-built impincl transform OK into: " + outNames.currentName());
  -            if (res == reporter.FAIL_RESULT)
  -                reporter.logInfoMsg("SAX-built impincl transform failure reason:" + fileChecker.getExtendedInfo());
  +            fos.close(); // must close ostreams we own
  +            if (Logger.PASS_RESULT
  +                != fileChecker.check(reporter, 
  +                        new File(outNames.currentName()), 
  +                        new File(impInclFileInfo.goldName), 
  +                        "SAX-built impincl transform into: " + outNames.currentName())
  +                )
  +                 reporter.logInfoMsg("SAX-built impincl transform failure reason:" + fileChecker.getExtendedInfo());
           }
           catch (Throwable t)
           {
  
  
  
  1.6       +3 -1      xml-xalan/test/java/src/org/apache/qetest/trax/stream/StreamSourceAPITest.java
  
  Index: StreamSourceAPITest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/stream/StreamSourceAPITest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StreamSourceAPITest.java	2000/11/28 21:47:57	1.5
  +++ StreamSourceAPITest.java	2001/02/08 17:50:06	1.6
  @@ -92,7 +92,7 @@
   /**
    * API Coverage test for the StreamSource class of TRAX..
    * @author shane_curcuru@lotus.com
  - * @version $Id: StreamSourceAPITest.java,v 1.5 2000/11/28 21:47:57 curcuru Exp $
  + * @version $Id: StreamSourceAPITest.java,v 1.6 2001/02/08 17:50:06 curcuru Exp $
    */
   public class StreamSourceAPITest extends XSLProcessorTestBase
   {
  @@ -297,6 +297,7 @@
               Transformer transformer1 = templates1.newTransformer();
               reporter.logTraceMsg("about to transform to streams after setSystemId");
               transformer1.transform(xmlSource1, result1);
  +            fos1.close(); // must close ostreams we own
               int result = fileChecker.check(reporter, 
                                 new File(outNames.currentName()), 
                                 new File(testFileInfo.goldName), 
  @@ -323,6 +324,7 @@
               Templates templates2 = factory.newTemplates(xslSource2);
               Transformer transformer2 = templates2.newTransformer();
               transformer2.transform(xmlSource2, result2);
  +            fos2.close(); // must close ostreams we own
               int result = fileChecker.check(reporter, 
                                 new File(outNames.currentName()), 
                                 new File(testFileInfo.goldName),