You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by gg...@apache.org on 2019/04/22 01:37:10 UTC
[xalan-test] 01/01: This commit was manufactured by cvs2svn to
create tag 'xalan-j_2_1_0'.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to annotated tag xalan-j_2_1_0
in repository https://gitbox.apache.org/repos/asf/xalan-test.git
commit 5bd398966992419e94298ce71503fcee24053578
Author: No Author <de...@apache.org>
AuthorDate: Tue May 22 16:07:04 2001 +0000
This commit was manufactured by cvs2svn to create tag
'xalan-j_2_1_0'.
---
.../org/apache/qetest/trax/ErrorListenerTest.java | 84 +----
.../qetest/xalanj2/LoggingTraceListener.java | 389 ---------------------
.../apache/qetest/xalanj2/TraceListenerTest.java | 220 ------------
.../src/org/apache/qetest/xalanj2/XalanDumper.java | 320 -----------------
tests/api/xalanj2/TraceListenerTest.xml | 10 -
tests/api/xalanj2/TraceListenerTest.xsl | 26 --
6 files changed, 6 insertions(+), 1043 deletions(-)
diff --git a/java/src/org/apache/qetest/trax/ErrorListenerTest.java b/java/src/org/apache/qetest/trax/ErrorListenerTest.java
index c8ab85e..9fd45d0 100644
--- a/java/src/org/apache/qetest/trax/ErrorListenerTest.java
+++ b/java/src/org/apache/qetest/trax/ErrorListenerTest.java
@@ -98,6 +98,9 @@ public class ErrorListenerTest extends XSLProcessorTestBase
/** Provide sequential output names automatically. */
protected OutputNameManager outNames;
+ /** FilenameFilter that lists appropriate tests in api/err directory to use. */
+ protected FilenameFilter errorFileFilter = null;
+
/**
* A simple stylesheet with errors for testing in various flavors.
* Must be coordinated with templatesExpectedType/Value,
@@ -105,11 +108,6 @@ public class ErrorListenerTest extends XSLProcessorTestBase
*/
protected XSLTestfileInfo testFileInfo = new XSLTestfileInfo();
- /**
- * A simple stylesheet without errors in it.
- */
- protected XSLTestfileInfo goodFileInfo = new XSLTestfileInfo();
-
/** Expected type of error during stylesheet build. */
protected int templatesExpectedType = 0;
@@ -131,7 +129,7 @@ public class ErrorListenerTest extends XSLProcessorTestBase
/** Just initialize test name, comment, numTestCases. */
public ErrorListenerTest()
{
- numTestCases = 4; // REPLACE_num
+ numTestCases = 3; // REPLACE_num
testName = "ErrorListenerTest";
testComment = "Verify that ErrorListeners are called properly from Transformers.";
}
@@ -153,6 +151,8 @@ public class ErrorListenerTest extends XSLProcessorTestBase
outNames = new OutputNameManager(outputDir + File.separator + ERR_SUBDIR
+ File.separator + testName, ".out");
+ errorFileFilter = new ConformanceErrFileRules(API_PARENTDIR);
+
String testBasePath = inputDir
+ File.separator
+ ERR_SUBDIR
@@ -162,13 +162,6 @@ public class ErrorListenerTest extends XSLProcessorTestBase
+ ERR_SUBDIR
+ File.separator;
- goodFileInfo.inputName = inputDir + File.separator
- + "trax" + File.separator + "identity.xsl";
- goodFileInfo.xmlName = inputDir + File.separator
- + "trax" + File.separator + "identity.xml";
- goodFileInfo.goldName = goldDir + File.separator
- + "trax" + File.separator + "identity.out";
-
testFileInfo.inputName = testBasePath + "ErrorListenerTest.xsl";
testFileInfo.xmlName = testBasePath + "ErrorListenerTest.xml";
testFileInfo.goldName = goldBasePath + "ErrorListenerTest.out";
@@ -435,71 +428,6 @@ public class ErrorListenerTest extends XSLProcessorTestBase
return true;
}
-
- /**
- * Miscellaneous other ErrorListener tests.
- * Includes Bugzilla1266.
- * Primarily using StreamSources.
- * @return false if we should abort the test; true otherwise
- */
- public boolean testCase4()
- {
- reporter.testCaseInit("Miscellaneous other ErrorListener tests");
- LoggingErrorListener loggingErrorListener = new LoggingErrorListener(reporter);
- loggingErrorListener.setThrowWhen(LoggingErrorListener.THROW_NEVER);
- reporter.logTraceMsg("loggingErrorListener originally setup:" + loggingErrorListener.getQuickCounters());
-
- TransformerFactory factory = null;
- Templates templates = null;
- Transformer transformer = null;
- try
- {
- factory = TransformerFactory.newInstance();
- reporter.logInfoMsg("About to factory.newTemplates(" + QetestUtils.filenameToURL(goodFileInfo.inputName) + ")");
- templates = factory.newTemplates(new StreamSource(QetestUtils.filenameToURL(goodFileInfo.inputName)));
- transformer = templates.newTransformer();
-
- // Set the errorListener and validate it
- transformer.setErrorListener(loggingErrorListener);
- reporter.check((transformer.getErrorListener() == loggingErrorListener),
- true, "set/getErrorListener on transformer");
-
- reporter.logStatusMsg("Reproduce Bugzilla1266 - warning due to bad output props not propagated");
- reporter.logStatusMsg("transformer.setOutputProperty(encoding, illegal-encoding-value)");
- transformer.setOutputProperty("encoding", "illegal-encoding-value");
-
- reporter.logTraceMsg("about to transform(...)");
- transformer.transform(new StreamSource(QetestUtils.filenameToURL(goodFileInfo.xmlName)),
- new StreamResult(outNames.nextName()));
- reporter.logTraceMsg("after transform(...)");
- reporter.logStatusMsg("loggingErrorListener after transform:" + loggingErrorListener.getQuickCounters());
-
- // Validate that one warning (about illegal-encoding-value) should have been reported
- int[] errCtr = loggingErrorListener.getCounters();
- reporter.check((errCtr[LoggingErrorListener.TYPE_WARNING] > 0), true, "At least one Warning listned to for illegal-encoding-value");
-
- // Validate the actual output file as well: in this case,
- // the stylesheet should still work
- if (Logger.PASS_RESULT
- != fileChecker.check(reporter,
- new File(outNames.currentName()),
- new File(goodFileInfo.goldName),
- "transform of good xsl w/bad output props into: " + outNames.currentName())
- )
- reporter.logInfoMsg("transform of error xsl failure reason:" + fileChecker.getExtendedInfo());
-
- }
- catch (Throwable t)
- {
- reporter.checkFail("errorListener4 unexpectedly threw: " + t.toString());
- reporter.logThrowable(Logger.ERRORMSG, t, "errorListener4 unexpectedly threw");
- }
-
- reporter.testCaseClose();
- return true;
- }
-
-
/**
* Convenience method to print out usage information - update if needed.
* @return String denoting usage of this test class
diff --git a/java/src/org/apache/qetest/xalanj2/LoggingTraceListener.java b/java/src/org/apache/qetest/xalanj2/LoggingTraceListener.java
deleted file mode 100644
index 02cc712..0000000
--- a/java/src/org/apache/qetest/xalanj2/LoggingTraceListener.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * 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/>.
- */
-
-/*
- *
- * LoggingTraceListener.java
- *
- */
-package org.apache.qetest.xalanj2;
-import org.apache.qetest.*;
-
-import java.io.IOException;
-import org.w3c.dom.Node;
-import org.w3c.dom.traversal.NodeIterator;
-
-import org.apache.xalan.trace.TraceListener;
-import org.apache.xalan.trace.GenerateEvent;
-import org.apache.xalan.trace.SelectionEvent;
-import org.apache.xalan.trace.TracerEvent;
-import org.apache.xalan.templates.ElemTemplate;
-import org.apache.xalan.templates.ElemTemplateElement;
-import org.apache.xalan.templates.ElemTextLiteral;
-import org.apache.xalan.templates.Constants;
-import org.apache.xpath.axes.ContextNodeList;
-import org.apache.xml.utils.QName;
-import org.apache.xpath.XPath;
-
-/**
- * Logging TraceListener interface.
- * Implementation of the TraceListener interface that
- * prints each event to our logger as it occurs.
- * Future improvements: allow you to specify a set of
- * expected events to validate.
- * @author shane_curcuru@lotus.com
- * @version $Id$
- */
-public class LoggingTraceListener extends LoggingHandler
- implements TraceListener
-{
-
- /**
- * Accesor method for a brief description of this service.
- * @return String "LoggingTraceListener: logs and counts trace events"
- */
- public String getDescription()
- {
- return "LoggingTraceListener: logs and counts trace events";
- }
-
-
- /** No-op sets logger to default. */
- public LoggingTraceListener()
- {
- setLogger(getDefaultLogger());
- }
-
- /**
- * Ctor that calls setLogger automatically.
- *
- * @param r Logger we should log to
- */
- public LoggingTraceListener(Logger l)
- {
- setLogger(l);
- }
-
-
- /**
- * Set a default handler for us to wrapper - no-op.
- * Since you can add multiple TraceListeners, there's no sense
- * in us wrappering another one.
- * @param default Object unused
- */
- public void setDefaultHandler(Object noop)
- {
- /* no-op */
- }
-
-
- /**
- * Accessor method for our default handler - no-op.
- * @return null
- */
- public Object getDefaultHandler()
- {
- return null;
- }
-
-
- /** Prefixed to all logger msg output for TraceListener. */
- public final String prefix = "LTL:";
-
-
- /** Cheap-o string representation of last event we got. */
- protected String lastItem = NOTHING_HANDLED;
-
-
- /**
- * Accessor for string representation of last trace event.
- * @param s string to set
- */
- protected void setLastItem(String s)
- {
- lastItem = s;
- }
-
-
- /**
- * Accessor for string representation of last trace event.
- * @return last event string we had
- */
- public String getLast()
- {
- return lastItem;
- }
-
-
- /** Constant for getCounters()[]: trace events. */
- public static final int TYPE_TRACE = 0;
-
- /** Constant for getCounters()[]: generated events. */
- public static final int TYPE_GENERATED = 1;
-
- /** Constant for getCounters()[]: selected events. */
- public static final int TYPE_SELECTED = 2;
-
- /**
- * Counters for how many events we've handled.
- * Index into array are the TYPE_* constants.
- */
- protected int[] counters =
- {
- 0, /* trace */
- 0, /* generated */
- 0 /* selected */
- };
-
-
- /**
- * Get a list of counters of all items we've logged.
- * Returned as trace, generated, selected
- * Index into array are the TYPE_* constants.
- *
- * @return array of int counters for each item we log
- */
- public int[] getCounters()
- {
- return counters;
- }
-
- /**
- * Reset all items or counters we've handled.
- */
- public void reset()
- {
- setLastItem(NOTHING_HANDLED);
- for (int i = 0; i < counters.length; i++)
- {
- counters[i] = 0;
- }
- }
-
- /** setExpected, etc. not yet implemented. */
-
- ////////////////// Implement TraceListener //////////////////
- /**
- * Logging implementation of TraceListener method.
- * Method that is called when a trace event occurs.
- * The method is blocking. It must return before processing continues.
- *
- * @param tracerEvent the trace event.
- */
- public void trace(TracerEvent tracerEvent)
- {
- counters[TYPE_TRACE]++;
-
- StringBuffer buf = new StringBuffer("trace:");
- int dumpLevel = XalanDumper.DUMP_DEFAULT;
- if (null != tracerEvent.m_mode) // not terribly elegant way to do it
- dumpLevel = XalanDumper.DUMP_NOCLOSE;
- switch (tracerEvent.m_styleNode.getXSLToken())
- {
- // Specific handling for most common 'interesting' items
- case Constants.ELEMNAME_TEXTLITERALRESULT :
- buf.append(XalanDumper.dump((ElemTextLiteral) tracerEvent.m_styleNode, dumpLevel));
- break;
-
- case Constants.ELEMNAME_TEMPLATE :
- buf.append(XalanDumper.dump((ElemTemplate) tracerEvent.m_styleNode, dumpLevel));
- break;
-
- default :
- buf.append(XalanDumper.dump((ElemTemplateElement) tracerEvent.m_styleNode, dumpLevel));
- }
- if (null != tracerEvent.m_mode)
- buf.append(XalanDumper.SEP + "m_mode=" + tracerEvent.m_mode + XalanDumper.RBRACKET);
-
- setLastItem(buf.toString());
- logger.logMsg(level, prefix + getLast());
- }
-
- /**
- * Logging implementation of TraceListener method.
- * Method that is called just after the formatter listener is called.
- *
- * @param selectionEvent the selected event.
- * @throws javax.xml.transform.TransformerException never thrown
- */
- public void selected(SelectionEvent selectionEvent)
- throws javax.xml.transform.TransformerException
- {
- counters[TYPE_SELECTED]++;
-
- StringBuffer buf = new StringBuffer("selected:");
- ElemTemplateElement styleNodeElem = (ElemTemplateElement) selectionEvent.m_styleNode;
- ElemTemplateElement parent = (ElemTemplateElement) styleNodeElem.getParentNode();
- if (parent == styleNodeElem.getStylesheetRoot().getDefaultRootRule())
- {
- buf.append("[default-root-rule]");
- }
- else if (parent == styleNodeElem.getStylesheetRoot().getDefaultTextRule())
- {
- buf.append("[default-text-rule]");
- }
- else if (parent == styleNodeElem.getStylesheetRoot().getDefaultRule())
- {
- buf.append("[default-rule]");
- }
- else
- buf.append(XalanDumper.dump(styleNodeElem, XalanDumper.DUMP_NOCLOSE));
-
- buf.append(selectionEvent.m_attributeName + "="
- + selectionEvent.m_xpath.getPatternString() + ";");
-
- if (selectionEvent.m_selection.getType() == selectionEvent.m_selection.CLASS_NODESET)
- {
- NodeIterator nl = selectionEvent.m_selection.nodeset();
- if (nl instanceof ContextNodeList)
- {
- try
- {
- nl = ((ContextNodeList)nl).cloneWithReset();
- }
- catch(CloneNotSupportedException cnse)
- {
- buf.append("[Can't trace nodelist, threw: CloneNotSupportedException]");
- }
- Node pos = nl.nextNode();
-
- if (null == pos)
- {
- buf.append("[empty node list]");
- }
- else // (null == pos)
- {
- while (null != pos)
- {
- buf.append(" " + pos);
- pos = nl.nextNode();
- }
- }
- }
- else // (nl instanceof ContextNodeList)
- {
- buf.append("[Can't trace nodelist: it isn't a ContextNodeList]");
- }
- }
- else // (selectionEvent.m_selection.getType() == selectionEvent.m_selection.CLASS_NODESET)
- {
- buf.append("[" + selectionEvent.m_selection.str() +"]");
- }
- buf.append(XalanDumper.RBRACKET); // Since we said DUMP_NOCLOSE above
- setLastItem(buf.toString());
- logger.logMsg(level, prefix + getLast());
- }
-
- /**
- * Logging implementation of TraceListener method.
- * Method that is called just after the formatter listener is called.
- *
- * @param generateEvent the generate event.
- */
- public void generated(GenerateEvent generateEvent)
- {
- counters[TYPE_GENERATED]++;
-
- StringBuffer buf = new StringBuffer("generated:");
- switch (generateEvent.m_eventtype)
- {
- case GenerateEvent.EVENTTYPE_STARTDOCUMENT :
- buf.append("STARTDOCUMENT");
- break;
-
- case GenerateEvent.EVENTTYPE_ENDDOCUMENT :
- buf.append("ENDDOCUMENT");
- break;
-
- case GenerateEvent.EVENTTYPE_STARTELEMENT :
- buf.append("STARTELEMENT[" + generateEvent.m_name + "]"); // just hardcode [ LBRACKET ] RBRACKET here
- break;
-
- case GenerateEvent.EVENTTYPE_ENDELEMENT :
- buf.append("ENDELEMENT[" + generateEvent.m_name + "]");
- break;
-
- case GenerateEvent.EVENTTYPE_CHARACTERS :
- String chars1 = new String(generateEvent.m_characters, generateEvent.m_start, generateEvent.m_length);
- buf.append("CHARACTERS[" + chars1 + "]");
- break;
-
- case GenerateEvent.EVENTTYPE_CDATA :
- String chars2 = new String(generateEvent.m_characters, generateEvent.m_start, generateEvent.m_length);
- buf.append("CDATA[" + chars2 + "]");
- break;
-
- case GenerateEvent.EVENTTYPE_COMMENT :
- buf.append("COMMENT[" + generateEvent.m_data + "]");
- break;
-
- case GenerateEvent.EVENTTYPE_PI :
- buf.append("PI[" + generateEvent.m_name + ", " + generateEvent.m_data + "]");
- break;
-
- case GenerateEvent.EVENTTYPE_ENTITYREF :
- buf.append("ENTITYREF[" + generateEvent.m_name + "]");
- break;
-
- case GenerateEvent.EVENTTYPE_IGNORABLEWHITESPACE :
- buf.append("IGNORABLEWHITESPACE");
- break;
- }
- setLastItem(buf.toString());
- logger.logMsg(level, prefix + getLast());
- }
-}
diff --git a/java/src/org/apache/qetest/xalanj2/TraceListenerTest.java b/java/src/org/apache/qetest/xalanj2/TraceListenerTest.java
deleted file mode 100644
index 6e5b3d0..0000000
--- a/java/src/org/apache/qetest/xalanj2/TraceListenerTest.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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/>.
- */
-
-/*
- *
- * TraceListenerTest.java
- *
- */
-package org.apache.qetest.xalanj2;
-
-// Support for test reporting and harness classes
-import org.apache.qetest.*;
-import org.apache.qetest.xsl.*;
-import org.apache.qetest.trax.LoggingErrorListener;
-
-// Import all relevant TRAX packages
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-import javax.xml.transform.sax.*;
-import javax.xml.transform.stream.*;
-import org.apache.xalan.trace.TraceListener;
-import org.apache.xalan.trace.TraceManager;
-import org.apache.xalan.transformer.TransformerImpl;
-
-// Needed SAX, DOM, JAXP classes
-
-// java classes
-import java.io.File;
-import java.util.Properties;
-
-//-------------------------------------------------------------------------
-
-/**
- * Basic functionality testing of TraceListener interface and etc.
- * @author shane_curcuru@lotus.com
- * @version $Id$
- */
-public class TraceListenerTest extends XSLProcessorTestBase
-{
-
- /** Provides nextName(), currentName() functionality. */
- protected OutputNameManager outNames;
-
- /** Simple test to do tracing on. */
- protected XSLTestfileInfo testFileInfo = new XSLTestfileInfo();
-
-
- /** Subdirectory under test\tests\api for our xsl/xml files. */
- public static final String X2J_SUBDIR = "xalanj2";
-
-
- /** Just initialize test name, comment, numTestCases. */
- public TraceListenerTest()
- {
- numTestCases = 1; // REPLACE_num
- testName = "TraceListenerTest";
- testComment = "Basic functionality testing of TraceListener interface and etc";
- }
-
-
- /**
- * Initialize this test - Set names of xml/xsl test files,
- * REPLACE_other_test_file_init.
- *
- * @param p Properties to initialize from (if needed)
- * @return false if we should abort the test; true otherwise
- */
- public boolean doTestFileInit(Properties p)
- {
- // NOTE: 'reporter' variable is already initialized at this point
-
- // Used for all tests; just dump files in trax subdir
- File outSubDir = new File(outputDir + File.separator + X2J_SUBDIR);
- if (!outSubDir.mkdirs())
- reporter.logWarningMsg("Could not create output dir: " + outSubDir);
- // Initialize an output name manager to that dir with .out extension
- outNames = new OutputNameManager(outputDir + File.separator + X2J_SUBDIR
- + File.separator + testName, ".out");
-
- String testBasePath = inputDir
- + File.separator
- + X2J_SUBDIR
- + File.separator;
- String goldBasePath = goldDir
- + File.separator
- + X2J_SUBDIR
- + File.separator;
-
- // NOTE: validation is tied to details within this file!
- testFileInfo.inputName = testBasePath + "TraceListenerTest.xsl";
- testFileInfo.xmlName = testBasePath + "TraceListenerTest.xml";
- testFileInfo.goldName = goldBasePath + "TraceListenerTest.out";
-
- return true;
- }
-
-
- /**
- * Quick smoketest of TraceListener.
- *
- * @return false if we should abort the test; true otherwise
- */
- public boolean testCase1()
- {
- reporter.testCaseInit("Quick smoketest of TraceListener");
- reporter.logWarningMsg("Note: limited validation: partly just a crash test so far.");
-
- try
- {
- TransformerFactory factory = TransformerFactory.newInstance();
- Transformer transformer = factory.newTransformer(new StreamSource(QetestUtils.filenameToURL(testFileInfo.inputName)));
-
- reporter.logInfoMsg("Transformer created, addTraceListener...");
- LoggingTraceListener ltl = new LoggingTraceListener(reporter);
- TraceManager traceManager = ((TransformerImpl)transformer).getTraceManager();
- reporter.check((null != traceManager), true, "getTraceManager is non-null");
- reporter.logStatusMsg("traceManager.hasTraceListeners() is: " + traceManager.hasTraceListeners());
- traceManager.addTraceListener((TraceListener)ltl);
- reporter.check(traceManager.hasTraceListeners(), true, "traceManager.hasTraceListeners() true after adding one");
-
- reporter.logInfoMsg("About to create output: " + outNames.nextName());
- transformer.transform(new StreamSource(QetestUtils.filenameToURL(testFileInfo.xmlName)),
- new StreamResult(outNames.currentName()));
- reporter.checkPass("Crash test only: returned from transform() call");
- int[] tracedEvents = ltl.getCounters();
- reporter.logStatusMsg("Last event traced:" + ltl.getLast());
- reporter.logStatusMsg("Events traced:" + tracedEvents[LoggingTraceListener.TYPE_TRACE]
- + " events generated:" + tracedEvents[LoggingTraceListener.TYPE_GENERATED]
- + " events selected:" + tracedEvents[LoggingTraceListener.TYPE_SELECTED]);
- reporter.check(tracedEvents[LoggingTraceListener.TYPE_SELECTED], 3,
- "Correct number of selected events for testfile " + testFileInfo.inputName);
- reporter.logStatusMsg("//@todo add more validation of trace events");
- }
- catch (Throwable t)
- {
- reporter.checkFail("testCase1a threw: " + t.toString());
- reporter.logThrowable(Logger.ERRORMSG, t, "testCase1a threw: ");
- }
-
- reporter.testCaseClose();
- return true;
- }
-
-
- /**
- * 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 TraceListenerTest:\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)
- {
- TraceListenerTest app = new TraceListenerTest();
- app.doMain(args);
- }
-}
diff --git a/java/src/org/apache/qetest/xalanj2/XalanDumper.java b/java/src/org/apache/qetest/xalanj2/XalanDumper.java
deleted file mode 100644
index aac122c..0000000
--- a/java/src/org/apache/qetest/xalanj2/XalanDumper.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * 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/>.
- */
-
-package org.apache.qetest.xalanj2;
-import org.apache.qetest.*;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import org.apache.xalan.trace.GenerateEvent;
-import org.apache.xalan.trace.SelectionEvent;
-import org.apache.xalan.trace.TracerEvent;
-import org.apache.xalan.templates.ElemTemplate;
-import org.apache.xalan.templates.ElemTemplateElement;
-import org.apache.xalan.templates.ElemTextLiteral;
-import org.apache.xalan.templates.ElemLiteralResult;
-import org.apache.xalan.templates.Constants;
-import org.apache.xml.utils.QName;
-import org.apache.xpath.XPath;
-
-import java.lang.reflect.Method;
-/**
- * Static utility for dumping info about common Xalan objects.
- * Cheap-o string representations of some common properties
- * of various objects; supports some formatting and encapsulation
- * but could use improvements.
- * Note: currently purposefully outputs plain strings, not
- * any XML-like elements, so it's easier for other XML-like
- * logging utilities to output our data without escaping, etc.
- *
- * @author shane_curcuru@lotus.com
- * @version $Id$
- */
-public abstract class XalanDumper
-{
- // abstract class cannot be instantiated
-
- /** Simple text constants: for items that are null. */
- public static final String NULL = "NULL";
- /** Simple text constants: separator between items. */
- public static final String SEP = ";";
- /** Simple text constants: beginning a block of items. */
- public static final String LBRACKET = "[";
- /** Simple text constants: ending a block of items. */
- public static final String RBRACKET = "]";
- /** Simple text constants: line number. */
- public static final String LNUM = "L";
- /** Simple text constants: column number. */
- public static final String CNUM = "C";
-
- /** Simple output formats: default behavior. */
- public static final int DUMP_DEFAULT = 0;
- /** Simple output formats: verbose: extra output. */
- public static final int DUMP_VERBOSE = 1;
- /** Simple output formats: a contained object. */
- public static final int DUMP_CONTAINED = 2;
- /** Simple output formats: don't close block. */
- public static final int DUMP_NOCLOSE = 3;
-
-
- /**
- * Return String describing an ElemTemplateElement.
- *
- * @param elem the ElemTemplateElement to print info of
- * @param dumpLevel what format/how much to dump
- */
- public static String dump(ElemTemplateElement elem, int dumpLevel)
- {
- StringBuffer buf = new StringBuffer("ElemTemplateElement" + LBRACKET);
- if (null == elem)
- return buf.toString() + NULL + RBRACKET;
-
- // Note for user if it's an LRE or an xsl element
- if(elem instanceof ElemLiteralResult)
- buf.append("LRE:");
- else
- buf.append("xsl:");
-
- buf.append(elem.getNodeName());
- buf.append(SEP + LNUM + elem.getLineNumber());
- buf.append(SEP + CNUM + elem.getColumnNumber());
- buf.append(SEP + "getLength=" + elem.getLength());
- if (DUMP_VERBOSE == (dumpLevel & DUMP_VERBOSE))
- {
- // Only include systemIds (which are long) if verbose
- buf.append(SEP + "getSystemId=" + elem.getSystemId());
- buf.append(SEP + "getStylesheet=" + elem.getStylesheet().getSystemId());
- }
- try
- {
- Class cl = ((Object)elem).getClass();
- Method getSelect = cl.getMethod("getSelect", null);
- if(null != getSelect)
- {
- buf.append(SEP + "select=");
- XPath xpath = (XPath)getSelect.invoke(elem, null);
- buf.append(xpath.getPatternString());
- }
- }
- catch(Exception e)
- {
- // no-op: just don't put in the select info for these items
- }
- if (DUMP_NOCLOSE == (dumpLevel & DUMP_NOCLOSE))
- return buf.toString();
- else
- return buf.toString() + RBRACKET;
- }
-
-
- /**
- * Return String describing an ElemTextLiteral.
- *
- * @param elem the ElemTextLiteral to print info of
- * @param dumpLevel what format/how much to dump
- */
- public static String dump(ElemTextLiteral elem, int dumpLevel)
- {
- StringBuffer buf = new StringBuffer("ElemTextLiteral" + LBRACKET);
- if (null == elem)
- return buf.toString() + NULL + RBRACKET;
-
- buf.append(elem.getNodeName()); // I don't think this ever changes from #Text?
- buf.append(SEP + LNUM + elem.getLineNumber());
- buf.append(SEP + CNUM + elem.getColumnNumber());
-
- String chars = new String(elem.getChars(), 0, elem.getChars().length);
- buf.append(SEP + "chars=" + chars.trim());
-
- if (DUMP_NOCLOSE == (dumpLevel & DUMP_NOCLOSE))
- return buf.toString();
- else
- return buf.toString() + RBRACKET;
- }
-
- /**
- * Return String describing an ElemTemplate.
- *
- * @param elem the ElemTemplate to print info of
- * @param dumpLevel what format/how much to dump
- */
- public static String dump(ElemTemplate elem, int dumpLevel)
- {
- StringBuffer buf = new StringBuffer("ElemTemplate" + LBRACKET);
- if (null == elem)
- return buf.toString() + NULL + RBRACKET;
-
- buf.append("xsl:" + elem.getNodeName());
- buf.append(SEP + LNUM + elem.getLineNumber());
- buf.append(SEP + CNUM + elem.getColumnNumber());
- if (DUMP_VERBOSE == (dumpLevel & DUMP_VERBOSE))
- {
- // Only include systemIds (which are long) if verbose
- buf.append(SEP + "getSystemId=" + elem.getSystemId());
- buf.append(SEP + "getStylesheet=" + elem.getStylesheet().getSystemId());
- }
- try
- {
- Class cl = ((Object)elem).getClass();
- Method getSelect = cl.getMethod("getSelect", null);
- if(null != getSelect)
- {
- buf.append(SEP + "select=");
- XPath xpath = (XPath)getSelect.invoke(elem, null);
- buf.append(xpath.getPatternString());
- }
- }
- catch(Exception e)
- {
- // no-op: just don't put in the select info for these items
- }
- if (null != elem.getMatch())
- buf.append(SEP + "match=" + elem.getMatch().getPatternString());
-
- if (null != elem.getName())
- buf.append(SEP + "name=" + elem.getName());
-
- if (null != elem.getMode())
- buf.append(SEP + "mode=" + elem.getMode());
-
- buf.append(SEP + "priority=" + elem.getPriority());
-
- if (DUMP_NOCLOSE == (dumpLevel & DUMP_NOCLOSE))
- return buf.toString();
- else
- return buf.toString() + RBRACKET;
- }
-
-
- /**
- * Return String describing a Node.
- * Currently just returns TracerEvent.printNode(n)
- *
- * @param n the Node to print info of
- * @param dumpLevel what format/how much to dump
- */
- public static String dump(Node n, int dumpLevel)
- {
- if (null == n)
- return "Node" + LBRACKET + NULL + RBRACKET;
- return "Node" + LBRACKET
- + org.apache.xalan.trace.TracerEvent.printNode(n) + RBRACKET;
- }
-
- /**
- * Return String describing a NodeList.
- * Currently just returns TracerEvent.printNode(n)
- *
- * @param nl the NodeList to print info of
- * @param dumpLevel what format/how much to dump
- */
- public static String dump(NodeList nl, int dumpLevel)
- {
- if (null == nl)
- return NULL + SEP + "NodeList";
- return "NodeList" + LBRACKET
- + org.apache.xalan.trace.TracerEvent.printNodeList(nl) + RBRACKET;
- }
-
- /**
- * Print String type of node.
- * @param n Node to report type of
- * @return String type name
- */
- public static String dumpNodeType(Node n)
- {
- if (null == n)
- return NULL;
- switch (n.getNodeType())
- {
- case Node.DOCUMENT_NODE :
- return "DOCUMENT_NODE";
-
- case Node.ELEMENT_NODE :
- return "ELEMENT_NODE";
-
- case Node.CDATA_SECTION_NODE :
- return "CDATA_SECTION_NODE";
-
- case Node.ENTITY_REFERENCE_NODE :
- return "ENTITY_REFERENCE_NODE";
-
- case Node.ATTRIBUTE_NODE :
- return "ATTRIBUTE_NODE";
-
- case Node.COMMENT_NODE :
- return "COMMENT_NODE";
-
- case Node.ENTITY_NODE :
- return "ENTITY_NODE";
-
- case Node.NOTATION_NODE :
- return "NOTATION_NODE";
-
- case Node.PROCESSING_INSTRUCTION_NODE :
- return "PROCESSING_INSTRUCTION_NODE";
-
- case Node.TEXT_NODE :
- return "TEXT_NODE";
-
- default :
- return "UNKNOWN_NODE";
- }
- } // end of dumpNodeType()
-
-}
diff --git a/tests/api/xalanj2/TraceListenerTest.xml b/tests/api/xalanj2/TraceListenerTest.xml
deleted file mode 100644
index ac35672..0000000
--- a/tests/api/xalanj2/TraceListenerTest.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<list>
- <item>Xalan-J 1.x</item>
- <item>Xalan-J 2.x</item>
- <item>Xalan-C 1.x</item>
- <list>
- <item>Xalan documentation</item>
- <item>Xalan tests</item>
- </list>
-</list>
\ No newline at end of file
diff --git a/tests/api/xalanj2/TraceListenerTest.xsl b/tests/api/xalanj2/TraceListenerTest.xsl
deleted file mode 100644
index d482ba6..0000000
--- a/tests/api/xalanj2/TraceListenerTest.xsl
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:template match="/">
- <doc>
- <mode-none>
- <xsl:apply-templates select="item" /><!-- ElemTemplateElement[xsl:apply-templates;L7;C46;select=itemtest=item; -->
- </mode-none>
- <mode-ala>
- <xsl:apply-templates select="list" mode="ala" /><!-- selected:ElemTemplateElement[xsl:apply-templates;L10;C57;select=list -->
- </mode-ala>
- </doc>
- </xsl:template>
-
- <xsl:template match="item">
- <pie>
- <xsl:copy/>
- </pie>
- </xsl:template>
-
- <xsl:template match="list" mode="ala">
- <icecream>text-literal-chars<xsl:text>xsl-text-content</xsl:text><xsl:copy-of select="."/><!-- ElemTemplateElement[xsl:copy-of;L22;C96;select=.select=.; -->
- </icecream>
- </xsl:template>
-
-</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org