Bug 339771: Split WTP-specific schema type provider into separate plugin (plus test plugin)
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/.classpath b/tests/org.eclipse.wst.xml.xpath2.processor.tests/.classpath index 7283e14..4ecc50e 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/.classpath +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/.classpath
@@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> <accessrules> <accessrule kind="accessible" pattern="org/eclipse/wst/xml/xpath2/processor/**"/>
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.wst.xml.xpath2.processor.tests/.settings/org.eclipse.jdt.core.prefs index 449c281..a120dee 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,8 @@ -#Wed Jan 28 23:20:01 GMT 2009 +#Sun Jun 27 01:34:11 CEST 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.3
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.xml.xpath2.processor.tests/META-INF/MANIFEST.MF index 49c865b..3d6ff37 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/META-INF/MANIFEST.MF
@@ -7,12 +7,9 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.apache.xerces;bundle-version="[2.9.0,3.0.0)", org.eclipse.wst.xml.xpath2.processor;bundle-version="[2.0,3.0.0)", - org.eclipse.wst.xml.xpath2.wtptypes;bundle-version="[2.0,3.0.0)", org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", org.junit;bundle-version="3.8.2", org.w3c.xqts.testsuite;bundle-version="1.0.2", - org.eclipse.wst.xml.core;bundle-version="[1.1.0,2.0.0)", - org.eclipse.wst.sse.core;bundle-version="[1.1.0,2.0.0)", org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)" Export-Package: org.custommonkey.xmlunit, org.custommonkey.xmlunit.examples,
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java index 8a8fb52..c17fc5c 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Standards for Technology in Automotive Retail and others. + * Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -110,10 +110,8 @@ private static final String IMPORT_SCHEMA_NAMESPACE = "import schema namespace"; private static final String REGEX_DN = " namespace\\s+(\\w[-_\\w]*)\\s*=\\s*['\"]([^;]*)['\"];"; - private static HashMap<String, String> inputMap = new HashMap<String, String>( - 3); + private static HashMap inputMap = new HashMap(3); - @Override protected void setUp() throws Exception { super.setUp(); bundle = Platform @@ -215,7 +213,6 @@ is2.close(); } - @Override protected void tearDown() throws Exception { super.tearDown(); domDoc = null; @@ -493,12 +490,11 @@ return dc; } - @SuppressWarnings("unchecked") protected String buildResultString(ResultSequence rs) { String actual = new String(); - Iterator<AnyType> iterator = rs.iterator(); + Iterator iterator = rs.iterator(); while (iterator.hasNext()) { - AnyType anyType = iterator.next(); + AnyType anyType = (AnyType)iterator.next(); actual = actual + anyType.string_value() + " "; } @@ -506,7 +502,6 @@ return actual.trim(); } - @SuppressWarnings("unchecked") protected String buildXMLResultString(ResultSequence rs) throws Exception { DOMImplementationLS domLS = (DOMImplementationLS) domDoc.getImplementation().getFeature("LS", "3.0"); LSOutput outputText = domLS.createLSOutput(); @@ -515,10 +510,10 @@ outputText.setByteStream(outputStream); String actual = new String(); - Iterator<NodeType> iterator = rs.iterator(); + Iterator iterator = rs.iterator(); boolean queueSpace = false; while (iterator.hasNext()) { - AnyType aat = iterator.next(); + AnyType aat = (AnyType)iterator.next(); if (aat instanceof NodeType) { NodeType nodeType = (NodeType) aat; Node node = nodeType.node_value(); @@ -589,7 +584,8 @@ XSObject xsobject = xstypes.item(i); if ("http://www.w3.org/XQueryTest/userDefinedTypes".equals(xsobject.getNamespace())) { if (xsobject instanceof XSSimpleTypeDefinition) { - if (((XSSimpleTypeDefinition) xsobject).getNumeric()) { + XSSimpleTypeDefinition typeDef = (XSSimpleTypeDefinition) xsobject; + if (typeDef.getNumeric()) { if (xsobject.getName().equals("floatBased") || xsobject.getName().equals("shoesize")) { XercesFloatUserDefined fudt = new XercesFloatUserDefined(xsobject); udl.add_type(fudt); @@ -603,7 +599,7 @@ XercesQNameUserDefined qudt = new XercesQNameUserDefined(xsobject); udl.add_type(qudt); } else { - XercesUserDefined udt = new XercesUserDefined(xsobject); + XercesUserDefined udt = new XercesUserDefined(typeDef); udl.add_type(udt); } } @@ -616,12 +612,15 @@ } protected void assertXPathTrue(String xpath, DynamicContext dc, Document domDoc) { - XSBoolean result = evaluateSimpleXPath(xpath, dc, domDoc, XSBoolean.class); + XSBoolean result = evaluateBoolXPath(xpath, dc, domDoc); assertEquals(true, result.value()); } - @SuppressWarnings("unchecked") - protected <T extends AnyType> T evaluateSimpleXPath(String xpath, DynamicContext dc, Document doc, Class<T> resultClass) { + protected XSBoolean evaluateBoolXPath(String xpath, DynamicContext dc, Document doc) { + return (XSBoolean) evaluateSimpleXPath(xpath, dc, doc, XSBoolean.class); + } + + protected AnyType evaluateSimpleXPath(String xpath, DynamicContext dc, Document doc, Class resultClass) { XPath path; try { path = compileXPath(dc, xpath); @@ -646,7 +645,7 @@ AnyType result = rs.first(); assertTrue("Exected XPath result instanceof class " + resultClass.getSimpleName() + " from \'" + xpath + "\', got " + result.getClass(), resultClass.isInstance(result)); - return (T)result; + return result; }
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/AllPsychoPathTests.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/AllPsychoPathTests.java index b31cff3..dbb0df6 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/AllPsychoPathTests.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/AllPsychoPathTests.java
@@ -33,7 +33,6 @@ suite.addTestSuite(TestSumAvg.class); suite.addTestSuite(XPathDecimalFormatTest.class); suite.addTestSuite(LiteralUtilsTest.class); - suite.addTestSuite(TestWTPDOMXPath2.class); suite.addTestSuite(KindTestSITest.class); //$JUnit-END$ return suite;
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/Bug269833.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/Bug269833.java index 02ce96a..427c902 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/Bug269833.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/Bug269833.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. + * Copyright (c) 2009, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - bug 269833 - initial API and implementation + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.test; @@ -35,7 +36,6 @@ } } - @Override protected void setUp() throws Exception { URL fileURL = new URL("http://resolve-locally/xml/note.xml"); loadDOMDocument(fileURL);
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java index dfac2b2..35b4d1e 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009-2010 Standards for Technology in Automotive Retail and others. + * Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -50,6 +50,8 @@ * Mukul Gandhi - bug 334478 implementation of xs:token data type * Mukul Gandhi - bug 334842 - improving support for the data types Name, NCName, ENTITY, * ID, IDREF and NMTOKEN. + * Mukul Gandhi - bug 338494 - prohibiting xpath expressions starting with / or // to be parsed. + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 * Mukul Gandhi - bug 338494 - prohibiting xpath expressions starting with / or // to be parsed. * Mukul Gandhi - bug 338999 - improving compliance of function 'fn:subsequence'. implementing full arity support. * Mukul Gandhi - bug 339025 - fixes to fn:distinct-values function. ability to find distinct values on node items. @@ -92,7 +94,6 @@ private Bundle bundle; - @Override protected void setUp() throws Exception { // TODO Auto-generated method stub super.setUp(); @@ -2261,12 +2262,11 @@ private CollationProvider createLengthCollatorProvider() { return new CollationProvider() { - @SuppressWarnings("unchecked") public Comparator get_collation(String name) { if (name.equals(URN_X_ECLIPSE_XPATH20_FUNKY_COLLATOR)) { - return new Comparator<String>() { - public int compare(String o1, String o2) { - return o1.length() - o2.length(); + return new Comparator() { + public int compare(Object o1, Object o2) { + return ((String)o1).length() - ((String)o2).length(); } }; }
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestMinMax.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestMinMax.java index 3c30adc..135db98 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestMinMax.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestMinMax.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Jesper Steen Moller and others. + * Copyright (c) 2009, 2010 Jesper Steen Moller and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Jesper S Moller - initial API and implementation + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.test; @@ -116,9 +117,9 @@ return new CollationProvider() { public Comparator get_collation(String name) { if (name.equals(URN_X_ECLIPSE_XPATH20_FUNKY_COLLATOR)) { - return new Comparator<String>() { - public int compare(String o1, String o2) { - return o1.length() - o2.length(); + return new Comparator() { + public int compare(Object o1, Object o2) { + return ((String)o1).length() - ((String)o2).length(); } }; }
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestWTPDOMXPath2.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestWTPDOMXPath2.java deleted file mode 100644 index 59c9854..0000000 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestWTPDOMXPath2.java +++ /dev/null
@@ -1,2811 +0,0 @@ -package org.eclipse.wst.xml.xpath2.processor.test; - -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.net.URL; -import java.util.Iterator; - -import org.apache.xerces.xs.XSModel; -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.xml.core.internal.document.DOMModelImpl; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator; -import org.eclipse.wst.xml.xpath2.processor.DynamicContext; -import org.eclipse.wst.xml.xpath2.processor.DynamicError; -import org.eclipse.wst.xml.xpath2.processor.Evaluator; -import org.eclipse.wst.xml.xpath2.processor.ResultSequence; -import org.eclipse.wst.xml.xpath2.processor.StaticError; -import org.eclipse.wst.xml.xpath2.processor.XPathParserException; -import org.eclipse.wst.xml.xpath2.processor.ast.XPath; -import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType; -import org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType; -import org.eclipse.wst.xml.xpath2.wtptypes.XsdDOMTypeProvider; -import org.w3c.dom.Document; - -public class TestWTPDOMXPath2 extends AbstractPsychoPathTest { - IDOMModel model = null; - - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - if (model != null) { - model.releaseFromRead(); - } - } - - public void testSimpleWTPDOM() throws Exception { - // Test for the fix, for xpathDefaultNamespace - bundle = Platform - .getBundle("org.eclipse.wst.xml.xpath2.processor.tests"); - - URL fileURL = bundle.getEntry("/bugTestFiles/bug273719.xml"); - super.domDoc = load(fileURL); - - // set up XPath default namespace in Dynamic Context - DynamicContext dc = setupDynamicContext(null); - - String xpath = "string-length(x) > 2"; - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - AnyType result = rs.first(); - - String actual = result.string_value(); - - assertEquals("true", actual); - } - - { -// DefaultTypeProviderRegistry.getInstance().register(DOMModelImpl.class, new XsdDOMTypeProvider()); - } - - public void testWTPDOMWithTypes() throws Exception { - // Test for the fix, for xpathDefaultNamespace - bundle = Platform - .getBundle("org.eclipse.wst.xml.xpath2.processor.tests"); - - URL fileURL = bundle.getEntry("/bugTestFiles/attrNodeTest.xml"); - super.domDoc = load(fileURL); - - // set up XPath default namespace in Dynamic Context - DynamicContext dc = setupDynamicContext2(new XsdDOMTypeProvider.XsdTypeModel((IDOMDocument)domDoc)); - - assertXPathTrue("/Example/x[1] instance of element(*, x_Type)", dc, domDoc); - assertXPathTrue("not (/Example/x[1] instance of element(*, y_Type))", dc, domDoc); - assertXPathTrue("/Example/x instance of x_Type+", dc, domDoc); - assertXPathTrue("/Example/x instance of element(x, x_Type)+", dc, domDoc); - assertXPathTrue("not (/Example/x instance of element(z, x_Type)+)", dc, domDoc); - assertXPathTrue("/Example/x[2]/@mesg instance of mesg_Type", dc, domDoc); - assertXPathTrue("/Example/x[2]/@mesg instance of attribute(mesg, mesg_Type)", dc, domDoc); - assertXPathTrue("not (/Example/x[2]/@mesg instance of attribute(mesg, xs:integer))", dc, domDoc); - assertXPathTrue("not (/Example/x[2]/@mesg instance of attribute(cesc, mesg_Type))", dc, domDoc); - assertXPathTrue("/Example/y/@intAttr instance of attribute(intAttr, xs:integer)", dc, domDoc); - } - - public void test_ForExpr005() throws Exception { - String inputFile = "/TestSources/fsx.xml"; - String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExpr/ForExpr005.xq"; - String resultFile = "/ExpectedTestResults/Expressions/FLWORExpr/ForExpr/ForExpr005.xml"; - String expectedResult = getExpectedResult(resultFile); - - URL fileURL = bundle.getEntry(inputFile); - super.domDoc = load(fileURL); - DynamicContext dc = setupDynamicContext(null); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Type declaration containing multiple 'as' keywords. - public void test_ForExprType013() throws Exception { - String inputFile = "/TestSources/orderData.xml"; - String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExprType/ForExprType013.xq"; - String expectedResult = "XPST0003"; - URL fileURL = bundle.getEntry(inputFile); - super.domDoc = load(fileURL); - - DynamicContext dc = setupDynamicContext(null); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // No children for child::*. - public void test_Axes001_1() throws Exception { - String inputFile = "/TestSources/TreeTrunc.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes001.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes001-1.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - super.domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Simple filter using data query from xml source and the "gt" operator. - public void test_filterexpressionhc1() throws Exception { - String inputFile = "/TestSources/works.xml"; - String xqFile = "/Queries/XQuery/Expressions/SeqExpr/FilterExpr/filterexpressionhc1.xq"; - String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/FilterExpr/filterexpressionhc1.txt"; - String expectedResult = "<result>" + getExpectedResult(resultFile) - + "</result>"; - URL fileURL = bundle.getEntry(inputFile); - super.domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = "<result>" + buildXMLResultString(rs) + "</result>"; - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // No children, child::name gets none. - public void test_Axes002_1() throws Exception { - String inputFile = "/TestSources/TreeTrunc.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes002.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes002-1.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates abbreviated syntax, "hours". Selects the "hours" element - // children of the context node. - public void test_abbreviatedSyntax_1() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/AbbrAxes/abbreviatedSyntax-1.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/AbbrAxes/abbreviatedSyntax-1.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates abbreviated syntax, "text()". Selects all text node children of - // the context node. - public void test_abbreviatedSyntax_2() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/AbbrAxes/abbreviatedSyntax-2.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/AbbrAxes/abbreviatedSyntax-2.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates abbreviated syntax, "@name". Selects the name attribute of the - // context node. - public void test_abbreviatedSyntax_3() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/AbbrAxes/abbreviatedSyntax-3.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/AbbrAxes/abbreviatedSyntax-3.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates abbreviated syntax, "employee[1]". Selects the first employee - // child of the context node. - public void test_abbreviatedSyntax_5() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/AbbrAxes/abbreviatedSyntax-5.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/AbbrAxes/abbreviatedSyntax-5.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a Node expression With the operands/operator set with the - // following format: empty Sequence is Single Node Element. - public void test_nodeexpression3() throws Exception { - String inputFile = "/TestSources/works.xml"; - String xqFile = "/Queries/XQuery/Expressions/Operators/NodeOp/NodeSame/nodeexpression3.xq"; - String resultFile = "/ExpectedTestResults/Expressions/Operators/NodeOp/NodeSame/nodeexpression3.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a Node expression With the operands/operator set with the - // following format: empty Sequence is Sequence of single Element Node. - public void test_nodeexpression4() throws Exception { - String inputFile = "/TestSources/staff.xml"; - String xqFile = "/Queries/XQuery/Expressions/Operators/NodeOp/NodeSame/nodeexpression4.xq"; - String resultFile = "/ExpectedTestResults/Expressions/Operators/NodeOp/NodeSame/nodeexpression4.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a Node expression With the operands/operator set with the - // following format: Single Node Element is empty Sequence. - public void test_nodeexpression9() throws Exception { - String inputFile = "/TestSources/works.xml"; - String xqFile = "/Queries/XQuery/Expressions/Operators/NodeOp/NodeSame/nodeexpression9.xq"; - String resultFile = "/ExpectedTestResults/Expressions/Operators/NodeOp/NodeSame/nodeexpression9.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a Node expression With the operands/operator set with the - // following format: Single Node Element is Single Node Element. - public void test_nodeexpression11() throws Exception { - String inputFile = "/TestSources/works.xml"; - String xqFile = "/Queries/XQuery/Expressions/Operators/NodeOp/NodeSame/nodeexpression11.xq"; - String resultFile = "/ExpectedTestResults/Expressions/Operators/NodeOp/NodeSame/nodeexpression11.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a simple predicate with a "true" value (uses "fn:true"). - public void test_predicates_1() throws Exception { - String inputFile = "/TestSources/atomicns.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Predicates/predicates-1.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Predicates/predicates-1.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a simple predicate with a "false" value (uses "fn:false"). - // Use "fn:count" to avoid empty file. - public void test_predicates_2() throws Exception { - String inputFile = "/TestSources/atomicns.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Predicates/predicates-2.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Predicates/predicates-2.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a simple predicate with a "true" value (uses "fn:true" and - // fn:not()). - public void test_predicates_3() throws Exception { - String inputFile = "/TestSources/atomicns.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Predicates/predicates-3.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Predicates/predicates-3.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a simple predicate set to a boolean expression ("and" - // operator), returns true. - public void test_predicates_4() throws Exception { - String inputFile = "/TestSources/atomicns.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Predicates/predicates-4.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Predicates/predicates-4.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a simple predicate set to a boolean expression ("or" - // operator), return true. - public void test_predicates_5() throws Exception { - String inputFile = "/TestSources/atomicns.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Predicates/predicates-5.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Predicates/predicates-5.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a simple predicate set to a boolean expression ("and" - // operator), returns false. Use "fn:count" to avoid empty file. - public void test_predicates_6() throws Exception { - String inputFile = "/TestSources/atomicns.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Predicates/predicates-6.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Predicates/predicates-6.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // No children of any kind, elem//child::* gets none. - public void test_Axes074_1() throws Exception { - String inputFile = "/TestSources/TreeTrunc.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes074.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes074-1.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//child::* gets nothing when no element children. - public void test_Axes074_2() throws Exception { - String inputFile = "/TestSources/Tree1Text.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes074.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes074-2.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//child::* gets 1 child element. - public void test_Axes074_3() throws Exception { - String inputFile = "/TestSources/Tree1Child.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes074.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes074-3.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//child::* gets several nodes. - public void test_Axes074_4() throws Exception { - String inputFile = "/TestSources/TreeRepeat.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes074.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes074-4.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//child::name gets nothing when no sub-tree. - public void test_Axes075_1() throws Exception { - String inputFile = "/TestSources/TreeTrunc.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes075.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes075-1.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//child::name gets none when no elements have that name. - public void test_Axes075_2() throws Exception { - String inputFile = "/TestSources/Tree1Child.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes075.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes075-2.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//child::name gets the 1 descendant of that name. - public void test_Axes075_3() throws Exception { - String inputFile = "/TestSources/TreeCompass.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes075.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes075-3.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//child::name gets several elements. - public void test_Axes075_4() throws Exception { - String inputFile = "/TestSources/TreeStack.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes075.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes075-4.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // No children, elem//child::node() gets none. - public void test_Axes076_1() throws Exception { - String inputFile = "/TestSources/TreeTrunc.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes076.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes076-1.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//child::node() gets 1 child element. - public void test_Axes076_2() throws Exception { - String inputFile = "/TestSources/Tree1Child.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes076.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes076-2.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//child::node() gets 1 child text node. - public void test_Axes076_3() throws Exception { - String inputFile = "/TestSources/Tree1Text.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes076.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes076-3.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Several children for elem//child::node(). - public void test_Axes076_4() throws Exception { - String inputFile = "/TestSources/TreeRepeat.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes076.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes076-4.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // No children for elem//*. - public void test_Axes077_1() throws Exception { - String inputFile = "/TestSources/TreeTrunc.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes077.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes077-1.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // 1 child for elem//*. - public void test_Axes077_2() throws Exception { - String inputFile = "/TestSources/Tree1Child.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes077.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes077-2.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Many children for elem//*. - public void test_Axes077_3() throws Exception { - String inputFile = "/TestSources/TreeRepeat.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes077.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes077-3.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//name gets none when there are no children. - public void test_Axes078_1() throws Exception { - String inputFile = "/TestSources/TreeTrunc.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes078.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes078-1.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//name gets none when no elements have that name. - public void test_Axes078_2() throws Exception { - String inputFile = "/TestSources/Tree1Child.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes078.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes078-2.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//name gets the 1 descendant of that name. - public void test_Axes078_3() throws Exception { - String inputFile = "/TestSources/TreeCompass.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes078.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes078-3.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//name gets several elements. - public void test_Axes078_4() throws Exception { - String inputFile = "/TestSources/TreeStack.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes078.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes078-4.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // No children, elem//node() gets none. - public void test_Axes079_1() throws Exception { - String inputFile = "/TestSources/TreeTrunc.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes079.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes079-1.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//node() gets 1 child element. - public void test_Axes079_2() throws Exception { - String inputFile = "/TestSources/Tree1Child.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes079.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes079-2.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // elem//node() gets 1 child text node. - public void test_Axes079_3() throws Exception { - String inputFile = "/TestSources/Tree1Text.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/Axes079.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/Axes/Axes079-3.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a Node expression With the operands/operator set with the - // following format: empty Sequence "<<" empty Sequence. - public void test_nodeexpression17() throws Exception { - String inputFile = "/TestSources/emptydoc.xml"; - String xqFile = "/Queries/XQuery/Expressions/Operators/NodeOp/NodeBefore/nodeexpression17.xq"; - String resultFile = "/ExpectedTestResults/Expressions/Operators/NodeOp/NodeBefore/nodeexpression17.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a Node expression With the operands/operator set with the - // following format: empty Sequence "<<" Single Node Element. - public void test_nodeexpression19() throws Exception { - String inputFile = "/TestSources/works.xml"; - String xqFile = "/Queries/XQuery/Expressions/Operators/NodeOp/NodeBefore/nodeexpression19.xq"; - String resultFile = "/ExpectedTestResults/Expressions/Operators/NodeOp/NodeBefore/nodeexpression19.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a Node expression With the operands/operator set with the - // following format: empty Sequence "<<" Sequence of single Element Node. - public void test_nodeexpression20() throws Exception { - String inputFile = "/TestSources/staff.xml"; - String xqFile = "/Queries/XQuery/Expressions/Operators/NodeOp/NodeBefore/nodeexpression20.xq"; - String resultFile = "/ExpectedTestResults/Expressions/Operators/NodeOp/NodeBefore/nodeexpression20.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a Node expression With the operands/operator set with the - // following format: Single Node Element "<<" empty Sequence. - public void test_nodeexpression25() throws Exception { - String inputFile = "/TestSources/works.xml"; - String xqFile = "/Queries/XQuery/Expressions/Operators/NodeOp/NodeBefore/nodeexpression25.xq"; - String resultFile = "/ExpectedTestResults/Expressions/Operators/NodeOp/NodeBefore/nodeexpression25.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluation of a Node expression With the operands/operator set with the - // following format: Single Node Element "<<" Single Node Element. - public void test_nodeexpression27() throws Exception { - String inputFile = "/TestSources/works.xml"; - String xqFile = "/Queries/XQuery/Expressions/Operators/NodeOp/NodeBefore/nodeexpression27.xq"; - String resultFile = "/ExpectedTestResults/Expressions/Operators/NodeOp/NodeBefore/nodeexpression27.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - public Document load(java.net.URL url) throws Exception { - IModelManager modelManager = StructuredModelManager.getModelManager(); - InputStream inStream = url.openStream(); - if (inStream == null) - throw new FileNotFoundException("Can't file resource stream " - + url.getFile()); - model = (IDOMModel) modelManager.getModelForRead(url.toString(), - inStream, null); - - return model.getDocument(); - } - - // Evaluates unabbreviated syntax - child::empnum - select empnum children - // of the context node. - public void test_unabbreviatedSyntax_1() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-1.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-1.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax - child::* - select all element children - // of the context node. - public void test_unabbreviatedSyntax_2() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-2.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-2.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax - child::text() - select all text node - // children of the context node. - public void test_unabbreviatedSyntax_3() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-3.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-3.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax - parent::node() - Selects the parent of - // the context node. - public void test_unabbreviatedSyntax_8() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-8.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-8.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax - descendant::empnum - Selects the - // "empnum" descendants of the context node. - public void test_unabbreviatedSyntax_9() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-9.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-9.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax - descendant-or-self::employee - Selects - // all the "employee" descendant of the context node (selects employee, if - // the context node is "employee"). - public void test_unabbreviatedSyntax_12() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-12.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-12.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax - self::employee - Selects the context - // node, if it is an "employee" element, otherwise returns empty sequence. - // This test retuns an "employee" element. - public void test_unabbreviatedSyntax_13() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-13.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-13.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax - self::hours - Selects the context node, - // if it is an "hours" element, otherwise returns empty sequence. This test - // retuns the empty sequence. - public void test_unabbreviatedSyntax_14() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-14.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-14.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax child::employee/descendant:empnum- Selects - // the empnum element descendants of the employee element children of the - // context node. - public void test_unabbreviatedSyntax_15() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-15.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-15.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax child::*/child:pnum)- Selects the pnum - // grandchildren of the context node. - public void test_unabbreviatedSyntax_16() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-16.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-16.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate /descendant::pnum - Selects all - // the pnum elements in the same document as the context node. - public void test_unabbreviatedSyntax_18() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-18.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-18.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // /descendant::employee/child::pnum selects all the pnum elements that have - // an "employee" parent and that are in the same document as the context - // node. - public void test_unabbreviatedSyntax_19() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-19.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-19.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "child::employee[fn:position() = 1]". Selects the first employee child of - // the context node. - public void test_unabbreviatedSyntax_20() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-20.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-20.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "child::employee[fn:position() = fn:last()]". Selects the last "employee" - // child of the context node. - public void test_unabbreviatedSyntax_21() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-21.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-21.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "child::employee[fn:position() = fn:last()-1]. Selects the previous to the last one "employee" - // child of the context node. - public void test_unabbreviatedSyntax_22() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-22.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-22.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "child::hours[fn:position() > 1]". Selects all the para children of the - // context node other than the first "hours" child of the context node. - public void test_unabbreviatedSyntax_23() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-23.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-23.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "/descendant::employee[fn:position() = 12]". Selects the twelfth employee - // element in the document containing the context node. - public void test_unabbreviatedSyntax_26() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-26.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-26.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "/child::works/child::employee[fn:position() = 5]/child::hours[fn:position() = 2]". - // Selects the second "hours" of the fifth "employee" of the "works" whose - // parent is the document node that contains the context node. - public void test_unabbreviatedSyntax_27() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-27.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-27.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "child::employee[attribute::name eq "Jane Doe 11"]". Selects all - // "employee" children of the context node that have a "name" attribute with - // value "Jane Doe 11". - public void test_unabbreviatedSyntax_28() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-28.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-28.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "child::employee[attribute::gender eq 'female'][fn:position() = 5]". - // Selects the fifth employee child of the context node that has a gender - // attribute with value "female". - public void test_unabbreviatedSyntax_29() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-29.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-29.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "child::employee[child::empnum = 'E3']". Selects the employee children of - // the context node that have one or more empnum children whose typed value - // is equal to the string "E3". - public void test_unabbreviatedSyntax_30() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-30.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-30.txt"; - String expectedResult = "<result>" + getExpectedResult(resultFile) - + "</result>"; - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = "<result>" + buildXMLResultString(rs) + "</result>"; - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "child::employee[child::status]". Selects the employee children of the - // context node that have one or more status children. - public void test_unabbreviatedSyntax_31() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-31.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-31.txt"; - String expectedResult = formatResultString(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "child::*[self::pnum or self::empnum]". Selects the pnum and empnum - // children of the context node. - public void test_unabbreviatedSyntax_32() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-32.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-32.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - // Evaluates unabbreviated syntax. Evaluate - // "child::*[self::empnum or self::pnum][fn:position() = fn:last()]". - // Selects the last empnum or pnum child of the context node. - public void test_unabbreviatedSyntax_33() throws Exception { - String inputFile = "/TestSources/works-mod.xml"; - String xqFile = "/Queries/XQuery/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-33.xq"; - String resultFile = "/ExpectedTestResults/Expressions/PathExpr/UnabbrAxes/unabbreviatedSyntax-33.txt"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, - actual); - - } - - //FLWOR expression returns a constructed sequence. - public void test_ReturnExpr011() throws Exception { - String inputFile = "/TestSources/fsx.xml"; - String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ReturnExpr/ReturnExpr011.xq"; - String resultFile = "/ExpectedTestResults/Expressions/FLWORExpr/ReturnExpr/ReturnExpr011.xml"; - String expectedResult = getExpectedResult(resultFile); - URL fileURL = bundle.getEntry(inputFile); - domDoc = load(fileURL); - - // Get XML Schema Information for the Document - XSModel schema = null; - - DynamicContext dc = setupDynamicContext(schema); - - String xpath = extractXPathExpression(xqFile, inputFile); - String actual = null; - try { - XPath path = compileXPath(dc, xpath); - - Evaluator eval = new DefaultEvaluator(dc, domDoc); - ResultSequence rs = eval.evaluate(path); - - actual = buildXMLResultString(rs); - - } catch (XPathParserException ex) { - actual = ex.code(); - } catch (StaticError ex) { - actual = ex.code(); - } catch (DynamicError ex) { - actual = ex.code(); - } - - assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); - - - } - - @Override - protected String buildXMLResultString(ResultSequence rs) throws Exception { - Iterator<NodeType> iterator = rs.iterator(); - StringBuffer buffer = new StringBuffer(); - while (iterator.hasNext()) { - AnyType aat = iterator.next(); - if (aat instanceof NodeType) { - NodeType nodeType = (NodeType) aat; - IDOMNode node = (IDOMNode) nodeType.node_value(); - buffer = buffer.append(node.getSource()); - } else { - buffer = buffer.append(aat.string_value()); - } - } - - return buffer.toString(); - } - -}
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestXPath20.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestXPath20.java index c471f52..cbf469d 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestXPath20.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestXPath20.java
@@ -1,5 +1,5 @@ /******************************************************************************* - *Copyright (c) 2009 Standards for Technology in Automotive Retail and others. + *Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others. *All rights reserved. This program and the accompanying materials *are made available under the terms of the Eclipse Public License v1.0 *which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ *Contributors: * David Carver (STAR) - initial API and implementation * Mukul Gandhi - bug 273760 - wrong namespace for functions and data types + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.test; @@ -29,7 +30,6 @@ public class TestXPath20 extends AbstractPsychoPathTest { - @Override protected void setUp() throws Exception { super.setUp(); URL fileURL = bundle.getEntry("/TestSources/acme_corp.xml"); @@ -109,7 +109,7 @@ } public void testFloatFormat() throws Exception { - Float value = 1.0f; + Float value = new Float(1.0f); XPathDecimalFormat format = new XPathDecimalFormat("0.#######E0"); String result = format.xpathFormat(value); assertEquals("1", result);
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/XPath20TestPlugin.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/XPath20TestPlugin.java index 845c6fb..502779c 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/XPath20TestPlugin.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/XPath20TestPlugin.java
@@ -1,3 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Carver (STAR) - initial API and implementation + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 + *******************************************************************************/ + package org.eclipse.wst.xml.xpath2.processor.test; import org.eclipse.core.runtime.Plugin; @@ -18,7 +30,6 @@ * @see * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) */ - @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; @@ -30,7 +41,6 @@ * @see * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) */ - @Override public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context);
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/XPathDecimalFormatTest.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/XPathDecimalFormatTest.java index aee67bf..24f6aac 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/XPathDecimalFormatTest.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/XPathDecimalFormatTest.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Standards for Technology in Automotive Retail and others. + * Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * Contributors: * David Carver - initial API and implementation * Jesper Steen Moller - bug 283404 - added locale sensitivity test + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.test; @@ -25,28 +26,28 @@ public void testDoublePositiveInfinity() { XPathDecimalFormat format = new XPathDecimalFormat(DOUBLE_FORMAT); - Double value = Double.POSITIVE_INFINITY; + Double value = new Double(Double.POSITIVE_INFINITY); String result = format.xpathFormat(value); assertEquals("Unexpected XPath format String:", "INF", result); } public void testDoubleNegativeInfinity() { XPathDecimalFormat format = new XPathDecimalFormat(DOUBLE_FORMAT); - Double value = Double.NEGATIVE_INFINITY; + Double value = new Double(Double.NEGATIVE_INFINITY); String result = format.xpathFormat(value); assertEquals("Unexpected XPath format string:", "-INF", result); } public void testFloatPositiveInfinity() { XPathDecimalFormat format = new XPathDecimalFormat(FLOAT_FORMAT); - Float value = Float.POSITIVE_INFINITY; + Float value = new Float(Float.POSITIVE_INFINITY); String result = format.xpathFormat(value); assertEquals("Unexpected XPath format string:", "INF", result); } public void testFloatNegativeInfinity() { XPathDecimalFormat format = new XPathDecimalFormat(FLOAT_FORMAT); - Float value = Float.NEGATIVE_INFINITY; + Float value = new Float(Float.NEGATIVE_INFINITY); String result = format.xpathFormat(value); assertEquals("Unexpected XPath format string:", "-INF", result); }
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/core/ParenExprTest.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/core/ParenExprTest.java index c39362a..5114a19 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/core/ParenExprTest.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/core/ParenExprTest.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Standards for Technology for Automotive Retail and others. + * Copyright (c) 2009, 2010 Standards for Technology for Automotive Retail and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * David Carver (STAR) - initial API and implementation + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.testsuite.core; @@ -442,7 +443,6 @@ } //Sequence. - @SuppressWarnings("unchecked") public void test_Parenexpr_14() throws Exception { String inputFile = "/TestSources/emptydoc.xml"; String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-14.xq";
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/functions/SeqCollectionFuncTest.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/functions/SeqCollectionFuncTest.java index 43a333a..44de2d1 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/functions/SeqCollectionFuncTest.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/functions/SeqCollectionFuncTest.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Standards for Technology in Automotive Retail and others. + * Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * David Carver - STAR - initial api and implementation bug 262765 + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.testsuite.functions; @@ -370,10 +371,10 @@ Document dom1 = domload.load(fileURL.openStream()); fileURL = bundle.getEntry("/TestSources/reviews.xml"); Document dom2 = domload.load(fileURL.openStream()); - ArrayList<Document> arraylist = new ArrayList<Document>(); + ArrayList arraylist = new ArrayList(); arraylist.add(dom1); arraylist.add(dom2); - HashMap<String, List<Document>> map = new HashMap(); + HashMap map = new HashMap(); map.put(FnCollection.DEFAULT_COLLECTION_URI, arraylist); map.put(COLLECTION1, arraylist); dc.set_collections(map); @@ -387,11 +388,11 @@ Document dom2 = domload.load(fileURL.openStream()); fileURL = bundle.getEntry("/TestSources/books.xml"); Document dom3 = domload.load(fileURL.openStream()); - ArrayList<Document> arraylist = new ArrayList<Document>(); + ArrayList arraylist = new ArrayList(); arraylist.add(dom1); arraylist.add(dom2); arraylist.add(dom3); - HashMap<String, List<Document>> map = new HashMap(); + HashMap map = new HashMap(); map.put(FnCollection.DEFAULT_COLLECTION_URI, arraylist); map.put(COLLECTION2, arraylist); dc.set_collections(map);
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/schema/SeqExprCastSITest.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/schema/SeqExprCastSITest.java index b3582d0..89e8a30 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/schema/SeqExprCastSITest.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/schema/SeqExprCastSITest.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Standards for Technology in Automotive Retail and others. + * Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * David Carver - STAR - initial api and implementation bug 262765 + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.testsuite.schema; @@ -188,7 +189,7 @@ public void test_notation_cast_2() throws Exception { String inputFile = "/TestSources/emptydoc.xml"; String xqFile = "/Queries/XQuery/SchemaImport/SeqExprCastSI/notation-cast-2.xq"; - List<String> expectedResult = Arrays.asList("XPST0080", "XPST0017"); + List expectedResult = Arrays.asList(new String[] {"XPST0080", "XPST0017"}); URL fileURL = bundle.getEntry(inputFile); Schema jaxpSchema = loadSchema(); loadDOMDocument(fileURL, jaxpSchema);
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/schema/UserDefinedSITest.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/schema/UserDefinedSITest.java index 0988528..789cf97 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/schema/UserDefinedSITest.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/schema/UserDefinedSITest.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Standards for Technology in Automotive Retail and others. + * Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * David Carver - STAR - initial api and implementation bug 262765 + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.testsuite.schema; @@ -72,7 +73,7 @@ //Evaluation of simple constructor function violation for user defined data type derived from xs:integer. public void test_user_defined_2() throws Exception { String inputFile = "/TestSources/emptydoc.xml"; - List<String> expectedResult = Arrays.asList( "FORG0001", "XQST0009", "XPST0017" ); + List expectedResult = Arrays.asList(new String[] {"FORG0001", "XQST0009", "XPST0017"}); URL fileURL = bundle.getEntry(inputFile); Schema jaxpSchema = loadSchema();
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesFloatUserDefined.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesFloatUserDefined.java index ea43eb3..a1d40fb 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesFloatUserDefined.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesFloatUserDefined.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Standards for Technology in Automotive Retail and others + * Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * David Carver (STAR) - initial API and implementation + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.testsuite.userdefined; @@ -32,7 +33,6 @@ super(x); } - @Override public ResultSequence constructor(ResultSequence arg) throws DynamicError { ResultSequence rs = ResultSequenceFactory.create_new(); @@ -70,7 +70,6 @@ return rs; } - @Override public String type_name() { return typeInfo.getName(); }
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesIntegerUserDefined.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesIntegerUserDefined.java index f73414d..a41b86a 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesIntegerUserDefined.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesIntegerUserDefined.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Standards for Technology in Automotive Retail and others + * Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * David Carver (STAR) - initial API and implementation + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.testsuite.userdefined; @@ -32,7 +33,6 @@ this.typeInfo = typeInfo; } - @Override public ResultSequence constructor(ResultSequence arg) throws DynamicError { ResultSequence rs = ResultSequenceFactory.create_new(); @@ -70,7 +70,6 @@ return rs; } - @Override public String type_name() { return typeInfo.getName(); }
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesQNameUserDefined.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesQNameUserDefined.java index 57b34eb..43b89fb 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesQNameUserDefined.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesQNameUserDefined.java
@@ -1,3 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Carver (STAR) - initial API and implementation + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 + *******************************************************************************/ + package org.eclipse.wst.xml.xpath2.processor.testsuite.userdefined; import org.apache.xerces.xs.XSObject; @@ -15,7 +27,6 @@ this.typeInfo = typeInfo; } - @Override public ResultSequence constructor(ResultSequence arg) throws DynamicError { ResultSequence rs = ResultSequenceFactory.create_new(); @@ -35,7 +46,6 @@ } - @Override public String type_name() { return typeInfo.getName(); }
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesUserDefined.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesUserDefined.java index c5d1f47..edf9412 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesUserDefined.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/testsuite/userdefined/XercesUserDefined.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Standards for Technology in Automotive Retail and others + * Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,28 +7,30 @@ * * Contributors: * David Carver (STAR) - initial API and implementation + * Mukul Gandhi - bug 280798 - PsychoPath support for JDK 1.4 *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.testsuite.userdefined; import org.apache.xerces.xs.XSObject; +import org.apache.xerces.xs.XSTypeDefinition; +import org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition; import org.eclipse.wst.xml.xpath2.processor.DynamicError; import org.eclipse.wst.xml.xpath2.processor.ResultSequence; import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType; import org.eclipse.wst.xml.xpath2.processor.internal.types.CtrType; import org.eclipse.wst.xml.xpath2.processor.internal.types.XSString; +import org.eclipse.wst.xml.xpath2.processor.internal.types.xerces.XercesTypeDefinition; public class XercesUserDefined extends CtrType { - private XSObject typeInfo; + private XSTypeDefinition typeInfo; private String value; - public XercesUserDefined(XSObject typeInfo) { + public XercesUserDefined(XSTypeDefinition typeInfo) { this.typeInfo = typeInfo; } - - @Override public ResultSequence constructor(ResultSequence arg) throws DynamicError { ResultSequence rs = ResultSequenceFactory.create_new(); @@ -44,20 +46,19 @@ return rs; } - - @Override public String string_type() { return null; } - @Override public String string_value() { return value; } - @Override public String type_name() { return typeInfo.getName(); } + public TypeDefinition getTypeDefinition() { + return XercesTypeDefinition.createTypeDefinition((XSTypeDefinition)typeInfo); + } }