[prev in list] [next in list] [prev in thread] [next in thread]
List: xalan-cvs
Subject: [xalan-test] 01/01: This commit was manufactured by cvs2svn to create tag 'xalan_2_0_0'.
From: ggregory () apache ! org
Date: 2019-04-22 1:37:54
Message-ID: 20190422013700.4614A87A35 () gitbox ! apache ! org
[Download RAW message or body]
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to annotated tag xalan_2_0_0
in repository https://gitbox.apache.org/repos/asf/xalan-test.git
commit 020f91fea217b79f2cbf418b3e77a62dc3c8c853
Author: No Author <dev-null@apache.org>
AuthorDate: Thu Feb 1 16:51:21 2001 +0000
This commit was manufactured by cvs2svn to create tag 'xalan_2_0_0'.
---
.../apache/qetest/trax/OutputPropertiesTest.java | 588 +++++++++++++++++++++
.../apache/qetest/xsl/XSLDirectoryIterator.java | 7 +-
.../apache/qetest/xsl/XSLProcessorTestBase.java | 25 +
results.dtd | 147 ------
tests/api-gold/trax/OutputPropertiesHTML.out | 18 +
tests/api/trax/OutputPropertiesHTML.xml | 13 +
tests/api/trax/OutputPropertiesHTML.xsl | 51 ++
tests/conf-gold/ver/ver05.out | 2 +
tests/conf-gold/ver/ver06.out | 2 +
tests/conf-gold/ver/ver07.out | 2 +
tests/conf/ver/ver05.xml | 3 +
tests/conf/ver/ver05.xsl | 30 ++
tests/conf/ver/ver06.xml | 3 +
tests/conf/ver/ver06.xsl | 30 ++
tests/conf/ver/ver07.xml | 3 +
tests/conf/ver/ver07.xsl | 30 ++
16 files changed, 801 insertions(+), 153 deletions(-)
diff --git a/java/src/org/apache/qetest/trax/OutputPropertiesTest.java \
b/java/src/org/apache/qetest/trax/OutputPropertiesTest.java new file mode 100644
index 0000000..049cd8a
--- /dev/null
+++ b/java/src/org/apache/qetest/trax/OutputPropertiesTest.java
@@ -0,0 +1,588 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 2000, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/*
+ *
+ * OutputPropertiesTest.java
+ *
+ */
+package org.apache.qetest.trax;
+
+// Support for test reporting and harness classes
+import org.apache.qetest.*;
+import org.apache.qetest.xsl.*;
+
+// Import all relevant TRAX packages
+import javax.xml.transform.*;
+import javax.xml.transform.dom.*;
+import javax.xml.transform.sax.*;
+import javax.xml.transform.stream.*;
+
+// Needed SAX, DOM, JAXP classes
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.w3c.dom.Node;
+import org.w3c.dom.Document;
+
+// java classes
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.Enumeration;
+import java.util.Properties;
+
+//-------------------------------------------------------------------------
+
+/**
+ * Verify how output properties are handled from stylesheets and the API.
+ * @author shane_curcuru@lotus.com
+ * @author Krishna.Meduri@eng.sun.com
+ * @version $Id$
+ */
+public class OutputPropertiesTest extends XSLProcessorTestBase
+{
+
+ /** Used for generating names of actual output files. */
+ protected OutputNameManager outNames;
+
+ /** Default OutputPropertiesTest.xml/xsl file pair. */
+ protected XSLTestfileInfo htmlFileInfo = new XSLTestfileInfo();
+
+ /** xml/xsl file pair used in testlets. */
+ protected XSLTestfileInfo testletFileInfo = new XSLTestfileInfo();
+
+ /** Alternate gold file used in testlets. */
+ protected String citiesIndentNoGoldFile = null;
+
+ /** Alternate gold file used in testlets. */
+ protected String citiesMethodTextGoldFile = null;
+
+ /** Subdirectory under test\tests\api for our xsl/xml files. */
+ public static final String TRAX_SUBDIR = "trax";
+
+ /** Key for testlets to do special validation. */
+ public static final String CROSS_VALIDATE = "validate-non-gold";
+
+ /** Just initialize test name, comment, numTestCases. */
+ public OutputPropertiesTest()
+ {
+ numTestCases = 2; // REPLACE_num
+ testName = "OutputPropertiesTest";
+ testComment = "Verify how output properties are handled from stylesheets and \
the API"; + }
+
+
+ /**
+ * Initialize this test - Set names of xml/xsl test files, etc.
+ *
+ * @param p Properties to initialize from (if needed)
+ * @return false if we should abort the test; true otherwise
+ */
+ public boolean doTestFileInit(Properties p)
+ {
+ // Used for all tests; just dump files in trax subdir
+ File outSubDir = new File(outputDir + File.separator + TRAX_SUBDIR);
+ if (!outSubDir.mkdirs())
+ reporter.logWarningMsg("Possible problem creating output dir: " + \
outSubDir); + // Initialize an output name manager to that dir with .out \
extension + outNames = new OutputNameManager(outputDir + File.separator + \
TRAX_SUBDIR + + File.separator + testName, \
".out"); +
+ String testBasePath = inputDir
+ + File.separator
+ + TRAX_SUBDIR
+ + File.separator;
+ String goldBasePath = goldDir
+ + File.separator
+ + TRAX_SUBDIR
+ + File.separator;
+
+ htmlFileInfo.inputName = testBasePath + "OutputPropertiesHTML.xsl";
+ htmlFileInfo.xmlName = testBasePath + "OutputPropertiesHTML.xml";
+ htmlFileInfo.goldName = goldBasePath + "OutputPropertiesHTML.out";
+
+ testletFileInfo.inputName = testBasePath + File.separator + "sax"
+ + File.separator + "cities.xsl";
+ testletFileInfo.xmlName = testBasePath + File.separator + "sax"
+ + File.separator + "cities.xml";
+ testletFileInfo.goldName = goldBasePath + File.separator + "sax"
+ + File.separator + "cities.out";
+ citiesIndentNoGoldFile = goldBasePath + File.separator + "sax"
+ + File.separator + "cities-indent-no.out";
+ citiesMethodTextGoldFile = goldBasePath + File.separator + "sax"
+ + File.separator + "cities-method-text.out";
+ return true;
+ }
+
+
+ /**
+ * Verify setting output properties individually or whole blocks.
+ * @return false if we should abort the test; true otherwise
+ */
+ public boolean testCase1()
+ {
+ reporter.testCaseInit("Verify setting output properties individually or \
whole blocks."); + // Simply start with Krishna's individual tests
+ testlet0(testletFileInfo.xmlName, testletFileInfo.inputName, \
testletFileInfo.goldName); + testlet1(testletFileInfo.xmlName, \
testletFileInfo.inputName, citiesIndentNoGoldFile); + \
testlet2(testletFileInfo.xmlName, testletFileInfo.inputName, citiesIndentNoGoldFile); \
+ testlet3(testletFileInfo.xmlName, testletFileInfo.inputName, \
citiesMethodTextGoldFile); +
+ reporter.testCaseClose();
+ return true;
+ }
+
+ /**
+ * Verify various output properties with HTML.
+ * @return false if we should abort the test; true otherwise
+ */
+ public boolean testCase2()
+ {
+ reporter.testCaseInit("Verify various output properties with HTML.");
+ TransformerFactory factory = null;
+ Templates templates = null;
+ try
+ {
+ // Preprocess the HTML stylesheet for later use
+ factory = TransformerFactory.newInstance();
+ reporter.logInfoMsg("creating shared newTemplates(" + \
filenameToURL(htmlFileInfo.inputName) + ")"); + templates = \
factory.newTemplates(new StreamSource(filenameToURL(htmlFileInfo.inputName))); + \
reporter.logHashtable(Logger.STATUSMSG, + \
templates.getOutputProperties(), "shared templates output properties"); +
+ // Process the file once with default properties
+ Transformer transformer = templates.newTransformer();
+ Result result = new StreamResult(outNames.nextName());
+ reporter.logInfoMsg("(0)shared transform(" + \
filenameToURL(htmlFileInfo.xmlName) + + ", " + \
outNames.currentName() + ")"); + transformer.transform(new \
StreamSource(filenameToURL(htmlFileInfo.xmlName)), result); + // Validate \
the default transform + if
+ (Logger.PASS_RESULT
+ != fileChecker.check(reporter,
+ new File(outNames.currentName()),
+ new File(htmlFileInfo.goldName),
+ "(0)shared transform into: " + \
outNames.currentName() + + " gold: " + \
htmlFileInfo.goldName) + )
+ {
+ reporter.logInfoMsg("(0)shared transform failure reason:" + \
fileChecker.getExtendedInfo()); + }
+ }
+ catch (Throwable t)
+ {
+ reporter.checkErr("(0)Creating shared stylesheet threw:" + \
t.toString()); + reporter.logThrowable(reporter.ERRORMSG, t, "(0)Creating \
shared stylesheet threw "); + return true;
+ }
+
+ // Create a number of testcases and use worker method to process
+ Properties setProps = new Properties();
+ // If we reset only one property each time, the results should match
+ // whether we set it thru properties or individually
+ setProps.put("indent", "no");
+ outputPropertyTestlet(templates, filenameToURL(htmlFileInfo.xmlName),
+ setProps, CROSS_VALIDATE, CROSS_VALIDATE,
+ "(1)Just reset indent=no");
+
+ setProps = new Properties();
+ setProps.put("method", "xml");
+ outputPropertyTestlet(templates, filenameToURL(htmlFileInfo.xmlName),
+ setProps, CROSS_VALIDATE, CROSS_VALIDATE,
+ "(2)Just reset method=xml");
+
+ // Just changing the standalone doesn't affect HTML output
+ setProps = new Properties();
+ setProps.put("standalone", "no");
+ outputPropertyTestlet(templates, filenameToURL(htmlFileInfo.xmlName),
+ setProps, htmlFileInfo.goldName, \
htmlFileInfo.goldName, + "(3)Just reset standalone=no");
+ reporter.testCaseClose();
+ return true;
+ }
+
+ /**
+ * outputPropertyTestlet: transform with specifically set output Properties.
+ * Sets properties as a block and also individually, and checks
+ * both outputs against the gold file.
+ * @author shane_curcuru@lotus.com
+ */
+ public void outputPropertyTestlet(Templates templates, String xmlId,
+ Properties setProps, String goldName1, String \
goldName2, + String desc)
+ {
+ try
+ {
+ reporter.logHashtable(Logger.STATUSMSG, setProps,
+ "(-)" + desc + " begin with properties");
+ // First, set the properties as a block and transform
+ Transformer transformer1 = templates.newTransformer();
+ transformer1.setOutputProperties(setProps);
+ Result result1 = new StreamResult(outNames.nextName());
+ reporter.logTraceMsg("(-a)transform(" + xmlId + ", " + \
outNames.currentName() + ")"); + transformer1.transform(new \
StreamSource(xmlId), result1); + // Only do validation if asked to
+ if (CROSS_VALIDATE == goldName1)
+ {
+ reporter.logWarningMsg("(-a-no-validation)" + desc + " into: " + \
outNames.currentName()); + }
+ else if
+ (Logger.PASS_RESULT
+ != fileChecker.check(reporter,
+ new File(outNames.currentName()),
+ new File(goldName1),
+ "(-a)" + desc + " into: " + \
outNames.currentName() + + " gold: " + \
goldName1) + )
+ {
+ reporter.logInfoMsg("(-a)" + desc + " failure reason:" + \
fileChecker.getExtendedInfo()); + }
+
+ // Second, set the properties individually and transform
+ Transformer transformer2 = templates.newTransformer();
+ for (Enumeration enum = setProps.propertyNames();
+ enum.hasMoreElements(); /* no increment portion */ )
+ {
+ String key = (String)enum.nextElement();
+ String value = setProps.getProperty(key);
+ transformer2.setOutputProperty(key, value);
+ }
+ Result result2 = new StreamResult(outNames.nextName());
+ reporter.logTraceMsg("(-b)transform(" + xmlId + ", " + \
outNames.currentName() + ")"); + transformer2.transform(new \
StreamSource(xmlId), result2); + // Only do validation if asked to
+ // If cross-validating, validate the first file against the second one
+ if (CROSS_VALIDATE == goldName2)
+ {
+ if
+ (Logger.PASS_RESULT
+ != fileChecker.check(reporter,
+ new File(outNames.previousName()),
+ new File(outNames.currentName()),
+ "(-b)" + desc + " into: " + \
outNames.currentName() + + " cross: " + \
outNames.previousName()) + )
+ {
+ reporter.logInfoMsg("(-b)" + desc + " failure reason:" + \
fileChecker.getExtendedInfo()); + }
+ }
+ else if
+ (Logger.PASS_RESULT
+ != fileChecker.check(reporter,
+ new File(outNames.currentName()),
+ new File(goldName2),
+ "(-b)" + desc + " into: " + \
outNames.currentName() + + " gold: " + \
goldName2) + )
+ {
+ reporter.logInfoMsg("(-b)" + desc + " failure reason:" + \
fileChecker.getExtendedInfo()); + }
+ }
+ catch (Throwable t)
+ {
+ reporter.checkFail("(-)" + desc + " threw:" + t.toString());
+ reporter.logThrowable(reporter.ERRORMSG, t, "(-)" + desc + " threw ");
+ }
+ }
+
+
+ /**
+ * testlet0: transform with just stylesheet properties.
+ * @author shane_curcuru@lotus.com
+ */
+ public void testlet0(String xmlName, String xslName, String goldName)
+ {
+ try
+ {
+ reporter.logStatusMsg("testlet0: transform with just stylesheet \
properties"); +
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true); // sc for Xerces
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ reporter.logTraceMsg("docBld.parse(" + xslName + ")");
+ Document document = db.parse(new File(xslName));
+ DOMSource domSource = new DOMSource(document);
+ domSource.setSystemId(filenameToURL(xslName)); // sc
+
+ TransformerFactory tfactory = TransformerFactory.newInstance();
+ Transformer transformer = tfactory.newTransformer(domSource);
+ Properties xslProps = transformer.getOutputProperties();
+ reporter.logHashtable(Logger.STATUSMSG, xslProps,
+ "Properties originally from the stylesheet");
+
+ reporter.logTraceMsg("new StreamSource(new FileInputStream(" + xmlName + \
"))"); + StreamSource streamSource = new StreamSource(new \
FileInputStream(xmlName)); + FileOutputStream fos = new \
FileOutputStream(outNames.nextName()); + StreamResult streamResult = new \
StreamResult(fos); +
+ // Verify transform with existing properties
+ reporter.logTraceMsg("transformer.transform(xml, " + \
outNames.currentName() + ")"); + transformer.transform(streamSource, \
streamResult); + fos.close();
+
+ if (Logger.PASS_RESULT
+ != fileChecker.check(reporter,
+ new File(outNames.currentName()),
+ new File(goldName),
+ "(t0)transform with stylesheet properties into: \
" + outNames.currentName()) + )
+ {
+ reporter.logInfoMsg("(t0)transform with stylesheet properties \
failure reason:" + fileChecker.getExtendedInfo()); + }
+ }
+ catch (Throwable t)
+ {
+ reporter.checkFail("testlet threw: " + t.toString());
+ reporter.logThrowable(Logger.WARNINGMSG, t, "testlet threw ");
+ }
+ }
+ /**
+ * testlet1: verify setOutputProperties(Properties).
+ * @author Krishna.Meduri@eng.sun.com
+ */
+ public void testlet1(String xmlName, String xslName, String goldName)
+ {
+ try
+ {
+ reporter.logStatusMsg("testlet1: verify \
setOutputProperties(Properties)"); +
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true); // sc for Xerces
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ reporter.logTraceMsg("docBld.parse(" + xslName + ")");
+ Document document = db.parse(new File(xslName));
+ DOMSource domSource = new DOMSource(document);
+ domSource.setSystemId(filenameToURL(xslName)); // sc
+
+ TransformerFactory tfactory = TransformerFactory.newInstance();
+ Transformer transformer = tfactory.newTransformer(domSource);
+ Properties xslProps = transformer.getOutputProperties();
+ reporter.logHashtable(Logger.STATUSMSG, xslProps,
+ "Properties originally from the stylesheet");
+
+ reporter.logTraceMsg("new StreamSource(new FileInputStream(" + xmlName + \
"))"); + StreamSource streamSource = new StreamSource(new \
FileInputStream(xmlName)); + FileOutputStream fos = new \
FileOutputStream(outNames.nextName()); + StreamResult streamResult = new \
StreamResult(fos); +
+ // Verify setting a whole block of properties
+ Properties properties = new Properties();
+ properties.put("method", "xml");
+ properties.put("encoding", "UTF-8");
+ properties.put("omit-xml-declaration", "no");
+ properties.put("{http://xml.apache.org/xslt}indent-amount", "0");
+ properties.put("indent", "no"); // This should override the indent=yes \
in the stylesheet + properties.put("standalone", "no");
+ properties.put("version", "1.0");
+ properties.put("media-type", "text/xml");
+ reporter.logHashtable(Logger.STATUSMSG, properties,
+ "Properties block to be set via API");
+ reporter.logTraceMsg("transformer.setOutputProperties(properties \
block)"); + transformer.setOutputProperties(properties);
+
+ reporter.logTraceMsg("transformer.transform(xml, " + \
outNames.currentName() + ")"); + transformer.transform(streamSource, \
streamResult); + fos.close();
+
+ if (Logger.PASS_RESULT
+ != fileChecker.check(reporter,
+ new File(outNames.currentName()),
+ new File(goldName),
+ "(t1)transform after setOutputProperties(props) \
into: " + outNames.currentName()) + )
+ {
+ reporter.logInfoMsg("(t1)transform after setOutputProperties(props) \
failure reason:" + fileChecker.getExtendedInfo()); + }
+ }
+ catch (Throwable t)
+ {
+ reporter.checkFail("testlet threw: " + t.toString());
+ reporter.logThrowable(Logger.WARNINGMSG, t, "testlet threw ");
+ }
+ }
+
+ /**
+ * testlet2: verify setOutputProperty(s, s).
+ * @author Krishna.Meduri@eng.sun.com
+ */
+ public void testlet2(String xmlName, String xslName, String goldName)
+ {
+ try
+ {
+ reporter.logStatusMsg("testlet2: verify setOutputProperty(s, s)");
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true); // sc for Xerces
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ reporter.logTraceMsg("docBld.parse(" + xslName + ")");
+ Document document = db.parse(new File(xslName));
+ DOMSource domSource = new DOMSource(document);
+ domSource.setSystemId(filenameToURL(xslName)); // sc
+
+ TransformerFactory tfactory = TransformerFactory.newInstance();
+ Transformer transformer = tfactory.newTransformer(domSource);
+ Properties xslProps = transformer.getOutputProperties();
+ reporter.logHashtable(Logger.STATUSMSG, xslProps,
+ "Properties originally from the stylesheet");
+
+ reporter.logTraceMsg("new StreamSource(new FileInputStream(" + xmlName + \
"))"); + StreamSource streamSource = new StreamSource(new \
FileInputStream(xmlName)); + FileOutputStream fos = new \
FileOutputStream(outNames.nextName()); + StreamResult streamResult = new \
StreamResult(fos); +
+ // Verify setting a whole block of properties
+ reporter.logTraceMsg("transformer.setOutputProperty(indent, no)");
+ transformer.setOutputProperty("indent", "no");
+
+ reporter.logTraceMsg("transformer.transform(xml, " + \
outNames.currentName() + ")"); + transformer.transform(streamSource, \
streamResult); + fos.close();
+
+ if (Logger.PASS_RESULT
+ != fileChecker.check(reporter,
+ new File(outNames.currentName()),
+ new File(goldName),
+ "(t2)transform after setOutputProperty(indent, \
no) into: " + outNames.currentName()) + )
+ {
+ reporter.logInfoMsg("(t2)transform after setOutputProperty(indent, \
no) failure reason:" + fileChecker.getExtendedInfo()); + }
+ }
+ catch (Throwable t)
+ {
+ reporter.checkFail("testlet threw: " + t.toString());
+ reporter.logThrowable(Logger.WARNINGMSG, t, "testlet threw ");
+ }
+ }
+ /**
+ * testlet1: verify setOutputProperty(s, s).
+ * @author Krishna.Meduri@eng.sun.com
+ */
+ public void testlet3(String xmlName, String xslName, String goldName)
+ {
+ try
+ {
+ reporter.logInfoMsg("testlet3: verify setOutputProperty(s, s)");
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true); // sc for Xerces
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ reporter.logTraceMsg("docBld.parse(" + xslName + ")");
+ Document document = db.parse(new File(xslName));
+ DOMSource domSource = new DOMSource(document);
+ domSource.setSystemId(filenameToURL(xslName)); // sc
+
+ TransformerFactory tfactory = TransformerFactory.newInstance();
+ Transformer transformer = tfactory.newTransformer(domSource);
+ Properties xslProps = transformer.getOutputProperties();
+ reporter.logHashtable(Logger.STATUSMSG, xslProps,
+ "Properties originally from the stylesheet");
+
+ reporter.logTraceMsg("new StreamSource(new FileInputStream(" + xmlName + \
"))"); + StreamSource streamSource = new StreamSource(new \
FileInputStream(xmlName)); + FileOutputStream fos = new \
FileOutputStream(outNames.nextName()); + StreamResult streamResult = new \
StreamResult(fos); +
+ // Verify setting single property
+ reporter.logTraceMsg("transformer.setOutputProperty(method, text)");
+ transformer.setOutputProperty("method", "text");
+
+ reporter.logTraceMsg("transformer.transform(xml, " + \
outNames.currentName() + ")"); + transformer.transform(streamSource, \
streamResult); + fos.close();
+
+ if (Logger.PASS_RESULT
+ != fileChecker.check(reporter,
+ new File(outNames.currentName()),
+ new File(goldName),
+ "(t3)transform after setOutputProperty(method, \
text) into: " + outNames.currentName()) + )
+ {
+ reporter.logInfoMsg("(t3)transform after setOutputProperty(method, \
text) failure reason:" + fileChecker.getExtendedInfo()); + }
+ }
+ catch (Throwable t)
+ {
+ reporter.checkFail("testlet threw: " + t.toString());
+ reporter.logThrowable(Logger.WARNINGMSG, t, "testlet threw ");
+ }
+ }
+
+ /**
+ * Convenience method to print out usage information - update if needed.
+ * @return String denoting usage of this test class
+ */
+ public String usage()
+ {
+ return ("Common [optional] options supported by OutputPropertiesTest:\n"
+ + "(Note: assumes inputDir=tests\\api)\n"
+ + super.usage()); // Grab our parent classes usage as well
+ }
+
+
+ /**
+ * Main method to run test from the command line - can be left alone.
+ * @param args command line argument array
+ */
+ public static void main(String[] args)
+ {
+
+ OutputPropertiesTest app = new OutputPropertiesTest();
+
+ app.doMain(args);
+ }
+}
diff --git a/java/src/org/apache/qetest/xsl/XSLDirectoryIterator.java \
b/java/src/org/apache/qetest/xsl/XSLDirectoryIterator.java index a930709..ebdcced \
100644
--- a/java/src/org/apache/qetest/xsl/XSLDirectoryIterator.java
+++ b/java/src/org/apache/qetest/xsl/XSLDirectoryIterator.java
@@ -240,12 +240,9 @@ public class XSLDirectoryIterator extends XSLProcessorTestBase
*/
public void logTestProps()
{
-
// Log out system/build info - use crit msg so it's always reported
reporter.logCriticalMsg(getDescription());
- reporter.logHashtable(reporter.CRITICALMSG, System.getProperties(),
- "System.getProperties");
- reporter.logHashtable(reporter.CRITICALMSG, testProps, "testProps");
+ super.logTestProps();
}
/**
@@ -261,8 +258,6 @@ public class XSLDirectoryIterator extends XSLProcessorTestBase
// inputDir, reporter, category, outDir, goldDir, noErrTest,
// plus each of the benchmarking variables:
// overallTime, overallFilesProcessed, dirTime, dirFilesProcessed
- // report out version info, properties, etc.
- logTestProps();
// Ensure the inputDir is there - we must have a valid location for input \
files File testDirectory = new File(inputDir);
diff --git a/java/src/org/apache/qetest/xsl/XSLProcessorTestBase.java \
b/java/src/org/apache/qetest/xsl/XSLProcessorTestBase.java index b4adbbe..166edf0 \
100644
--- a/java/src/org/apache/qetest/xsl/XSLProcessorTestBase.java
+++ b/java/src/org/apache/qetest/xsl/XSLProcessorTestBase.java
@@ -352,6 +352,31 @@ public class XSLProcessorTestBase extends FileBasedTest
return true;
}
+ /**
+ * Override mostly blank routine to dump environment info.
+ * <p>Log out information about our environment in a structured way.</p>
+ * @author Shane_Curcuru@lotus.com
+ * @param p unused
+ *
+ * @return true always
+ */
+ public boolean postTestFileInit(Properties p)
+ {
+ logTestProps();
+ return true;
+ }
+
+ /**
+ * Log out any version or system info.
+ * <p>Logs System.getProperties(), and our the testProps block.</p>
+ */
+ public void logTestProps()
+ {
+ reporter.logHashtable(reporter.CRITICALMSG, System.getProperties(),
+ "System.getProperties");
+ reporter.logHashtable(reporter.CRITICALMSG, testProps, "testProps");
+ }
+
// use other implementations from FileBasedTest
//-----------------------------------------------------
//-------- Initialize our common input params --------
diff --git a/results.dtd b/results.dtd
deleted file mode 100644
index 1c0997e..0000000
--- a/results.dtd
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- FileName: results.dtd -->
-<!-- Creator: shane_curcuru@lotus.com -->
-<!-- Description: Sample DTD for results currently produced with XMLFileLogger. -->
-<!-- Note this DTD is not meant to limit what we can put into
- results files, it just expresses what content most of the
- current Xalan tests report out currently.
- This DTD is currently just provided to show the intended
- structure of results files. -->
-
-<!-- ======================================================== -->
-<!-- Common attributes, expressed as entities -->
-
-<!-- The result of a fileresult, caseresult, or checkresult, i.e.
- if the test item passed, failed, etc.
- Constants match org.apache.qetest.Logger.PASS, FAIL, etc. -->
-<!ENTITY % result.attr
- "result (Pass | Fail | Incp | Ambg | Errr) #REQUIRED"
->
-
-<!-- Description or comment of the element -->
-<!ENTITY % desc.attr
- "desc CDATA #REQUIRED"
->
-
-<!-- loggingLevel of the element -->
-<!ENTITY % level.attr
- "level CDATA #REQUIRED"
->
-
-<!-- Time reported of the element: currently the exact format
- may change, so I'm only declaring it as CDATA -->
-<!ENTITY % time.attr
- "time CDATA #REQUIRED"
->
-
-
-<!-- ======================================================== -->
-<!-- Conceptually structural elements -->
-
-<!-- The top-level element: a resultsfile, which encapsulates a
- whole results document. Note that this is different for
- results created by the XSLTestHarness.
- Also note that I've allowed message, statistic, arbtrary,
- statistic and hashtable elements to appear at most levels,
- although by practice they should only appear in testfile
- or testcase elements. -->
-<!ELEMENT resultsfile (testfile+ | message* | arbitrary* | statistic* | hashtable* \
) >
-<!ATTLIST resultsfile
- logFile CDATA #REQUIRED
->
-
-<!-- A testfile, which is the whole set of results for a single
- test file's execution. From this level and below, the dtd
- is the same for individual tests and tests run in the harness. -->
-<!ELEMENT testfile (testcase+ | message* | arbitrary* | statistic* | hashtable* | \
fileresult?) >
-<!ATTLIST testfile
- %desc.attr;
- %time.attr;
- filename CDATA #REQUIRED
->
-
-<!-- A single testcase, which may not be nested. -->
-<!ELEMENT testcase (message* | arbitrary* | statistic* | hashtable* | checkresult* \
| fileref* | caseresult?) >
-<!ATTLIST testcase
- %desc.attr;
->
-
-<!-- ======================================================== -->
-<!-- Individual or smaller elements -->
-
-<!-- Hashtables and their items; cf. logHashtable() -->
-<!ELEMENT hashtable (hashitem*) >
-<!ATTLIST hashtable
- %desc.attr;
- %level.attr;
->
-
-<!ELEMENT hashitem (#PCDATA) >
-<!ATTLIST hashitem
- key CDATA #REQUIRED
->
-
-<!-- Normal messages; cf. logMsg() -->
-<!ELEMENT message (#PCDATA) >
-<!ATTLIST message
- %level.attr;
->
-
-<!-- Arbitrary messages; cf. logArbitraryMsg(), explicity put into CDATA -->
-<!ELEMENT arbitrary (#PCDATA) >
-<!ATTLIST arbitrary
- %level.attr;
->
-
-<!-- Statistic messages; cf. logStatistic() -->
-<!ELEMENT statistic (longval, doubleval) >
-<!ATTLIST statistic
- %desc.attr;
- %level.attr;
->
-<!ELEMENT longval (#PCDATA) >
-<!ELEMENT doubleval (#PCDATA) >
-
-<!-- Note fileref is not defined in XMLFileLogger, it comes
- from ConformanceTests calling logElement() in a specific way.
- Although logElement allows you to output nearly any sort
- of single element, there aren't any other uses of it in
- existing test cases. Feel free to suggest other ideas! -->
-<!ELEMENT fileref (#PCDATA) >
-<!-- Note that the idref attribute in fileref is *not* a 'legal'
- XML idref since they are not guaranteed to be unique (at least
- not by the framework) nor to refer to anything. -->
-<!ATTLIST fileref
- idref CDATA #IMPLIED
- outputName CDATA #IMPLIED
- inputName CDATA #IMPLIED
- xmlName CDATA #IMPLIED
- goldName CDATA #IMPLIED
->
-
-<!-- Test point results; cf. various check() methods -->
-<!ELEMENT checkresult EMPTY >
-<!-- Note the id attribute of checkresult is *not* a 'legal'
- XML id since they are not guaranteed to be unique. -->
-<!ATTLIST checkresult
- %desc.attr;
- %result.attr;
- id CDATA #IMPLIED
->
-
-<!-- Rolled-up results of a testfile; cf. testFileClose() -->
-<!ELEMENT fileresult EMPTY >
-<!ATTLIST fileresult
- %desc.attr;
- %result.attr;
- %time.attr;
->
-
-<!-- Rolled-up results of a testcase; cf. testCaseClose() -->
-<!ELEMENT caseresult EMPTY >
-<!ATTLIST caseresult
- %desc.attr;
- %result.attr;
->
-
-<!-- End of file ============================================ -->
\ No newline at end of file
diff --git a/tests/api-gold/trax/OutputPropertiesHTML.out \
b/tests/api-gold/trax/OutputPropertiesHTML.out new file mode 100644
index 0000000..ea164d0
--- /dev/null
+++ b/tests/api-gold/trax/OutputPropertiesHTML.out
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "this-is-doctype-public" "this-is-doctype-system">
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<TITLE>title-tag:text</TITLE>xsl:text within HEAD tag</HEAD>
+<BODY>
+<P>P-tag:beginCDATA? or not?</P>
+<UL>
+<ul-tag>
+
+<li-tag number="1">li-tag:one</li-tag>
+
+<li-tag value="two">li-tag:two</li-tag>
+
+</ul-tag>
+</UL><P>Fake 'p' element</P><P>@ ~ © È</P>
+</BODY>
+</HTML>
diff --git a/tests/api/trax/OutputPropertiesHTML.xml \
b/tests/api/trax/OutputPropertiesHTML.xml new file mode 100644
index 0000000..4985d62
--- /dev/null
+++ b/tests/api/trax/OutputPropertiesHTML.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html-tag>
+ <head-tag>
+ <title-tag text="title-tag:text"/>
+ </head-tag>
+ <body-tag>
+ <p-tag>P-tag:begin<cdataHere>CDATA? or not?</cdataHere></p-tag>
+ <ul-tag>
+ <li-tag number="1">li-tag:one</li-tag>
+ <li-tag value="two">li-tag:two</li-tag>
+ </ul-tag>
+ </body-tag>
+</html-tag>
diff --git a/tests/api/trax/OutputPropertiesHTML.xsl \
b/tests/api/trax/OutputPropertiesHTML.xsl new file mode 100644
index 0000000..d11bcf3
--- /dev/null
+++ b/tests/api/trax/OutputPropertiesHTML.xsl
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <!-- FileName: OutputPropertiesHTML.xsl -->
+ <!-- Purpose: Legal HTML output for use with OutputPropertiesTest.java -->
+
+<!-- Include various XSLT spec xsl:output attrs -->
+<xsl:output method="html"
+ version="123.45"
+ standalone="yes"
+ doctype-public="this-is-doctype-public"
+ doctype-system="this-is-doctype-system"
+ cdata-section-elements="cdataHere"
+ indent="yes"
+ media-type="text/test/xml"
+ omit-xml-declaration="yes" />
+
+<xsl:template match="/">
+ <HTML>
+ <xsl:apply-templates/>
+ </HTML>
+</xsl:template>
+
+<xsl:template match="html-tag">
+ <HEAD>
+ <xsl:element name="TITLE"><xsl:value-of \
select="head-tag/title-tag/@text"/></xsl:element> + <xsl:text>xsl:text within \
HEAD tag</xsl:text> + </HEAD>
+ <BODY>
+ <xsl:apply-templates select="body-tag"/>
+ <xsl:text disable-output-escaping="yes"><P>Fake 'p' element</P></xsl:text>
+ <!-- Some HTML elements below, just for fun -->
+ <P>@   ~ © È</P>
+ </BODY>
+</xsl:template>
+
+<xsl:template match="body-tag">
+ <xsl:apply-templates select="p-tag | ul-tag"/>
+</xsl:template>
+
+<xsl:template match="p-tag">
+ <xsl:element name="P">
+ <xsl:value-of select="."/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="ul-tag">
+ <UL>
+ <xsl:copy-of select="."/>
+ </UL>
+</xsl:template>
+</xsl:stylesheet>
diff --git a/tests/conf-gold/ver/ver05.out b/tests/conf-gold/ver/ver05.out
new file mode 100644
index 0000000..9b86aad
--- /dev/null
+++ b/tests/conf-gold/ver/ver05.out
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<out>xsl:choose when test="system-property('xsl:version') >= 1.1"<choose>Hey! 1.1 \
features are not supported!</choose></out> \ No newline at end of file
diff --git a/tests/conf-gold/ver/ver06.out b/tests/conf-gold/ver/ver06.out
new file mode 100644
index 0000000..8be6fa7
--- /dev/null
+++ b/tests/conf-gold/ver/ver06.out
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<out>xsl:choose when test="system-property('xsl:version') >= 1.2"<choose>Hey! 1.2 \
features are not supported!</choose></out> \ No newline at end of file
diff --git a/tests/conf-gold/ver/ver07.out b/tests/conf-gold/ver/ver07.out
new file mode 100644
index 0000000..7eee0ae
--- /dev/null
+++ b/tests/conf-gold/ver/ver07.out
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<out>xsl:choose when test="system-property('xsl:version') >= 2.0"<choose>Hey! 2.0 \
features are not supported!</choose></out> \ No newline at end of file
diff --git a/tests/conf/ver/ver05.xml b/tests/conf/ver/ver05.xml
new file mode 100644
index 0000000..f6fba93
--- /dev/null
+++ b/tests/conf/ver/ver05.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<doc>
+</doc>
\ No newline at end of file
diff --git a/tests/conf/ver/ver05.xsl b/tests/conf/ver/ver05.xsl
new file mode 100644
index 0000000..2f43468
--- /dev/null
+++ b/tests/conf/ver/ver05.xsl
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.1">
+
+ <!-- FileName: Ver05 -->
+ <!-- Document: http://www.w3.org/TR/xslt -->
+ <!-- DocVersion: 19991116 -->
+ <!-- Section: 2.5 Forwards-Compatible Processing -->
+ <!-- Creator: Shane Curcuru -->
+ <!-- Purpose: Test the basics of the XSLT version declaration. Should not raise an \
error. --> + <!-- Note that this test obviously needs updating as soon as we support \
XSLT 1.1! --> +
+ <xsl:template match="/">
+ <out>
+ <xsl:text>xsl:choose when test="system-property('xsl:version') >= \
1.1"</xsl:text> + <choose>
+ <xsl:choose>
+ <xsl:when test="system-property('xsl:version') >= 1.1">
+ <xsl:text>Hey! Call the 1.1 feature!</xsl:text>
+ <xsl:exciting-new-1.1-feature/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Hey! 1.1 features are not supported!</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </choose>
+ </out>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tests/conf/ver/ver06.xml b/tests/conf/ver/ver06.xml
new file mode 100644
index 0000000..f6fba93
--- /dev/null
+++ b/tests/conf/ver/ver06.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<doc>
+</doc>
\ No newline at end of file
diff --git a/tests/conf/ver/ver06.xsl b/tests/conf/ver/ver06.xsl
new file mode 100644
index 0000000..85bc3eb
--- /dev/null
+++ b/tests/conf/ver/ver06.xsl
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.2">
+
+ <!-- FileName: Ver06 -->
+ <!-- Document: http://www.w3.org/TR/xslt -->
+ <!-- DocVersion: 19991116 -->
+ <!-- Section: 2.5 Forwards-Compatible Processing -->
+ <!-- Creator: Shane Curcuru -->
+ <!-- Purpose: Test the basics of the XSLT version declaration. Should not raise an \
error. --> + <!-- Note that this test obviously needs updating as soon as we support \
XSLT 1.2! --> +
+ <xsl:template match="/">
+ <out>
+ <xsl:text>xsl:choose when test="system-property('xsl:version') >= \
1.2"</xsl:text> + <choose>
+ <xsl:choose>
+ <xsl:when test="system-property('xsl:version') >= 1.2">
+ <xsl:text>Hey! Call the 1.2 feature!</xsl:text>
+ <xsl:exciting-new-1.2-feature/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Hey! 1.2 features are not supported!</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </choose>
+ </out>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tests/conf/ver/ver07.xml b/tests/conf/ver/ver07.xml
new file mode 100644
index 0000000..f6fba93
--- /dev/null
+++ b/tests/conf/ver/ver07.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<doc>
+</doc>
\ No newline at end of file
diff --git a/tests/conf/ver/ver07.xsl b/tests/conf/ver/ver07.xsl
new file mode 100644
index 0000000..36474e8
--- /dev/null
+++ b/tests/conf/ver/ver07.xsl
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="2.0">
+
+ <!-- FileName: Ver07 -->
+ <!-- Document: http://www.w3.org/TR/xslt -->
+ <!-- DocVersion: 19991116 -->
+ <!-- Section: 2.5 Forwards-Compatible Processing -->
+ <!-- Creator: Shane Curcuru -->
+ <!-- Purpose: Test the basics of the XSLT version declaration. Should not raise an \
error. --> + <!-- Note that this test obviously needs updating as soon as we support \
XSLT 2.0! --> +
+ <xsl:template match="/">
+ <out>
+ <xsl:text>xsl:choose when test="system-property('xsl:version') >= \
2.0"</xsl:text> + <choose>
+ <xsl:choose>
+ <xsl:when test="system-property('xsl:version') >= 2.0">
+ <xsl:text>Hey! Call the 2.0 feature!</xsl:text>
+ <xsl:exciting-new-2.0-feature/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Hey! 2.0 features are not supported!</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </choose>
+ </out>
+ </xsl:template>
+
+</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic