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/12/20 19:22:34 UTC
cvs commit: xml-xalan/test/java/src/org/apache/qetest/trax Minitest.java
curcuru 01/12/20 10:22:34
Modified: test/java/src/org/apache/qetest/trax Minitest.java
Log:
Revamp Minitest to add more tests:
- now checks several flavors of TransformWrappers (sax, dom, stream)
- adds new check of MinitestPerf file; iterates and reports timing data similar to PerfTestlet
Revision Changes Path
1.3 +268 -160 xml-xalan/test/java/src/org/apache/qetest/trax/Minitest.java
Index: Minitest.java
===================================================================
RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/Minitest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Minitest.java 2001/01/29 13:54:00 1.2
+++ Minitest.java 2001/12/20 18:22:33 1.3
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -55,16 +55,14 @@
* <http://www.apache.org/>.
*/
-/*
- *
- * Minitest.java
- *
- */
package org.apache.qetest.trax;
// Support for test reporting and harness classes
import org.apache.qetest.*;
import org.apache.qetest.xsl.*;
+import org.apache.qetest.xslwrapper.TransformWrapper;
+import org.apache.qetest.xslwrapper.TransformWrapperFactory;
+import org.apache.qetest.xslwrapper.TransformWrapperHelper;
// Import all relevant TRAX packages
import javax.xml.transform.*;
@@ -82,25 +80,35 @@
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.Date;
+import java.util.Enumeration;
+import java.util.Hashtable;
import java.util.Properties;
-
-//-------------------------------------------------------------------------
+import java.util.Vector;
/**
- * Minitest - developer check-in test for Xalan-J 2.x.
- * <p>Developers should run the minitest.xalan2 target to compile
- * and run this test before checking in (and obviously the test
- * should pass, as well!). If you do have problems with this test,
- * contact our mailing list xalan-dev@xml.apache.org for help.</p>
- * <p>Running the minitest before checking in ensures that the
- * Xalan CVS tree will always be in a compileable and at least
- * basically functional state, thus ensuring a workable product
- * for your fellow Xalan developers.</p>
+ * Minitest - developer check-in test for Xalan-J 2.x.
+ *
+ * <p>Developers should always run either the minitest or smoketest
+ * target before checking any code into the xml-xalan CVS
+ * repository. Running the minitest before checking in ensures
+ * that the Xalan CVS tree will always be in a compileable and
+ * at least basically functional state, thus ensuring a workable
+ * product for your fellow Xalan developers. Ensuring your code
+ * passes the smoketest target will also help the nightly GUMP
+ * runs to pass the smoketest as well and avoid 'nag' emails.</p>
+ *
* <p>If you really need to make a checkin that will temporarily
* break or fail the minitest, then <b>please</b> be sure to send
- * email to xalan-dev letting everyone know.</p>
- * @author shane_curcuru@lotus.com
- * @version $Id: Minitest.java,v 1.2 2001/01/29 13:54:00 sboag Exp $
+ * email to xalan-dev@xml.apache.org letting everyone know.</p>
+ *
+ * <p>For more information, please see the
+ * <a href="http://xml.apache.org/xalan-j/test/overview.html">
+ * testing docs</a> and the nightly
+ * <a href="http://jakarta.apache.org/builds/gump/">
+ * GUMP build page</a>.</p>
+ *
+ * @author shane_curcuru@us.ibm.com
+ * @version $Id: Minitest.java,v 1.3 2001/12/20 18:22:33 curcuru Exp $
*/
public class Minitest extends XSLProcessorTestBase
{
@@ -111,31 +119,31 @@
*/
protected OutputNameManager outNames;
+ /**
+ * Basic output name root used throughout tests.
+ */
+ protected String baseOutName;
+
/** The Minitest.xsl/.xml file; note goldName is version-specific. */
protected XSLTestfileInfo testFileInfo = new XSLTestfileInfo();
/** The MinitestParam.xsl/.xml file. */
protected XSLTestfileInfo paramFileInfo = new XSLTestfileInfo();
- /** Cheap-o overall results aggregator for Minitest.pass/Minitest.fail file. */
- protected String aggregateResults ="";
-
+ /** The MinitestPerf.xsl/.xml file. */
+ protected XSLTestfileInfo perfFileInfo = new XSLTestfileInfo();
+
+
/** Constants matching parameter names/values in paramFileInfo. */
public static final String PARAM1S = "param1s";
public static final String PARAM2S = "param2s";
public static final String PARAM1N = "param1n";
public static final String PARAM2N = "param2n";
- /** Cheap-o extensions for Minitest.pass/.fail. */
- public static final String PASS_EXT = "." + Reporter.PASS;
-
- /** Cheap-o extensions for Minitest.pass/.fail. */
- public static final String FAIL_EXT = "." + Reporter.FAIL;
-
/** Just initialize test name, comment, numTestCases. */
public Minitest()
{
- numTestCases = 3; // REPLACE_num
+ numTestCases = 5; // REPLACE_num
testName = "Minitest";
testComment = "Minitest - developer check-in test for Xalan-J 2.x.";
}
@@ -143,9 +151,14 @@
/**
* Initialize this test - Set names of xml/xsl test files, etc.
- * Also cleans up the special Minitest.pass/fail files.
+ *
+ * Also cleans up any Pass-Minitest.xml file that is checked
+ * for in test.properties' minitest.passfile and generated by
+ * Reporter.writeResultsStatus().
+ *
* @param p Properties to initialize from (if needed)
* @return false if we should abort the test; true otherwise
+ * @see Reporter.writeResultsStatus(boolean)
*/
public boolean doTestFileInit(Properties p)
{
@@ -157,8 +170,8 @@
reporter.logErrorMsg("Problem creating output dir: " + outSubDir);
}
// Initialize an output name manager to that dir with .out extension
- outNames = new OutputNameManager(outputDir
- + File.separator + testName, ".out");
+ baseOutName = outputDir + File.separator + testName;
+ outNames = new OutputNameManager(baseOutName, ".out");
String testBasePath = inputDir
+ File.separator;
@@ -170,77 +183,47 @@
// Use separate output files for different versions, since
// some indenting rules are implemented differently 1.x/2.x
testFileInfo.goldName = goldBasePath + "Minitest-xalanj2.out";
+ testFileInfo.description = "General minitest, covers many xsl: elems";
paramFileInfo.inputName = testBasePath + "MinitestParam.xsl";
paramFileInfo.xmlName = testBasePath + "MinitestParam.xml";
paramFileInfo.goldName = goldBasePath + "MinitestParam.out";
+ paramFileInfo.description = "Simple string and int params";
+
+ perfFileInfo.inputName = testBasePath + "MinitestPerf.xsl";
+ perfFileInfo.xmlName = testBasePath + "MinitestPerf.xml";
+ perfFileInfo.goldName = goldBasePath + "MinitestPerf.out";
+ perfFileInfo.description = "Simple performance test";
- reporter.logHashtable(reporter.INFOMSG, System.getProperties(),
- "System.getProperties");
- reporter.logHashtable(reporter.INFOMSG, testProps, "testProps");
try
{
- // Clean up the special minitest result files we output in doTestFileClose
- File f = new File(outputDir + File.separator + testName + PASS_EXT);
- f.delete();
- f = new File(outputDir + File.separator + testName + FAIL_EXT);
+ // Clean up any Pass files for the minitest that exist
+ //@see Reporter.writeResultsStatus(boolean)
+ String logFileBase = (new File(testProps.getProperty(Logger.OPT_LOGFILE, "ResultsSummary.xml"))).getAbsolutePath();
+ logFileBase = (new File(logFileBase)).getParent();
+
+ File f = new File(logFileBase, Logger.PASS + "-" + testName + ".xml");
+ reporter.logTraceMsg("Deleting previous file: " + f);
f.delete();
}
catch (Exception e)
{
- reporter.logErrorMsg("Deleting minitest.pass/fail files threw: " + e.toString());
- reporter.logThrowable(reporter.ERRORMSG, e, "Deleting minitest.pass/fail files threw");
+ reporter.logThrowable(reporter.ERRORMSG, e, "Deleting Pass-Minitest file threw");
+ reporter.logErrorMsg("Deleting Pass-Minitest file threw: " + e.toString());
}
- return true;
- }
-
- /**
- * Cleanup this test - write out special Minitest results file.
- *
- * @param p Properties to initialize from (if needed)
- * @return false if we should abort the test; true otherwise
- */
- public boolean doTestFileClose(Properties p)
- {
- String passFailFilename = outputDir + File.separator + testName;
- if (reporter.getCurrentFileResult() == reporter.PASS_RESULT)
- {
- passFailFilename += PASS_EXT;
- }
- else
- {
- // Note any non-pass is called a 'fail' here, including
- // any Fail/Incp/Ambg/Errr results
- passFailFilename += FAIL_EXT;
- }
- try
- {
- reporter.logTraceMsg("About to write out passFailFilename: " + passFailFilename);
- PrintWriter passFailFile = new PrintWriter(new FileOutputStream(passFailFilename));
- passFailFile.println("Minitest-result:" + reporter.resultToString(reporter.getCurrentFileResult()));
- passFailFile.println("Minitest-testCases:" + aggregateResults);
- passFailFile.println("Minitest-logFile:" + testProps.getProperty(Logger.OPT_LOGFILE, "none"));
- passFailFile.println("Minitest-date:" + (new Date()).toString());
- passFailFile.close();
- }
- catch (Exception e)
- {
- reporter.logErrorMsg("NOTE! writing " + passFailFilename + " threw: " + e.toString());
- reporter.logThrowable(reporter.ERRORMSG, e, "NOTE! writing " + passFailFilename + " threw");
- }
return true;
}
/**
- * Basic stream transforms and simple API coverage.
+ * Basic systemId transforms and params plus API coverage.
*
* @return false if we should abort the test; true otherwise
*/
public boolean testCase1()
{
- reporter.testCaseInit("Basic stream transforms and simple API coverage");
+ reporter.testCaseInit("Basic systemId transforms and params plus API coverage");
TransformerFactory factory = null;
Templates templates = null;
@@ -248,25 +231,25 @@
try
{
factory = TransformerFactory.newInstance();
- templates = factory.newTemplates(new StreamSource(filenameToURI(testFileInfo.inputName)));
+ templates = factory.newTemplates(new StreamSource(QetestUtils.filenameToURL(testFileInfo.inputName)));
reporter.check((templates != null), true, "factory.newTemplates(StreamSource) is non-null");
}
catch (Throwable t)
{
- reporter.checkFail("Problem creating Templates; cannot continue testcase");
reporter.logThrowable(reporter.ERRORMSG, t,
"Problem creating Templates; cannot continue testcase");
- return testCaseClose(true);
+ reporter.checkErr("Problem creating Templates; cannot continue testcase");
+ return true;
}
try
{
- // Validate a stream transform
- reporter.logTraceMsg("Basic stream transform(1)(" + filenameToURI(testFileInfo.xmlName) + ", "
- + filenameToURI(testFileInfo.inputName) + ", "
+ // Validate a systemId transform
+ reporter.logTraceMsg("Basic stream transform(1)(" + QetestUtils.filenameToURL(testFileInfo.xmlName) + ", "
+ + QetestUtils.filenameToURL(testFileInfo.inputName) + ", "
+ outNames.nextName());
transformer = templates.newTransformer();
FileOutputStream fos = new FileOutputStream(outNames.currentName());
- transformer.transform(new StreamSource(filenameToURI(testFileInfo.xmlName)),
+ transformer.transform(new StreamSource(QetestUtils.filenameToURL(testFileInfo.xmlName)),
new StreamResult(fos));
fos.close();
int fileCheckStatus = fileChecker.check(reporter,
@@ -280,11 +263,11 @@
}
// Validate transformer reuse
- reporter.logTraceMsg("Basic stream transform(2)(" + filenameToURI(testFileInfo.xmlName) + ", "
- + filenameToURI(testFileInfo.inputName) + ", "
+ reporter.logTraceMsg("Basic stream transform(2)(" + QetestUtils.filenameToURL(testFileInfo.xmlName) + ", "
+ + QetestUtils.filenameToURL(testFileInfo.inputName) + ", "
+ outNames.nextName());
fos = new FileOutputStream(outNames.currentName());
- transformer.transform(new StreamSource(filenameToURI(testFileInfo.xmlName)),
+ transformer.transform(new StreamSource(QetestUtils.filenameToURL(testFileInfo.xmlName)),
new StreamResult(fos));
fos.close();
fileCheckStatus = fileChecker.check(reporter,
@@ -306,7 +289,7 @@
try
{
// Validate selected API's - primarily Parameters
- Templates paramTemplates = factory.newTemplates(new StreamSource(filenameToURI(paramFileInfo.inputName)));
+ Templates paramTemplates = factory.newTemplates(new StreamSource(QetestUtils.filenameToURL(paramFileInfo.inputName)));
Transformer paramTransformer = paramTemplates.newTransformer();
String paramStr = "paramVal";
paramTransformer.setParameter(PARAM1S, paramStr);
@@ -353,11 +336,11 @@
paramTransformer.setParameter(PARAM1N, "new-param1n-value");
reporter.logTraceMsg("Just reset " + PARAM1N + " to new-param1n-value");
- reporter.logTraceMsg("Stream-param transform(" + filenameToURI(paramFileInfo.xmlName) + ", "
- + filenameToURI(paramFileInfo.inputName) + ", "
+ reporter.logTraceMsg("Stream-param transform(" + QetestUtils.filenameToURL(paramFileInfo.xmlName) + ", "
+ + QetestUtils.filenameToURL(paramFileInfo.inputName) + ", "
+ outNames.nextName());
FileOutputStream fos = new FileOutputStream(outNames.currentName());
- paramTransformer.transform(new StreamSource(filenameToURI(paramFileInfo.xmlName)),
+ paramTransformer.transform(new StreamSource(QetestUtils.filenameToURL(paramFileInfo.xmlName)),
new StreamResult(fos));
fos.close();
int fileCheckStatus = fileChecker.check(reporter,
@@ -380,120 +363,245 @@
reporter.checkFail("Problem with parameters");
reporter.logThrowable(reporter.ERRORMSG, t, "Problem with parameters");
}
-
-
- return testCaseClose(true);
+ reporter.testCaseClose();
+ return true;
}
/**
- * Basic DOM transforms and simple API coverage.
- * // @todo!
+ * Basic trax.dom transformWrapper.
+ *
* @return false if we should abort the test; true otherwise
*/
public boolean testCase2()
{
- reporter.testCaseInit("Basic DOM transforms and simple API coverage");
-
- TransformerFactory factory = null;
- Templates templates = null;
+ final String FLAVOR = "trax.dom";
+ final String DESC = "Basic " + FLAVOR + " transformWrapper";
+ reporter.testCaseInit(DESC);
try
{
- factory = TransformerFactory.newInstance();
- // templates = factory.newTemplates(new StreamSource(filenameToURI(testFileInfo.inputName)));
- }
+ testFileInfo.outputName = outNames.nextName();
+ transformUsingFlavor(testFileInfo, FLAVOR);
+ fileChecker.check(reporter,
+ new File(testFileInfo.outputName),
+ new File(testFileInfo.goldName),
+ DESC +" into: " + testFileInfo.outputName);
+
+ }
catch (Throwable t)
{
- reporter.checkFail("Problem creating Templates; cannot continue testcase");
- reporter.logThrowable(reporter.ERRORMSG, t,
- "Problem creating Templates; cannot continue testcase");
- return testCaseClose(true);
+ reporter.logThrowable(reporter.ERRORMSG, t, DESC + " threw: ");
+ reporter.checkErr(DESC + " threw: " + t.toString());
}
+ return true;
+ }
+
+
+ /**
+ * Basic trax.sax transformWrapper.
+ *
+ * @return false if we should abort the test; true otherwise
+ */
+ public boolean testCase3()
+ {
+ final String FLAVOR = "trax.sax";
+ final String DESC = "Basic " + FLAVOR + " transformWrapper";
+ reporter.testCaseInit(DESC);
try
{
- // Add DOM test code here
- reporter.check(true, true, "@todo Add DOM test code here");
+ testFileInfo.outputName = outNames.nextName();
+ transformUsingFlavor(testFileInfo, FLAVOR);
+ fileChecker.check(reporter,
+ new File(testFileInfo.outputName),
+ new File(testFileInfo.goldName),
+ DESC +" into: " + testFileInfo.outputName);
}
catch (Throwable t)
{
- reporter.checkFail("Problem with test(1)");
- reporter.logThrowable(reporter.ERRORMSG, t, "Problem with test(1)");
+ reporter.logThrowable(reporter.ERRORMSG, t, DESC + " threw: ");
+ reporter.checkErr(DESC + " threw: " + t.toString());
}
- return testCaseClose(true);
+ reporter.testCaseClose();
+ return true;
}
/**
- * Basic SAX transforms and simple API coverage.
- * // @todo!
+ * Basic trax.stream transformWrapper.
+ *
* @return false if we should abort the test; true otherwise
*/
- public boolean testCase3()
+ public boolean testCase4()
{
- reporter.testCaseInit("Basic SAX transforms and simple API coverage");
-
- TransformerFactory factory = null;
- Templates templates = null;
+ final String FLAVOR = "trax.stream";
+ final String DESC = "Basic " + FLAVOR + " transformWrapper";
+ reporter.testCaseInit(DESC);
try
{
- factory = TransformerFactory.newInstance();
- // templates = factory.newTemplates(new StreamSource(filenameToURI(testFileInfo.inputName)));
- }
+ testFileInfo.outputName = outNames.nextName();
+ transformUsingFlavor(testFileInfo, FLAVOR);
+ fileChecker.check(reporter,
+ new File(testFileInfo.outputName),
+ new File(testFileInfo.goldName),
+ DESC +" into: " + testFileInfo.outputName);
+ }
catch (Throwable t)
{
- reporter.checkFail("Problem creating Templates; cannot continue testcase");
- reporter.logThrowable(reporter.ERRORMSG, t,
- "Problem creating Templates; cannot continue testcase");
- return testCaseClose(true);
+ reporter.logThrowable(reporter.ERRORMSG, t, DESC + " threw: ");
+ reporter.checkErr(DESC + " threw: " + t.toString());
}
+ reporter.testCaseClose();
+ return true;
+ }
+
+
+ /**
+ * Basic performance measurements of sample files.
+ * @return false if we should abort the test; true otherwise
+ */
+ public boolean testCase5()
+ {
+ String flavor = null;
+ final String DESC = "Simple performance measurement ";
+ reporter.testCaseInit(DESC);
+ // Reset the counting for outputNames for this testcase
+ outNames = new OutputNameManager(baseOutName + "Perf", ".out");
try
{
- // Add SAX test code here
- reporter.check(true, true, "@todo Add SAX test code here");
+ long[] times = null;
+ Vector streamTimes = new Vector();
+ Vector domTimes = new Vector();
+ TransformWrapper transformWrapper = null;
+
+ flavor = "trax.stream";
+ transformWrapper = TransformWrapperFactory.newWrapper(flavor);
+ transformWrapper.newProcessor(testProps);
+ reporter.logHashtable(Logger.TRACEMSG, transformWrapper.getProcessorInfo(), "wrapper.getProcessorInfo() for next transforms");
+
+ // Repeat a few times with streams
+ for (int i = 1; i <= 5; i++)
+ {
+ perfFileInfo.outputName = outNames.nextName();
+ reporter.logInfoMsg("perf-stream transform into " + perfFileInfo.outputName);
+ times = transformWrapper.transform(perfFileInfo.xmlName, perfFileInfo.inputName, perfFileInfo.outputName);
+ logPerfElem(times, perfFileInfo, flavor);
+ streamTimes.addElement(new Long(times[TransformWrapper.IDX_OVERALL]));
+ }
+ // Only bother checking the *last* iteration of perfs
+ fileChecker.check(reporter,
+ new File(perfFileInfo.outputName),
+ new File(perfFileInfo.goldName),
+ DESC + flavor + " into: " + perfFileInfo.outputName);
+
+ flavor = "trax.dom";
+ transformWrapper = TransformWrapperFactory.newWrapper(flavor);
+ transformWrapper.newProcessor(testProps);
+ reporter.logHashtable(Logger.TRACEMSG, transformWrapper.getProcessorInfo(), "wrapper.getProcessorInfo() for next transforms");
+
+ // Repeat a few times with DOMs
+ for (int i = 1; i <= 5; i++)
+ {
+ perfFileInfo.outputName = outNames.nextName();
+ reporter.logInfoMsg("perf-dom transform into " + perfFileInfo.outputName);
+ times = transformWrapper.transform(perfFileInfo.xmlName, perfFileInfo.inputName, perfFileInfo.outputName);
+ logPerfElem(times, perfFileInfo, flavor);
+ domTimes.addElement(new Long(times[TransformWrapper.IDX_OVERALL]));
+ }
+ // Only bother checking the *last* iteration of perfs
+ fileChecker.check(reporter,
+ new File(perfFileInfo.outputName),
+ new File(perfFileInfo.goldName),
+ DESC + flavor + " into: " + perfFileInfo.outputName);
+
+ // Log a big message at the very end to make it easier to see
+ StringBuffer buf = new StringBuffer("Minitest.testCase5 PERFORMANCE NUMBERS\n");
+ buf.append(" STREAM OVERALL TIMES: ");
+ for (Enumeration enum = streamTimes.elements();
+ enum.hasMoreElements(); /* no increment portion */ )
+ {
+ buf.append(enum.nextElement());
+ buf.append(", ");
+ }
+ buf.append("\n");
+ buf.append(" DOM OVERALL TIMES: ");
+ for (Enumeration enum = domTimes.elements();
+ enum.hasMoreElements(); /* no increment portion */ )
+ {
+ buf.append(enum.nextElement());
+ buf.append(", ");
+ }
+ buf.append("\n");
+ reporter.logArbitrary(Logger.CRITICALMSG, buf.toString());
}
catch (Throwable t)
{
- reporter.checkFail("Problem with test(1)");
- reporter.logThrowable(reporter.ERRORMSG, t, "Problem with test(1)");
+ reporter.logThrowable(reporter.ERRORMSG, t, DESC + flavor + " threw: ");
+ reporter.checkErr(DESC + flavor + " threw: " + t.toString());
}
- return testCaseClose(true);
+ reporter.testCaseClose();
+ return true;
}
/**
- * Worker method to translate String to URI.
- * Note: Xerces and Crimson appear to handle some URI references
- * differently - this method needs further work once we figure out
- * exactly what kind of format each parser wants (esp. considering
- * relative vs. absolute references).
- * @param String path\filename of test file
- * @return URL to pass to SystemId
+ * Worker method to use a TransformWrapper to transform a file.
+ *
+ * @param fileInfo inputName, xmlName of file to test
+ * @param flavor of TransformWrapper to use
+ * @return log number of overall millisec for transform.
*/
- public String filenameToURI(String filename)
+ public void transformUsingFlavor(XSLTestfileInfo fileInfo, String flavor)
+ throws Exception
{
- File f = new File(filename);
- String tmp = f.getAbsolutePath();
- if (File.separatorChar == '\\') {
- tmp = tmp.replace('\\', '/');
- }
- return "file:///" + tmp;
+ TransformWrapper transformWrapper = TransformWrapperFactory.newWrapper(flavor);
+ transformWrapper.newProcessor(testProps);
+ reporter.logHashtable(Logger.TRACEMSG, transformWrapper.getProcessorInfo(), "wrapper.getProcessorInfo() for next transform");
+ if (null == fileInfo.inputName)
+ {
+ // presume it's an embedded test
+ reporter.logInfoMsg("transformEmbedded(" + fileInfo.xmlName + ", " + fileInfo.outputName + ")");
+ long[] times = transformWrapper.transformEmbedded(fileInfo.xmlName, fileInfo.outputName);
+ logPerfElem(times, fileInfo, flavor);
+ }
+ else
+ {
+ // presume it's a normal stylesheet test
+ reporter.logInfoMsg("transform(" + fileInfo.xmlName + ", " + fileInfo.inputName + ", " + fileInfo.outputName + ")");
+ long[] times = transformWrapper.transform(fileInfo.xmlName, fileInfo.inputName, fileInfo.outputName);
+ logPerfElem(times, fileInfo, flavor);
+ }
+
}
/**
- * Convenience method to close a testCase and return.
- * This is kind of a hack for the minitest, so it can dump a
- * cheap overview report into the passFailFilename above.
- * @param boolean to return
- * @return value passed in
+ * Worker method to output a <perf> element.
+ * @return false if we should abort the test; true otherwise
*/
- public boolean testCaseClose(boolean flag)
+ public void logPerfElem(long[] times, XSLTestfileInfo fileInfo, String flavor)
{
- aggregateResults += "\ntestCase(" + reporter.getCurrentCaseNum()
- + ") " + reporter.getCurrentCaseComment()
- + " result:" + reporter.resultToString(reporter.getCurrentCaseResult());
- reporter.testCaseClose();
- return flag;
+ Hashtable attrs = new Hashtable();
+ // Add general information about this perf elem
+ attrs.put("UniqRunid", testProps.getProperty("runId", "runId;none"));
+ attrs.put("processor", flavor);
+ // idref is the individual filename
+ attrs.put("idref", (new File(fileInfo.inputName)).getName());
+ // inputName is the actual name we gave to the processor
+ attrs.put("inputName", fileInfo.inputName);
+
+ // Add all available specific timing data as well
+ for (int i = 0; i < times.length; i++)
+ {
+ // Only log items that have actual timing data
+ if (TransformWrapper.TIME_UNUSED != times[i])
+ {
+ attrs.put(TransformWrapperHelper.getTimeArrayDesc(i),
+ new Long(times[i]));
+ }
+ }
+
+ // Log the element out; note formatting matches
+ reporter.logElement(Logger.STATUSMSG, "perf", attrs, fileInfo.description);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org