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...@locus.apache.org on 2000/12/06 14:43:29 UTC
cvs commit: xml-xalan/test/java/src/org/apache/qetest/trax/stream StreamResultAPITest.java
curcuru 00/12/06 05:43:28
Modified: test/java/src/org/apache/qetest/trax/stream
StreamResultAPITest.java
Log:
Updated with new tests, better validation
Revision Changes Path
1.3 +38 -5 xml-xalan/test/java/src/org/apache/qetest/trax/stream/StreamResultAPITest.java
Index: StreamResultAPITest.java
===================================================================
RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/stream/StreamResultAPITest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StreamResultAPITest.java 2000/11/20 22:15:24 1.2
+++ StreamResultAPITest.java 2000/12/06 13:43:26 1.3
@@ -96,7 +96,7 @@
/**
* API Coverage test for the StreamResult class of TRAX..
* @author shane_curcuru@lotus.com
- * @version $Id: StreamResultAPITest.java,v 1.2 2000/11/20 22:15:24 curcuru Exp $
+ * @version $Id: StreamResultAPITest.java,v 1.3 2000/12/06 13:43:26 curcuru Exp $
*/
public class StreamResultAPITest extends XSLProcessorTestBase
{
@@ -287,7 +287,7 @@
reporter.logArbitrary(reporter.TRACEMSG, "baos was: " + baos.toString());
reporter.logArbitrary(reporter.TRACEMSG, "ps(baos2) was: " + baos2.toString());
}
- reporter.checkAmbiguous("@todo also verify one against a real gold file");
+ writeFileAndValidate(baos.toString(), outputFileInfo.goldName);
}
catch (Throwable t)
{
@@ -316,7 +316,7 @@
reporter.logArbitrary(reporter.TRACEMSG, "sw was: " + sw.toString());
reporter.logArbitrary(reporter.TRACEMSG, "cw was: " + cw.toString());
}
- reporter.checkAmbiguous("@todo also verify one against a real gold file");
+ writeFileAndValidate(sw.toString(), outputFileInfo.goldName);
}
catch (Throwable t)
{
@@ -324,8 +324,6 @@
reporter.logThrowable(reporter.ERRORMSG, t, "Problem with transform-streams(2)");
}
- reporter.checkAmbiguous("@todo do transform when setting systemId on Results");
-
try
{
// Test with systemId set
@@ -359,6 +357,16 @@
reporter.logArbitrary(reporter.TRACEMSG, "sw1 w/out systemId was: " + sw1.toString());
reporter.logArbitrary(reporter.TRACEMSG, "sw2 w/ systemId was: " + sw2.toString());
}
+ writeFileAndValidate(sw1.toString(), outputFileInfo.goldName);
+ reporter.logInfoMsg("@todo we should update XHTComparator for bogus systemId's like we have in this test");
+ // @todo we should update XHTComparator for bogus systemId's like we have in this test
+ // Note that using XHTFileCheckService, it always compares our
+ // outputs using [text] since the XML parser usually throws:
+ // warning;org.xml.sax.SAXParseException: File "file:/E:/builds/xml-xalan/test/tests/api-gold/trax/stream/this-is-doctype-system" not found.
+ if (reporter.getLoggingLevel() >= Reporter.TRACEMSG)
+ {
+ reporter.logArbitrary(reporter.TRACEMSG, fileChecker.getExtendedInfo());
+ }
}
catch (Throwable t)
{
@@ -369,6 +377,31 @@
reporter.testCaseClose();
return true;
}
+
+
+ /**
+ * Worker method to dump a string to a file and validate it.
+ * @return true if OK, false otherwise
+ */
+ public void writeFileAndValidate(String data, String goldFile)
+ {
+ try
+ {
+ FileWriter fw = new FileWriter(outNames.nextName());
+ fw.write(data);
+ fw.close();
+ fileChecker.check(reporter,
+ new File(outNames.currentName()),
+ new File(goldFile),
+ "writeStringToFile() checking: " + outNames.currentName());
+ }
+ catch (Exception e)
+ {
+ reporter.checkFail("writeStringToFile() threw: " + e.toString());
+ reporter.logThrowable(Reporter.ERRORMSG, e, "writeStringToFile() threw");
+ }
+ }
+
/**
* Convenience method to print out usage information - update if needed.