curcuru 00/12/28 06:24:40
Modified: test/java/src/org/apache/qetest/trax ExamplesTest.java
Log:
Various updates: fix to use filenameToURL so that we
work in *both* absolute and relative inputDir path cases;
added lots of logging so each test dumps exactly what it's doing
Revision Changes Path
1.5 +113 -70
xml-xalan/test/java/src/org/apache/qetest/trax/ExamplesTest.java
Index: ExamplesTest.java
===================================================================
RCS file:
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/ExamplesTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ExamplesTest.java 2000/12/23 22:56:38 1.4
+++ ExamplesTest.java 2000/12/28 14:24:39 1.5
@@ -133,7 +133,7 @@
* for each case - these should be updated as time permits.</p>
* @author [EMAIL PROTECTED]
* @author [EMAIL PROTECTED]
- * @version $Id: ExamplesTest.java,v 1.4 2000/12/23 22:56:38 sboag Exp $
+ * @version $Id: ExamplesTest.java,v 1.5 2000/12/28 14:24:39 curcuru Exp $
*/
public class ExamplesTest extends XSLProcessorTestBase
{
@@ -258,52 +258,52 @@
// Note: the tests must be used with the same input files,
// since they hard-code the gold files within the methods
- reporter.logTraceMsg("exampleSimple1(" + fooFile.xmlName + ", " +
fooFile.inputName + ")");
+ reporter.logStatusMsg("exampleSimple1(" + fooFile.xmlName + ", " +
fooFile.inputName + ")");
exampleSimple1(fooFile.xmlName, fooFile.inputName);
- reporter.logTraceMsg("exampleSimple2(" + fooFile.xmlName + ", " +
fooFile.inputName + ")");
+ reporter.logStatusMsg("exampleSimple2(" + fooFile.xmlName + ", " +
fooFile.inputName + ")");
exampleSimple2(fooFile.xmlName, fooFile.inputName);
- reporter.logTraceMsg("exampleFromStream(" + fooFile.xmlName + ", " +
fooFile.inputName + ")");
+ reporter.logStatusMsg("exampleFromStream(" + fooFile.xmlName + ", "
+ fooFile.inputName + ")");
exampleFromStream(fooFile.xmlName, fooFile.inputName);
- reporter.logTraceMsg("exampleFromReader(" + fooFile.xmlName + ", " +
fooFile.inputName + ")");
+ reporter.logStatusMsg("exampleFromReader(" + fooFile.xmlName + ", "
+ fooFile.inputName + ")");
exampleFromReader(fooFile.xmlName, fooFile.inputName);
- reporter.logTraceMsg("exampleUseTemplatesObj(" + fooFile.xmlName +
", " + bazFile.xmlName + ", " + fooFile.inputName + ")");
+ reporter.logStatusMsg("exampleUseTemplatesObj(" + fooFile.xmlName +
", " + bazFile.xmlName + ", " + fooFile.inputName + ")");
exampleUseTemplatesObj(fooFile.xmlName, bazFile.xmlName,
fooFile.inputName);
-
reporter.logTraceMsg("exampleContentHandlerToContentHandler(fooFile.xmlName,
fooFile.inputName)");
+
reporter.logStatusMsg("exampleContentHandlerToContentHandler(fooFile.xmlName,
fooFile.inputName)");
exampleContentHandlerToContentHandler(fooFile.xmlName,
fooFile.inputName);
- reporter.logTraceMsg("exampleXMLReader(fooFile.xmlName,
fooFile.inputName)");
+ reporter.logStatusMsg("exampleXMLReader(fooFile.xmlName,
fooFile.inputName)");
exampleXMLReader(fooFile.xmlName, fooFile.inputName);
- reporter.logTraceMsg("exampleXMLFilter(fooFile.xmlName,
fooFile.inputName)");
+ reporter.logStatusMsg("exampleXMLFilter(fooFile.xmlName,
fooFile.inputName)");
exampleXMLFilter(fooFile.xmlName, fooFile.inputName);
- reporter.logTraceMsg("exampleXMLFilterChain(fooFile.xmlName,
fooFile.inputName, foo2File, foo3File)");
+ reporter.logStatusMsg("exampleXMLFilterChain(fooFile.xmlName,
fooFile.inputName, foo2File, foo3File)");
exampleXMLFilterChain(fooFile.xmlName, fooFile.inputName, foo2File,
foo3File);
- reporter.logTraceMsg("exampleDOM2DOM(" + fooFile.xmlName + ", " +
fooFile.inputName + ")");
+ reporter.logStatusMsg("exampleDOM2DOM(" + fooFile.xmlName + ", " +
fooFile.inputName + ")");
exampleDOM2DOM(fooFile.xmlName, fooFile.inputName);
- reporter.logTraceMsg("exampleParam(" + fooFile.xmlName + ", " +
fooFile.inputName + ")");
+ reporter.logStatusMsg("exampleParam(" + fooFile.xmlName + ", " +
fooFile.inputName + ")");
exampleParam(fooFile.xmlName, fooFile.inputName);
- reporter.logTraceMsg("exampleTransformerReuse(" + fooFile.xmlName +
", " + fooFile.inputName + ")");
+ reporter.logStatusMsg("exampleTransformerReuse(" + fooFile.xmlName +
", " + fooFile.inputName + ")");
exampleTransformerReuse(fooFile.xmlName, fooFile.inputName);
- reporter.logTraceMsg("exampleOutputProperties(" + fooFile.xmlName +
", " + fooFile.inputName + ")");
+ reporter.logStatusMsg("exampleOutputProperties(" + fooFile.xmlName +
", " + fooFile.inputName + ")");
exampleOutputProperties(fooFile.xmlName, fooFile.inputName);
- reporter.logTraceMsg("exampleUseAssociated(" + fooFile.xmlName +")");
+ reporter.logStatusMsg("exampleUseAssociated(" + fooFile.xmlName
+")");
exampleUseAssociated(fooFile.xmlName);
- reporter.logTraceMsg("exampleContentHandler2DOM(" + fooFile.xmlName
+ ", " + fooFile.inputName + ")");
+ reporter.logStatusMsg("exampleContentHandler2DOM(" + fooFile.xmlName
+ ", " + fooFile.inputName + ")");
exampleContentHandler2DOM(fooFile.xmlName, fooFile.inputName);
- reporter.logTraceMsg("exampleAsSerializer(" + fooFile.xmlName + ", "
+ fooFile.inputName + ")");
+ reporter.logStatusMsg("exampleAsSerializer(" + fooFile.xmlName + ",
" + fooFile.inputName + ")");
exampleAsSerializer(fooFile.xmlName, fooFile.inputName);
reporter.testCaseClose();
@@ -322,13 +322,16 @@
TransformerFactory tfactory = TransformerFactory.newInstance();
// Create a transformer for the stylesheet.
+ reporter.logTraceMsg("newTransformer(new StreamSource(" +
filenameToURL(xslID));
Transformer transformer
- = tfactory.newTransformer(new StreamSource("file:///"+xslID));
+ = tfactory.newTransformer(new StreamSource(filenameToURL(xslID)));
// No need to setSystemId, the transformer can get it from the URL
// Transform the source XML to System.out.
- transformer.transform( new StreamSource("file:///"+sourceID),
+ reporter.logTraceMsg("new StreamSource(" + filenameToURL(sourceID));
+ transformer.transform( new StreamSource(filenameToURL(sourceID)),
new StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(fooFile.goldName),
"exampleSimple1 fileChecker of:" +
outNames.currentName());
@@ -352,13 +355,16 @@
TransformerFactory tfactory = TransformerFactory.newInstance();
// Create a transformer for the stylesheet.
+ reporter.logTraceMsg("newTransformer(new StreamSource(" +
filenameToURL(xslID));
Transformer transformer
= tfactory.newTransformer(new StreamSource(new File(xslID)));
// No need to setSystemId, the transformer can get it from the File
// Transform the source XML to System.out.
+ reporter.logTraceMsg("new StreamSource(new File(" + sourceID);
transformer.transform( new StreamSource(new File(sourceID)),
new StreamResult(new
File(outNames.nextName())));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(fooFile.goldName),
"exampleSimple2 fileChecker of:" +
outNames.currentName());
@@ -381,21 +387,24 @@
// Create a transform factory instance.
TransformerFactory tfactory = TransformerFactory.newInstance();
+ reporter.logTraceMsg("new BufferedInputStream(new FileInputStream("
+ xslID);
InputStream xslIS = new BufferedInputStream(new
FileInputStream(xslID));
StreamSource xslSource = new StreamSource(xslIS);
// Note that if we don't do this, relative URLs can not be resolved
correctly!
- xslSource.setSystemId("file:///"+xslID);
+ xslSource.setSystemId(filenameToURL(xslID));
// Create a transformer for the stylesheet.
Transformer transformer = tfactory.newTransformer(xslSource);
+ reporter.logTraceMsg("new BufferedInputStream(new FileInputStream("
+ sourceID);
InputStream xmlIS = new BufferedInputStream(new
FileInputStream(sourceID));
StreamSource xmlSource = new StreamSource(xmlIS);
// Note that if we don't do this, relative URLs can not be resolved
correctly!
- xmlSource.setSystemId("file:///"+sourceID);
+ xmlSource.setSystemId(filenameToURL(sourceID));
// Transform the source XML to System.out.
transformer.transform( xmlSource, new
StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(fooFile.goldName),
"exampleFromStream fileChecker of:" +
outNames.currentName());
@@ -420,22 +429,25 @@
TransformerFactory tfactory = TransformerFactory.newInstance();
// Note that in this case the XML encoding can not be processed!
+ reporter.logTraceMsg("new BufferedReader(new FileReader(" + xslID);
Reader xslReader = new BufferedReader(new FileReader(xslID));
StreamSource xslSource = new StreamSource(xslReader);
// Note that if we don't do this, relative URLs can not be resolved
correctly!
- xslSource.setSystemId("file:///"+xslID);
+ xslSource.setSystemId(filenameToURL(xslID));
// Create a transformer for the stylesheet.
Transformer transformer = tfactory.newTransformer(xslSource);
// Note that in this case the XML encoding can not be processed!
+ reporter.logTraceMsg("new BufferedReader(new FileReader(" +
sourceID);
Reader xmlReader = new BufferedReader(new FileReader(sourceID));
StreamSource xmlSource = new StreamSource(xmlReader);
// Note that if we don't do this, relative URLs can not be resolved
correctly!
- xmlSource.setSystemId("file:///"+sourceID);
+ xmlSource.setSystemId(filenameToURL(sourceID));
// Transform the source XML to System.out.
transformer.transform( xmlSource, new
StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(fooFile.goldName),
"exampleFromReader fileChecker of:" +
outNames.currentName());
@@ -462,21 +474,26 @@
// Create a templates object, which is the processed,
// thread-safe representation of the stylesheet.
- Templates templates = tfactory.newTemplates(new
StreamSource("file:///"+xslID));
+ reporter.logTraceMsg("newTemplates(new StreamSource(" +
filenameToURL(xslID));
+ Templates templates = tfactory.newTemplates(new
StreamSource(filenameToURL(xslID)));
// Illustrate the fact that you can make multiple transformers
// from the same template.
Transformer transformer1 = templates.newTransformer();
Transformer transformer2 = templates.newTransformer();
- transformer1.transform(new StreamSource("file:///"+sourceID1),
+ reporter.logTraceMsg("new StreamSource(" + filenameToURL(sourceID1));
+ transformer1.transform(new StreamSource(filenameToURL(sourceID1)),
new StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(fooFile.goldName),
"exampleUseTemplatesObj(1) fileChecker of:" +
outNames.currentName());
- transformer2.transform(new StreamSource("file:///"+sourceID2),
+ reporter.logTraceMsg("new StreamSource(" + filenameToURL(sourceID2));
+ transformer2.transform(new StreamSource(filenameToURL(sourceID2)),
new StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(bazFile.goldName),
"exampleUseTemplatesObj(2) fileChecker of:" +
outNames.currentName());
@@ -510,15 +527,15 @@
// A TransformerHandler is a ContentHandler that will listen for
// SAX events, and transform them to the result.
- reporter.logTraceMsg("newTransformerHandler..." + xslID);
+ reporter.logTraceMsg("newTransformerHandler(new StreamSource(" +
filenameToURL(xslID));
TransformerHandler handler
- = stfactory.newTransformerHandler(new
StreamSource("file:///"+xslID));
+ = stfactory.newTransformerHandler(new
StreamSource(filenameToURL(xslID)));
// 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()));
-
+ reporter.logTraceMsg("new FileOutputStream(" +
outNames.currentName());
Result result = new SAXResult(serializer.asContentHandler());
@@ -550,8 +567,8 @@
reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
// Parse the source XML, and send the parse events to the
TransformerHandler.
- reporter.logTraceMsg("reader.parse " + sourceID);
- reader.parse("file:///"+sourceID);
+ reporter.logTraceMsg("reader.parse(" + filenameToURL(sourceID));
+ reader.parse(filenameToURL(sourceID));
reporter.logTraceMsg("Note: See SPR SCUU4RZT78 for discussion as
to why this output is different than XMLReader/XMLFilter");
fileChecker.check(reporter, new File(outNames.currentName()),
@@ -581,19 +598,20 @@
reporter.logErrorMsg("exampleXMLReader:Processor does not
support SAX");
return;
}
- reporter.logTraceMsg("newXMLFilter..." + xslID);
+ reporter.logTraceMsg("newXMLFilter(new StreamSource(" +
filenameToURL(xslID));
XMLReader reader
- = ((SAXTransformerFactory) tfactory).newXMLFilter(new
StreamSource("file:///"+xslID));
+ = ((SAXTransformerFactory) tfactory).newXMLFilter(new
StreamSource(filenameToURL(xslID)));
// 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()));
+ reporter.logTraceMsg("new FileOutputStream(" +
outNames.currentName());
reader.setContentHandler(serializer.asContentHandler());
- reporter.logTraceMsg("reader.parse " + sourceID);
- reader.parse(new InputSource("file:///"+sourceID));
+ reporter.logTraceMsg("reader.parse(new InputSource(" +
filenameToURL(sourceID));
+ reader.parse(new InputSource(filenameToURL(sourceID)));
fileChecker.check(reporter, new File(outNames.currentName()),
new File(saxGoldName),
@@ -642,6 +660,7 @@
Serializer serializer = SerializerFactory.getSerializer
(OutputProperties.getDefaultMethodProperties("xml"));
serializer.setOutputStream(new
FileOutputStream(outNames.nextName()));
+ reporter.logTraceMsg("new FileOutputStream(" +
outNames.currentName());
reader.setContentHandler(serializer.asContentHandler());
try
@@ -658,17 +677,17 @@
// TODO: User diagnostics.
}
- reporter.logTraceMsg("newXMLFilter..." + xslID);
+ reporter.logTraceMsg("newXMLFilter(new StreamSource(" +
filenameToURL(xslID));
XMLFilter filter
- = ((SAXTransformerFactory) tfactory).newXMLFilter(new
StreamSource("file:///"+xslID));
+ = ((SAXTransformerFactory) tfactory).newXMLFilter(new
StreamSource(filenameToURL(xslID)));
filter.setParent(reader);
// Now, when you call transformer.parse, it will set itself as
// the content handler for the parser object (it's "parent"), and
// will then call the parse method on the parser.
- reporter.logTraceMsg("filter.parse " + sourceID);
- filter.parse(new InputSource("file:///"+sourceID));
+ reporter.logTraceMsg("filter.parse(new InputSource(" +
filenameToURL(sourceID));
+ filter.parse(new InputSource(filenameToURL(sourceID)));
fileChecker.check(reporter, new File(outNames.currentName()),
new File(saxGoldName),
@@ -693,7 +712,7 @@
{
TransformerFactory tfactory = TransformerFactory.newInstance();
- Templates stylesheet1 = tfactory.newTemplates(new
StreamSource("file:///"+xslID_1));
+ Templates stylesheet1 = tfactory.newTemplates(new
StreamSource(filenameToURL(xslID_1)));
Transformer transformer1 = stylesheet1.newTransformer();
// If one success, assume all will succeed.
@@ -721,14 +740,16 @@
} catch( NoSuchMethodError ex2 ) {
}
if( reader==null ) reader = XMLReaderFactory.createXMLReader();
+
+ reporter.logTraceMsg("newXMLFilter(new StreamSource(" +
filenameToURL(xslID_1));
+ XMLFilter filter1 = stf.newXMLFilter(new
StreamSource(filenameToURL(xslID_1)));
- reporter.logTraceMsg("newXMLFilter..." + xslID_1);
- XMLFilter filter1 = stf.newXMLFilter(new
StreamSource("file:///"+xslID_1));
- reporter.logTraceMsg("newXMLFilter..." + xslID_2);
- XMLFilter filter2 = stf.newXMLFilter(new
StreamSource("file:///"+xslID_2));
- reporter.logTraceMsg("newXMLFilter..." + xslID_3);
- XMLFilter filter3 = stf.newXMLFilter(new
StreamSource("file:///"+xslID_3));
+ reporter.logTraceMsg("newXMLFilter(new StreamSource(" +
filenameToURL(xslID_2));
+ XMLFilter filter2 = stf.newXMLFilter(new
StreamSource(filenameToURL(xslID_2)));
+ reporter.logTraceMsg("newXMLFilter(new StreamSource(" +
filenameToURL(xslID_3));
+ XMLFilter filter3 = stf.newXMLFilter(new
StreamSource(filenameToURL(xslID_3)));
+
if (null == filter1) // If one success, assume all were success.
{
reporter.checkFail("exampleXMLFilterChain: filter is null");
@@ -748,6 +769,7 @@
Serializer serializer = SerializerFactory.getSerializer
(OutputProperties.getDefaultMethodProperties("xml"));
serializer.setOutputStream(new
FileOutputStream(outNames.nextName()));
+ reporter.logTraceMsg("new FileOutputStream(" +
outNames.currentName());
filter3.setContentHandler(serializer.asContentHandler());
// Now, when you call transformer3 to parse, it will set
@@ -756,8 +778,8 @@
// content handler for transform1, and call transform1.parse,
// which will set itself as the content listener for the
// SAX parser, and call parser.parse(new
InputSource(fooFile.xmlName)).
- reporter.logTraceMsg("filter3.parse " + sourceID);
- filter3.parse(new InputSource("file:///"+sourceID));
+ reporter.logTraceMsg("filter3.parse(new InputSource(" +
filenameToURL(sourceID));
+ filter3.parse(new InputSource(filenameToURL(sourceID)));
fileChecker.check(reporter, new File(outNames.currentName()),
new File(NOT_DEFINED),
"exampleXMLFilterChain fileChecker of:" +
outNames.currentName());
@@ -793,12 +815,13 @@
dfactory.setNamespaceAware(true);
DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
org.w3c.dom.Document outNode = docBuilder.newDocument();
- Node doc = docBuilder.parse(new InputSource("file:///"+xslID));
+ reporter.logTraceMsg("docBuilder.parse(new InputSource(" +
filenameToURL(xslID));
+ Node doc = docBuilder.parse(new
InputSource(filenameToURL(xslID)));
DOMSource dsource = new DOMSource(doc);
// If we don't do this, the transformer won't know how to
// resolve relative URLs in the stylesheet.
- dsource.setSystemId("file:///"+xslID);
+ dsource.setSystemId(filenameToURL(xslID));
templates = tfactory.newTemplates(dsource);
}
@@ -807,12 +830,14 @@
DocumentBuilderFactory dfactory =
DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
org.w3c.dom.Document outNode = docBuilder.newDocument();
- Node doc = docBuilder.parse(new InputSource("file:///"+sourceID));
+ reporter.logTraceMsg("docBuilder.parse(new InputSource(" +
filenameToURL(sourceID));
+ Node doc = docBuilder.parse(new
InputSource(filenameToURL(sourceID)));
transformer.transform(new DOMSource(doc), new DOMResult(outNode));
Transformer serializer = tfactory.newTransformer();
serializer.transform(new DOMSource(outNode), new
StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
reporter.logCriticalMsg("@todo TEST UPDATE validate this output:" +
outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
@@ -839,22 +864,27 @@
try
{
TransformerFactory tfactory = TransformerFactory.newInstance();
- Templates templates = tfactory.newTemplates(new
StreamSource("file:///"+xslID));
+ reporter.logTraceMsg("newTemplates(new StreamSource(" +
filenameToURL(xslID));
+ Templates templates = tfactory.newTemplates(new
StreamSource(filenameToURL(xslID)));
Transformer transformer1 = templates.newTransformer();
Transformer transformer2 = templates.newTransformer();
transformer1.setParameter("a-param",
"hello to you!");
- transformer1.transform(new StreamSource("file:///"+sourceID),
+ reporter.logTraceMsg("new StreamSource(" + filenameToURL(sourceID));
+ transformer1.transform(new StreamSource(filenameToURL(sourceID)),
new StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(param1GoldName),
"exampleParam(1) fileChecker of:" +
outNames.currentName());
transformer2.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer2.transform(new StreamSource("file:///"+sourceID),
+ reporter.logTraceMsg("new StreamSource(" + filenameToURL(sourceID));
+ transformer2.transform(new StreamSource(filenameToURL(sourceID)),
new StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(outputGoldName),
"exampleParam(2) fileChecker of:" +
outNames.currentName());
@@ -871,22 +901,26 @@
* a parameter on the transformer.
*/
public void exampleTransformerReuse(String sourceID, String xslID)
- {System.err.println("********* exampleTransformerReuse");
+ {
+ reporter.logCriticalMsg("********* exampleTransformerReuse");
try
{
// Create a transform factory instance.
TransformerFactory tfactory = TransformerFactory.newInstance();
// Create a transformer for the stylesheet.
+ reporter.logTraceMsg("newTemplates(new StreamSource(" +
filenameToURL(xslID));
Transformer transformer
- = tfactory.newTransformer(new StreamSource("file:///"+xslID));
+ = tfactory.newTransformer(new StreamSource(filenameToURL(xslID)));
transformer.setParameter("a-param",
"hello to you!");
// Transform the source XML to System.out.
- transformer.transform( new StreamSource("file:///"+sourceID),
+ reporter.logTraceMsg("new StreamSource(" + filenameToURL(sourceID));
+ transformer.transform( new StreamSource(filenameToURL(sourceID)),
new StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(param1GoldName),
"exampleTransformerReuse(1) fileChecker of:" +
outNames.currentName());
@@ -896,8 +930,10 @@
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
// Transform the source XML to System.out.
- transformer.transform( new StreamSource("file:///"+sourceID),
+ reporter.logTraceMsg("new StreamSource(" + filenameToURL(sourceID));
+ transformer.transform( new StreamSource(filenameToURL(sourceID)),
new StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(param2GoldName),
"exampleTransformerReuse(2) fileChecker of:" +
outNames.currentName());
@@ -907,7 +943,7 @@
reporter.checkFail("exampleTransformerReuse threw: " + t.toString());
reporter.logThrowable(reporter.ERRORMSG, t, "exampleTransformerReuse
threw");
}
- System.err.println("********* end exampleTransformerReuse");
+ reporter.logCriticalMsg("********* end exampleTransformerReuse");
}
/**
@@ -918,7 +954,8 @@
try
{
TransformerFactory tfactory = TransformerFactory.newInstance();
- Templates templates = tfactory.newTemplates(new
StreamSource("file:///"+xslID));
+ reporter.logTraceMsg("newTemplates(new StreamSource(" +
filenameToURL(xslID));
+ Templates templates = tfactory.newTemplates(new
StreamSource(filenameToURL(xslID)));
Properties oprops = templates.getOutputProperties();
oprops.put(OutputKeys.INDENT, "yes");
@@ -926,8 +963,10 @@
Transformer transformer = templates.newTransformer();
transformer.setOutputProperties(oprops);
- transformer.transform(new StreamSource("file:///"+sourceID),
+ reporter.logTraceMsg("new StreamSource(" + filenameToURL(sourceID));
+ transformer.transform(new StreamSource(filenameToURL(sourceID)),
new StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(outputGoldName),
"exampleOutputProperties fileChecker of:" +
outNames.currentName());
@@ -957,8 +996,9 @@
return;
}
SAXTransformerFactory stf = ((SAXTransformerFactory) tfactory);
+ reporter.logTraceMsg("getAssociatedStylesheet(new StreamSource(" +
filenameToURL(sourceID));
Source sources =
- stf.getAssociatedStylesheet(new
StreamSource("file:///"+sourceID),
+ stf.getAssociatedStylesheet(new
StreamSource(filenameToURL(sourceID)),
null, null, null);
if(null == sources)
@@ -968,8 +1008,10 @@
}
Transformer transformer = tfactory.newTransformer(sources);
- transformer.transform(new StreamSource("file:///"+sourceID),
+ reporter.logTraceMsg("new StreamSource(" +
filenameToURL(sourceID));
+ transformer.transform(new StreamSource(filenameToURL(sourceID)),
new StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(fooFile.goldName),
"exampleUseAssociated fileChecker of:" +
outNames.currentName());
@@ -1009,8 +1051,9 @@
// Create a ContentHandler that can liston to SAX events
// and transform the output to DOM nodes.
+ reporter.logTraceMsg("newTransformerHandler(new StreamSource(" +
filenameToURL(xslID));
TransformerHandler handler
- = sfactory.newTransformerHandler(new
StreamSource("file:///"+xslID));
+ = sfactory.newTransformerHandler(new
StreamSource(filenameToURL(xslID)));
handler.setResult(new DOMResult(outNode));
// Create a reader and set it's ContentHandler to be the
@@ -1039,7 +1082,8 @@
// Send the SAX events from the parser to the transformer,
// and thus to the DOM tree.
- reader.parse("file:///"+sourceID);
+ reporter.logTraceMsg("reader.parse(" + filenameToURL(sourceID));
+ reader.parse(filenameToURL(sourceID));
// Serialize the node for diagnosis.
// This serializes to outNames.nextName()
@@ -1078,6 +1122,7 @@
serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
serializer.transform(new DOMSource(node),
new StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
// TEST UPDATE - Caller must validate
outNames.currentName()
}
@@ -1092,7 +1137,8 @@
DocumentBuilderFactory dfactory =
DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
org.w3c.dom.Document outNode = docBuilder.newDocument();
- Node doc = docBuilder.parse(new InputSource("file:///"+sourceID));
+ reporter.logTraceMsg("docBuilder.parse(new InputSource(" +
filenameToURL(sourceID));
+ Node doc = docBuilder.parse(new
InputSource(filenameToURL(sourceID)));
TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -1106,6 +1152,7 @@
serializer.setOutputProperties(oprops);
serializer.transform(new DOMSource(doc),
new StreamResult(outNames.nextName()));
+ reporter.logTraceMsg("new StreamResult(" + outNames.currentName());
reporter.logCriticalMsg("@todo TEST UPDATE validate this output:" +
outNames.currentName());
fileChecker.check(reporter, new File(outNames.currentName()),
new File(NOT_DEFINED),
@@ -1117,9 +1164,6 @@
reporter.logThrowable(reporter.ERRORMSG, t, "exampleAsSerializer
threw");
}
}
-
-
-
/**
@@ -1130,7 +1174,6 @@
{
return ("Common [optional] options supported by ExamplesTest:\n"
+ "(Note: assumes inputDir=.\\tests\\api)\n"
- + "REPLACE_any_new_test_arguments\n"
+ super.usage()); // Grab our parent classes usage as well
}