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 2012/06/08 02:00:04 UTC
svn commit: r1347837 - in /xalan/test/trunk/java/src/org/apache/qetest/xsl:
StylesheetDatalet.java StylesheetTestlet.java StylesheetTestletDriver.java
Author: ggregory
Date: Fri Jun 8 00:00:03 2012
New Revision: 1347837
URL: http://svn.apache.org/viewvc?rev=1347837&view=rev
Log: (empty)
Modified:
xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetDatalet.java
xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetTestlet.java
xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetTestletDriver.java
Modified: xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetDatalet.java
URL: http://svn.apache.org/viewvc/xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetDatalet.java?rev=1347837&r1=1347836&r2=1347837&view=diff
==============================================================================
--- xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetDatalet.java (original)
+++ xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetDatalet.java Fri Jun 8 00:00:03 2012
@@ -26,7 +26,9 @@
*/
package org.apache.qetest.xsl;
+import java.util.HashMap;
import java.util.Hashtable;
+import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
@@ -43,6 +45,9 @@ public class StylesheetDatalet implement
/** URL of the stylesheet; default:.../identity.xsl. */
public String inputName = "tests/api/trax/identity.xsl";
+ /** URL of the stylesheet params; default:.../identity.xsl. */
+ public String paramName = "tests/api/trax/identity.param";
+
/** URL of the xml document; default:.../identity.xml. */
public String xmlName = "tests/api/trax/identity.xml";
@@ -71,8 +76,10 @@ public class StylesheetDatalet implement
*/
public Properties options = new Properties();
+ public Map params = new HashMap();
+
/** Description of what this Datalet tests. */
- protected String description = "StylesheetDatalet: String inputName, String xmlName, String outputName, String goldName, String flavor";
+ protected String description = "StylesheetDatalet: String inputName, String xmlName, String outputName, String goldName, String flavor, String paramName";
/**
@@ -96,7 +103,8 @@ public class StylesheetDatalet implement
+ " xmlName=" + xmlName
+ " outputName=" + outputName
+ " goldName=" + goldName
- + " flavor=" + flavor);
+ + " flavor=" + flavor
+ + " paramName=" + paramName);
}
@@ -120,7 +128,8 @@ public class StylesheetDatalet implement
+ " xmlName=" + xmlName
+ " outputName=" + outputName
+ " goldName=" + goldName
- + " flavor=" + flavor);
+ + " flavor=" + flavor
+ + " paramName=" + paramName);
}
@@ -162,6 +171,7 @@ public class StylesheetDatalet implement
return; //@todo should this have a return val or exception?
inputName = (String)h.get("inputName");
+ paramName = (String)h.get("paramName");
xmlName = (String)h.get("xmlName");
outputName = (String)h.get("outputName");
goldName = (String)h.get("goldName");
@@ -183,6 +193,7 @@ public class StylesheetDatalet implement
return; //@todo should this have a return val or exception?
inputName = (String)p.getProperty("inputName");
+ paramName = (String)p.getProperty("paramName");
xmlName = (String)p.getProperty("xmlName");
outputName = (String)p.getProperty("outputName");
goldName = (String)p.getProperty("goldName");
@@ -209,6 +220,9 @@ public class StylesheetDatalet implement
outputName = args[2];
goldName = args[3];
flavor = args[4];
+ if (args.length > 4) {
+ paramName = args[5];
+ }
}
catch (ArrayIndexOutOfBoundsException aioobe)
{
@@ -250,6 +264,12 @@ public class StylesheetDatalet implement
if (st.hasMoreTokens())
{
flavor = st.nextToken();
+
+ if (st.hasMoreTokens())
+ {
+ paramName = st.nextToken();
+ }
+
}
}
}
Modified: xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetTestlet.java
URL: http://svn.apache.org/viewvc/xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetTestlet.java?rev=1347837&r1=1347836&r2=1347837&view=diff
==============================================================================
--- xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetTestlet.java (original)
+++ xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetTestlet.java Fri Jun 8 00:00:03 2012
@@ -27,7 +27,11 @@
package org.apache.qetest.xsl;
import java.io.File;
+import java.io.FileInputStream;
import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
import org.apache.qetest.CheckService;
import org.apache.qetest.Datalet;
@@ -189,8 +193,24 @@ public class StylesheetTestlet extends T
//@todo Should we log a custom logElement here instead?
logger.logMsg(Logger.TRACEMSG, "executing with: inputName=" + datalet.inputName
+ " xmlName=" + datalet.xmlName + " outputName=" + datalet.outputName
- + " goldName=" + datalet.goldName + " flavor=" + datalet.flavor);
+ + " goldName=" + datalet.goldName + " flavor=" + datalet.flavor
+ + " paramName=" + datalet.paramName);
+ final File paramFile = new File(datalet.paramName);
+ if (paramFile.exists()) {
+ Properties params = new Properties();
+ final FileInputStream inStream = new FileInputStream(paramFile);
+ try {
+ params.load(inStream);
+ final Iterator iter = params.entrySet().iterator();
+ while (iter.hasNext()) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ transformWrapper.setParameter(null, entry.getKey().toString(), entry.getValue());
+ }
+ } finally {
+ inStream.close();
+ }
+ }
// Simply have the wrapper do all the transforming
// or processing for us - we handle either normal .xsl
// stylesheet tests or just .xml embedded tests
Modified: xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetTestletDriver.java
URL: http://svn.apache.org/viewvc/xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetTestletDriver.java?rev=1347837&r1=1347836&r2=1347837&view=diff
==============================================================================
--- xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetTestletDriver.java (original)
+++ xalan/test/trunk/java/src/org/apache/qetest/xsl/StylesheetTestletDriver.java Fri Jun 8 00:00:03 2012
@@ -138,6 +138,13 @@ public class StylesheetTestletDriver ext
*/
public static final String OPT_PROCESSOR = "processor";
+ /**
+ * Parameter: Is there any parameters for XSL to use?
+ * <p>Default: none
+ * </p>
+ */
+ public static final String OPT_PARAM = "param";
+
/** Parameter: What processor is being used? */
protected String processor = null;
@@ -167,6 +174,9 @@ public class StylesheetTestletDriver ext
/** Convenience constant: .xml extension for input data file. */
public static final String XML_EXTENSION = ".xml";
+ /** Convenience constant: .param extension for input data file. */
+ public static final String PARAM_EXTENSION = ".param";
+
/** Convenience constant: .xsl extension for stylesheet file. */
public static final String XSL_EXTENSION = ".xsl";
@@ -626,6 +636,7 @@ public class StylesheetTestletDriver ext
d.inputName = testLocation.getPath() + File.separator + file;
String fileNameRoot = file.substring(0, file.indexOf(XSL_EXTENSION));
+ d.paramName = testLocation.getPath() + File.separator + fileNameRoot + PARAM_EXTENSION;
d.xmlName = testLocation.getPath() + File.separator + fileNameRoot + XML_EXTENSION;
d.outputName = outLocation.getPath() + File.separator + fileNameRoot + OUT_EXTENSION;
d.goldName = goldLocation.getPath() + File.separator + fileNameRoot + OUT_EXTENSION;
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org