curcuru 01/01/25 12:36:58
Modified: test/java/src/org/apache/qetest/xalanj1
StylesheetReuseTest.java
Log:
Updated to make tests more atomic to try to get better 2.x compat.jar coverage
Revision Changes Path
1.2 +48 -21
xml-xalan/test/java/src/org/apache/qetest/xalanj1/StylesheetReuseTest.java
Index: StylesheetReuseTest.java
===================================================================
RCS file:
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/xalanj1/StylesheetReuseTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StylesheetReuseTest.java 2001/01/23 23:14:58 1.1
+++ StylesheetReuseTest.java 2001/01/25 20:36:54 1.2
@@ -87,7 +87,7 @@
/**
* Testing various cases of stylesheet re-use.
* @author [EMAIL PROTECTED]
- * @version $Id: StylesheetReuseTest.java,v 1.1 2001/01/23 23:14:58 curcuru
Exp $
+ * @version $Id: StylesheetReuseTest.java,v 1.2 2001/01/25 20:36:54 curcuru
Exp $
*/
public class StylesheetReuseTest extends XSLProcessorTestBase
{
@@ -141,13 +141,13 @@
+ XALANJ1_SUBDIR
+ File.separator;
- testFileInfo.inputName = testBasePath + "StylesheetReuseTest1.xsl";
- testFileInfo.xmlName = testBasePath + "StylesheetReuseTest1.xml";
- testFileInfo.goldName = goldBasePath + "StylesheetReuseTest1.out";
-
- otherFileInfo.inputName = testBasePath + "ParamTest1.xsl";
- otherFileInfo.xmlName = testBasePath + "ParamTest1.xml";
- otherFileInfo.goldName = goldBasePath + "ParamTest1.out";
+ testFileInfo.inputName = filenameToURL(testBasePath +
"StylesheetReuseTest1.xsl");
+ testFileInfo.xmlName = filenameToURL(testBasePath +
"StylesheetReuseTest1.xml");
+ testFileInfo.goldName = filenameToURL(goldBasePath +
"StylesheetReuseTest1.out");
+
+ otherFileInfo.inputName = filenameToURL(testBasePath +
"ParamTest1.xsl");
+ otherFileInfo.xmlName = filenameToURL(testBasePath +
"ParamTest1.xml");
+ otherFileInfo.goldName = filenameToURL(goldBasePath +
"ParamTest1.out");
return true;
}
@@ -171,41 +171,67 @@
{
processor = (XSLTEngineImpl)
XSLTProcessorFactory.getProcessorUsingLiaisonName(liaison);
}
+ int result = Logger.INCP_RESULT;
+ // Create one stylesheet
+ XSLTInputSource xslSrc = new
XSLTInputSource(testFileInfo.inputName);
+ StylesheetRoot stylesheetRoot =
processor.processStylesheet(xslSrc);
+
+ // This should have implicitly set the stylesheet in the
processor
+ // Verify you can do a process now
+ reporter.logTraceMsg("About to process1(" + testFileInfo.xmlName
+ + ", implicit:" + testFileInfo.inputName +
",...)");
+ processor.process(new XSLTInputSource(testFileInfo.xmlName),
+ null,
+ new XSLTResultTarget(outNames.nextName()));
+ result = fileChecker.check(reporter,
+ new File(outNames.currentName()),
+ new File(testFileInfo.goldName),
+ "processStylesheet(1) implicit transform into:
" + outNames.currentName());
+ if (result == Logger.FAIL_RESULT)
+ reporter.logInfoMsg("processStylesheet(1) implicit transform
failure reason:" + fileChecker.getExtendedInfo());
}
catch (Exception e)
{
- reporter.checkErr("Could not create processor, threw: " +
e.toString());
- reporter.logThrowable(Logger.ERRORMSG, e, "Could not create
processor");
- return false;
+ reporter.checkFail("processStylesheet(1) implicit transform
threw: " + e.toString());
+ reporter.logThrowable(Logger.ERRORMSG, e, "processStylesheet(1)
implicit transform threw");
}
try
{
+ if ((liaison == null) || ("".equals(liaison)))
+ {
+ processor = (XSLTEngineImpl)
XSLTProcessorFactory.getProcessor();
+ }
+ else
+ {
+ processor = (XSLTEngineImpl)
XSLTProcessorFactory.getProcessorUsingLiaisonName(liaison);
+ }
int result = Logger.INCP_RESULT;
// Create one stylesheet
XSLTInputSource xslSrc = new
XSLTInputSource(testFileInfo.inputName);
StylesheetRoot stylesheetRoot =
processor.processStylesheet(xslSrc);
- // This should have implicitly set the stylesheet in the
processor
- // Verify you can do a process now
- reporter.logTraceMsg("About to process1(" + testFileInfo.xmlName
- + ", " + testFileInfo.xmlName + ",...)");
+ // Set this stylesheet into the processor
+ processor.setStylesheet(stylesheetRoot);
+ reporter.logTraceMsg("About to process2(" + testFileInfo.xmlName
+ + ", set:" + testFileInfo.inputName +
",...)");
processor.process(new XSLTInputSource(testFileInfo.xmlName),
null,
new XSLTResultTarget(outNames.nextName()));
result = fileChecker.check(reporter,
new File(outNames.currentName()),
new File(testFileInfo.goldName),
- "processStylesheet(1) implicit transform into:
" + outNames.currentName());
+ "processStylesheet(2) set transform into: " +
outNames.currentName());
if (result == Logger.FAIL_RESULT)
- reporter.logInfoMsg("processStylesheet implicit transform
failure reason:" + fileChecker.getExtendedInfo());
+ reporter.logInfoMsg("processStylesheet(2) set transform
failure reason:" + fileChecker.getExtendedInfo());
+
// Reset, explicitly set the stylesheet to the same one,
// and process again
processor.reset();
processor.setStylesheet(stylesheetRoot);
- reporter.logTraceMsg("About to process2(" + testFileInfo.xmlName
- + ", " + testFileInfo.xmlName + ",...)");
+ reporter.logTraceMsg("About to process3(" + testFileInfo.xmlName
+ + ", " + testFileInfo.inputName + ",...)");
processor.process(new XSLTInputSource(testFileInfo.xmlName),
null,
new XSLTResultTarget(outNames.nextName()));
@@ -298,8 +324,9 @@
XSLTInputSource otherXslSrc = new
XSLTInputSource(otherFileInfo.inputName);
StylesheetRoot otherStylesheetRoot =
processor.processStylesheet(otherXslSrc);
- // This should have implicitly set the other stylesheet in the
processor
- // Verify you can do a process now
+ // Explicitly set the stylesheet (this is necessary when
+ // testing with the 2.x compat.jar)
+ processor.setStylesheet(otherStylesheetRoot);
reporter.logTraceMsg("About to process1(" +
otherFileInfo.xmlName
+ ", " + otherFileInfo.xmlName + ",...)");
processor.process(new XSLTInputSource(otherFileInfo.xmlName),