Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 134141 Details for
Bug 262765
[xpath2] Make sure PsychoPath XPath 2.0 processor passes W3C Test Suite
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Refactored Test Suite Creation
RefactoredPatch.txt (text/plain), 173.35 KB, created by
David Carver
on 2009-05-01 21:08:18 EDT
(
hide
)
Description:
Refactored Test Suite Creation
Filename:
MIME Type:
Creator:
David Carver
Created:
2009-05-01 21:08:18 EDT
Size:
173.35 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.xml.xpath2.processor.tests >Index: src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractPsychoPathTest.java >--- src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java 27 Apr 2009 15:07:18 -0000 1.2 >+++ src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java 2 May 2009 01:06:35 -0000 >@@ -7,11 +7,17 @@ > * > * Contributors: > * David Carver (STAR) - initial API and implementation >+ * Jin Mingjan - bug 262765 - extractXPathExpression and getExpectedResults > *******************************************************************************/ > package org.eclipse.wst.xml.xpath2.processor.test; > >+ >+ > import java.io.*; > import java.net.URL; >+import java.util.HashMap; >+import java.util.regex.Matcher; >+import java.util.regex.Pattern; > > import org.apache.xerces.xs.ElementPSVI; > import org.apache.xerces.xs.XSModel; >@@ -20,6 +26,8 @@ > import org.eclipse.wst.xml.xpath2.processor.ast.*; > import org.eclipse.wst.xml.xpath2.processor.function.*; > import org.eclipse.wst.xml.xpath2.processor.internal.function.XDTCtrLibrary; >+import org.eclipse.wst.xml.xpath2.processor.internal.types.ElementType; >+import org.eclipse.wst.xml.xpath2.processor.internal.types.QName; > import org.osgi.framework.Bundle; > import org.w3c.dom.Document; > >@@ -29,6 +37,17 @@ > > protected Document domDoc = null; > protected Bundle bundle = null; >+ >+ private static final String INPUT_CONTEXT = "input-context"; >+ private static final String INPUT_CONTEXT1 = "input-context1"; >+ private static final String INPUT_CONTEXT2 = "input-context2"; >+// private static final String S_COMMENT1 = "(:"; >+ private static final String S_COMMENT2 = ":)"; >+ private static final String DECLARE_NAMESPACE = "declare namespace"; >+ private static final String DECLARE_VARIABLE = "declare variable"; >+ private static final String REGEX_DN = "declare namespace\\s+(\\w[-_\\w]*)\\s*=\\s*['\"]([^;]*)['\"];"; >+ private static HashMap<String, String> namespaceMap = new HashMap<String, String>(3); >+ private static HashMap<String, String> inputMap = new HashMap<String, String>(3); > > @Override > protected void setUp() throws Exception { >@@ -59,12 +78,16 @@ > > protected DynamicContext setupDynamicContext(XSModel schema) { > DynamicContext dc = new DefaultDynamicContext(schema, domDoc); >- dc.add_namespace("xsd", "http://www.w3.org/2001/XMLSchema"); >+ dc.add_namespace("xs", "http://www.w3.org/2001/XMLSchema"); > dc.add_namespace("xdt", "http://www.w3.org/2004/10/xpath-datatypes"); >+ dc.add_namespace("fn", "http://www.w3.org/2004/10/xpath-functions");//XXX:PP FunctionLibrary ns bug >+ dc.add_namespace("local", "http://www.w3.org/2005/xquery-local-functions"); >+ > > dc.add_function_library(new FnFunctionLibrary()); > dc.add_function_library(new XSCtrLibrary()); > dc.add_function_library(new XDTCtrLibrary()); >+ setupVariables(dc); > return dc; > } > >@@ -77,5 +100,107 @@ > name_check.check(path); > return path; > } >+ >+ protected String getExpectedResult(String xqFile){ >+ String resultFile = xqFile; >+ // >+ if (resultFile.length()<10) { //<9 enough? like XPST0001 >+ return resultFile; >+ } >+ String content=""; >+ // >+ InputStream isrf; >+ try { >+ isrf = bundle.getEntry(resultFile).openStream(); >+ BufferedReader rfreader = new BufferedReader(new InputStreamReader(isrf)); >+ //XXX:assume char buffer 2048 is long enough;1024 maybe enough >+ //Exception: Axes085, NodeTest003/04/05,... >+ int bufferLength = 2048; >+ if ((resultFile.indexOf("Axes085") != -1) >+ || (resultFile.indexOf("NodeTest003") != -1) >+ || (resultFile.indexOf("NodeTest004") != -1) >+ || (resultFile.indexOf("NodeTest005") != -1)) { >+ bufferLength = 40000; >+ }else if(resultFile.indexOf("ForExpr013") != -1) { >+ bufferLength = 433500; >+ }else if(resultFile.indexOf("ForExpr016") != -1 >+ || (resultFile.indexOf("ReturnExpr011") != -1) >+ || (resultFile.indexOf("sgml-queries-results-q1") != -1) >+ || (resultFile.indexOf("sgml-queries-results-q2") != -1)) { >+ bufferLength = 10240; >+ } >+ char[] cbuf = new char[bufferLength]; >+ int nByte = rfreader.read(cbuf); >+ assertTrue(resultFile,nByte<bufferLength);//assert nice buffer length >+ >+ content = new String(cbuf).trim(); >+ rfreader.close(); >+ isrf.close(); >+ >+ } catch (IOException e) { >+// e.printStackTrace(); >+ content = "XPST0003"; >+ } >+ return content; >+ } >+ >+ public String extractXPathExpression(String xqFile, String inputFile) { >+ // get the xpath2 expr from xq file, first >+ char[] cbuf = new char[2048];// >+ String content = null; >+ String xpath2Expr = null; >+ >+ try { >+ InputStream isxq = bundle.getEntry(xqFile).openStream(); >+ BufferedReader xqreader = new BufferedReader(new InputStreamReader(isxq)); >+ int nByte = xqreader.read(cbuf); >+ assertTrue(xqFile,nByte<2048); >+ content = new String(cbuf).trim(); >+ // >+ if (content.indexOf(INPUT_CONTEXT) != -1 >+ && content.indexOf(INPUT_CONTEXT1) == -1 >+ && content.indexOf(INPUT_CONTEXT2) == -1) { >+ inputMap.put(INPUT_CONTEXT, inputFile); >+ } else if (content.indexOf(INPUT_CONTEXT1) == -1) { >+ inputMap.put(INPUT_CONTEXT1, inputFile); >+ } else if (content.indexOf(INPUT_CONTEXT2) != -1) { >+ inputMap.put(INPUT_CONTEXT2, inputFile); >+ } >+ // >+ if (content.indexOf(DECLARE_NAMESPACE)!=-1) { >+ setupNamespace(content); >+ } >+ // >+ assertTrue(content.lastIndexOf(S_COMMENT2)!=-1);//assert to get >+ xpath2Expr = content.substring(content.lastIndexOf(S_COMMENT2)+2).trim(); >+ >+ xqreader.close(); >+ isxq.close(); >+ } catch (IOException e) { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } >+ return xpath2Expr; >+ } >+ >+ protected void setupNamespace(String content) { >+ Pattern p = Pattern.compile(REGEX_DN); >+ Matcher m = p.matcher(content); >+ while (m.find()) { >+ assertTrue(m.groupCount()==2);// >+ namespaceMap.put(m.group(1), m.group(2)); >+ } >+ >+ } >+ >+ protected DynamicContext setupVariables(DynamicContext dc) { >+ dc.add_variable(new QName("x")); >+ dc.add_variable(new QName("var")); >+ ElementType elementType = new ElementType(domDoc.getDocumentElement(), 0);; >+ dc.set_variable(new QName("input-context1"), elementType); >+ >+ return dc; >+ } >+ > > } >Index: createXPath2Junit3Test.xsl >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/tests/org.eclipse.wst.xml.xpath2.processor.tests/createXPath2Junit3Test.xsl,v >retrieving revision 1.1 >diff -u -r1.1 createXPath2Junit3Test.xsl >--- createXPath2Junit3Test.xsl 29 Apr 2009 04:28:11 -0000 1.1 >+++ createXPath2Junit3Test.xsl 2 May 2009 01:06:35 -0000 >@@ -18,7 +18,7 @@ > <xsl:output indent="yes" method="text" encoding="UTF-8"/> > > <xsl:variable name="location">/Queries/XQuery</xsl:variable> >- <xsl:param name="group">SequenceTypeSyntax</xsl:param> >+ <xsl:param name="group">ExternalContextExpr</xsl:param> > > <xsl:template match="/"> > <xsl:text> >@@ -27,12 +27,10 @@ > import java.net.URL; > > import org.apache.xerces.xs.XSModel; >-import org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator; >-import org.eclipse.wst.xml.xpath2.processor.DynamicContext; >-import org.eclipse.wst.xml.xpath2.processor.Evaluator; >-import org.eclipse.wst.xml.xpath2.processor.ResultSequence; >+import org.eclipse.wst.xml.xpath2.processor.*; > import org.eclipse.wst.xml.xpath2.processor.ast.XPath; >-import org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean; >+import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType; >+import org.eclipse.wst.xml.xpath2.processor.test.AbstractPsychoPathTest; > > </xsl:text> > <xsl:apply-templates/> >@@ -42,7 +40,7 @@ > <xsl:text> > public class </xsl:text> > <xsl:value-of select="$group"/> >- <xsl:text> extends AbstractPsychoPathTest { >+ <xsl:text>Test extends AbstractPsychoPathTest { > </xsl:text> > <xsl:apply-templates select="descendant::xqts:test-group[@name = $group]"/> > <xsl:text> >@@ -65,7 +63,7 @@ > //</xsl:text> > <xsl:value-of select="./xqts:description"/> > <xsl:text> >- public void </xsl:text> >+ public void test_</xsl:text> > <xsl:variable name="methodName"> > <xsl:call-template name="replace-string"> > <xsl:with-param name="text" select="$testName"/> >@@ -74,8 +72,12 @@ > </xsl:call-template> > </xsl:variable> > <xsl:value-of select="$methodName"/> >- <xsl:text> throws Exception { >- URL fileURL = bundle.getEntry("/bugTestFiles/bug273719.xml"); >+ <xsl:text>() throws Exception { >+</xsl:text> >+ <xsl:call-template name="SetVariables"/> >+<xsl:text> >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); > loadDOMDocument(fileURL); > > // Get XML Schema Information for the Document >@@ -83,17 +85,26 @@ > > DynamicContext dc = setupDynamicContext(schema); > >- String xpath = "string-length(x) > 2"; >- XPath path = compileXPath(dc, xpath); >- >- Evaluator eval = new DefaultEvaluator(dc, domDoc); >- ResultSequence rs = eval.evaluate(path); >- >- XSBoolean result = (XSBoolean) rs.first(); >- >- String actual = result.string_value(); >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } catch (DynamicError ex) { >+ actual = ex.code(); >+ } > >- assertEquals("true", actual); >+ assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); > > </xsl:text> > <xsl:text> >@@ -102,6 +113,22 @@ > </xsl:if> > </xsl:template> > >+ <xsl:template name="SetVariables"> >+ <xsl:text> String inputFile = "/TestSources/</xsl:text> >+ <xsl:value-of select="xqts:input-file"/> >+ <xsl:text>.xml";</xsl:text> >+ <xsl:text> >+ String xqFile = "/Queries/XQuery/</xsl:text> >+ <xsl:value-of select="@FilePath"/> >+ <xsl:value-of select="xqts:query/@name"/> >+ <xsl:text>.xq";</xsl:text> >+ <xsl:text> >+ String resultFile = "/ExpectedTestResults/</xsl:text> >+ <xsl:value-of select="@FilePath"/> >+ <xsl:value-of select="xqts:output-file"/> >+ <xsl:text>";</xsl:text> >+ </xsl:template> >+ > <xsl:template name="replace-string"> > <xsl:param name="text"/> > <xsl:param name="replace"/> >Index: src/org/eclipse/wst/xml/xpath2/processor/testsuite/ParenExprTest.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/xpath2/processor/testsuite/ParenExprTest.java >diff -N src/org/eclipse/wst/xml/xpath2/processor/testsuite/ParenExprTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/xpath2/processor/testsuite/ParenExprTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,526 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Carver (STAR) - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.wst.xml.xpath2.processor.testsuite; >+ >+import java.net.URL; >+import java.util.Iterator; >+ >+import org.apache.xerces.xs.XSModel; >+import org.eclipse.wst.xml.xpath2.processor.*; >+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.test.AbstractPsychoPathTest; >+ >+ >+public class ParenExprTest extends AbstractPsychoPathTest { >+ >+ //Arithmetic operations. >+ public void test_Parenexpr_1() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-1.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-1.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Arithmetic operations. >+ public void test_Parenexpr_2() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-2.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-2.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Arithmetic operations. >+ public void test_Parenexpr_3() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-3.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-3.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Arithmetic operations. >+ public void test_Parenexpr_4() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-4.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-4.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Arithmetic operations. >+ public void test_Parenexpr_5() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-5.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-5.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Arithmetic operations. >+ public void test_Parenexpr_6() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-6.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-6.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Arithmetic operations. >+ public void test_Parenexpr_7() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-7.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-7.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Arithmetic operations. >+ public void test_Parenexpr_8() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-8.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-8.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Logical expressions. >+ public void test_Parenexpr_9() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-9.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-9.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Logical expressions. >+ public void test_Parenexpr_10() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-10.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-10.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //If expression. >+ public void test_Parenexpr_12() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-12.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-12.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Literal. >+ public void test_Parenexpr_13() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-13.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-13.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Sequence. >+ public void test_Parenexpr_14() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-14.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-14.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ Iterator iterator = rs.iterator(); >+ actual = new String(); >+ while (iterator.hasNext()) { >+ AnyType result = (AnyType)iterator.next(); >+ actual = actual + result.string_value() + " "; >+ } >+ >+ actual = actual.trim(); >+ >+ } 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 newline at end of file >Index: src/org/eclipse/wst/xml/xpath2/processor/testsuite/SequenceTypeSyntaxTest.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/xpath2/processor/testsuite/SequenceTypeSyntaxTest.java >diff -N src/org/eclipse/wst/xml/xpath2/processor/testsuite/SequenceTypeSyntaxTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/xpath2/processor/testsuite/SequenceTypeSyntaxTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,787 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Carver (STAR) - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.wst.xml.xpath2.processor.testsuite; >+ >+import java.net.URL; >+ >+import org.apache.xerces.xs.XSModel; >+import org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator; >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; >+import org.eclipse.wst.xml.xpath2.processor.Evaluator; >+import org.eclipse.wst.xml.xpath2.processor.ResultSequence; >+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.XPathParserException; >+import org.eclipse.wst.xml.xpath2.processor.test.AbstractPsychoPathTest; >+import org.eclipse.wst.xml.xpath2.processor.StaticError; >+ >+ >+public class SequenceTypeSyntaxTest extends AbstractPsychoPathTest { >+ >+ //Simple evaluation of sequence type matching involving instance of and a sequence of integers. >+ public void test_sequence_type_1() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-1.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving instance of and a sequence of doubles. >+ public void test_sequence_type_2() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-2.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving instance of and a sequence of decimal. >+ public void test_sequence_type_3() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-3.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving instance of and a sequence of strings. >+ public void test_sequence_type_4() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-4.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving instance of and a sequence of strings. (uses integer*). >+ public void test_sequence_type_5() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-5.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving instance of and a sequence of one integer (Uses integer?). >+ public void test_sequence_type_6() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-6.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving instance of and a sequence of integers. (Uses integer?). >+ public void test_sequence_type_7() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-7.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving instance of and a sequence of integers. (Uses integer+). >+ public void test_sequence_type_8() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-8.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving castable as and a sequence of one integer. (Uses integer?). >+ public void test_sequence_type_9() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-9.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving castable as and a sequence of two integers. (Uses integer?). >+ public void test_sequence_type_10() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-10.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving castable as and a sequence of one double. (Uses double?). >+ public void test_sequence_type_11() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-11.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving castable as and a sequence of two double. (Uses double?). >+ public void test_sequence_type_12() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-12.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving castable as and a sequence of one decimal. (Uses decimal?). >+ public void test_sequence_type_13() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-13.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving castable as and a sequence of two decimals. (Uses decimal?). >+ public void test_sequence_type_14() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-14.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving castable as and a sequence of one string. (Uses string?). >+ public void test_sequence_type_15() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-15.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving castable as and a sequence of two strings. (Uses string?). >+ public void test_sequence_type_16() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-16.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving castable as and a sequence of one string. (Uses integer?). >+ public void test_sequence_type_17() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-17.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving castable as and a sequence of two strings. (Uses integer?). >+ public void test_sequence_type_18() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-18.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving instance of and a sequence of two booleans. (Uses xs:boolean*). >+ public void test_sequence_type_19() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-19.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving instance of and a sequence of two booleans. (Uses xs:boolean?). >+ public void test_sequence_type_20() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-20.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple evaluation of sequence type matching involving instance of and a sequence of two booleans. (Uses xs:boolean+). >+ public void test_sequence_type_21() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-21.xq"; >+ String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+} >+ >\ No newline at end of file >Index: src/org/eclipse/wst/xml/xpath2/processor/testsuite/ExternalContextExprTest.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/xpath2/processor/testsuite/ExternalContextExprTest.java >diff -N src/org/eclipse/wst/xml/xpath2/processor/testsuite/ExternalContextExprTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/xpath2/processor/testsuite/ExternalContextExprTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,938 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Carver (STAR) - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.wst.xml.xpath2.processor.testsuite; >+ >+import java.net.URL; >+ >+import org.apache.xerces.xs.XSModel; >+import org.eclipse.wst.xml.xpath2.processor.*; >+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.test.AbstractPsychoPathTest; >+ >+ >+public class ExternalContextExprTest extends AbstractPsychoPathTest { >+ >+ //Context Item expression that just uses the "name" element and no context item defined. >+ public void test_externalcontextitem_1() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-1.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item is used as a string. >+ public void test_externalcontextitem_2() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-2.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-2.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item is used as an integer. >+ public void test_externalcontextitem_3() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-3.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-3.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item is used as a decimal. >+ public void test_externalcontextitem_4() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-4.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-4.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item is used a float. >+ public void test_externalcontextitem_5() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-5.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-5.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item is used as a double. >+ public void test_externalcontextitem_6() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-6.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-6.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item is used as a boolean value. >+ public void test_externalcontextitem_7() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-7.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-7.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item is used as a boolean with fn:not. >+ public void test_externalcontextitem_8() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-8.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-8.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item is used as argument to sum function. >+ public void test_externalcontextitem_9() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-9.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-9.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as part of addition operation. >+ public void test_externalcontextitem_10() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-10.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-10.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as part of a subtraction operation. >+ public void test_externalcontextitem_11() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-11.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-11.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as part of a multiplication operation. >+ public void test_externalcontextitem_12() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-12.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-12.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as part of a modulus operation. >+ public void test_externalcontextitem_13() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-13.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-13.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as part of a divison (div operator) operation. >+ public void test_externalcontextitem_14() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-14.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-14.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as part of a divison (idiv operator) operation. >+ public void test_externalcontextitem_15() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-15.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-15.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as part of a boolean expression (and operator). >+ public void test_externalcontextitem_16() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-16.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-16.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as part of a boolean expression (or operator). >+ public void test_externalcontextitem_17() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-17.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-17.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as argument to string-length function. >+ public void test_externalcontextitem_18() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-18.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-18.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as argument to "avg" function. >+ public void test_externalcontextitem_19() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-19.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-19.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as argument to "min" function. >+ public void test_externalcontextitem_20() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-20.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-20.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as argument to "max" function. >+ public void test_externalcontextitem_21() throws Exception { >+ String inputFile = "/TestSources/works-mod.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-21.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-21.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as argument to "max" function. >+ public void test_externalcontextitem_22() throws Exception { >+ String inputFile = "/TestSources/.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-22.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-22.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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); >+ >+ >+ } >+ >+ //Reference to a context item that has not been bound. >+ public void test_externalcontextitem_23() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-23.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 external context item expression where context item used as argument to "max" function. >+ public void test_externalcontextitem_24() throws Exception { >+ String inputFile = "/TestSources/.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-24.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/ContextExpr/ExternalContextExpr/externalcontextitem-22.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } 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 newline at end of file >Index: src/org/eclipse/wst/xml/xpath2/processor/testsuite/LiteralsTest.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/xpath2/processor/testsuite/LiteralsTest.java >diff -N src/org/eclipse/wst/xml/xpath2/processor/testsuite/LiteralsTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/xpath2/processor/testsuite/LiteralsTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,2408 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Carver (STAR) - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.wst.xml.xpath2.processor.testsuite; >+ >+import java.net.URL; >+ >+import org.apache.xerces.xs.XSModel; >+import org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator; >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; >+import org.eclipse.wst.xml.xpath2.processor.Evaluator; >+import org.eclipse.wst.xml.xpath2.processor.ResultSequence; >+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.XPathParserException; >+import org.eclipse.wst.xml.xpath2.processor.test.AbstractPsychoPathTest; >+import org.eclipse.wst.xml.xpath2.processor.StaticError; >+ >+ >+public class LiteralsTest extends AbstractPsychoPathTest { >+ >+ //Simple use case for string literals. >+ public void test_Literals001() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals001.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals001.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Simple use case for string literals. >+ public void test_Literals002() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals002.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals002.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test case where string literal contains a new line. >+ public void test_Literals003() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals003.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals003.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test case where string literal contains a new line. >+ public void test_Literals004() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals004.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals004.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ >+ //Unterminated string literal. >+ public void test_Literals006() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals006.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Unterminated string literal. >+ public void test_Literals007() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals007.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Incorrectly terminated string literal. >+ public void test_Literals008() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals008.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Incorrectly terminated string literal. >+ public void test_Literals009() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals009.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid interger literal. >+ public void test_Literals010() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals010.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals010.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid interger literal. >+ public void test_Literals011() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals011.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals011.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid decimal literal. >+ public void test_Literals012() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals012.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals012.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid decimal literal. >+ public void test_Literals013() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals013.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals013.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid decimal literal. >+ public void test_Literals014() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals014.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals014.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid decimal literal. >+ public void test_Literals015() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals015.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals015.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals016() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals016.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals016.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals017() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals017.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals017.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals018() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals018.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals018.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals019() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals019.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals019.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals020() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals020.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals020.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals021() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals021.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals021.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals022() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals022.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals022.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals023() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals023.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals023.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals024() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals024.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals024.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals025() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals025.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals025.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals026() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals026.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals026.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals027() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals027.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals027.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals028() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals028.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals028.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals029() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals029.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals029.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals030() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals030.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals030.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals031() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals031.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals031.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals032() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals032.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals032.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals033() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals033.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals033.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals034() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals034.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals034.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for valid double literal. >+ public void test_Literals035() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals035.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals035.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid decimal literal. >+ public void test_Literals036() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals036.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid decimal literal. >+ public void test_Literals037() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals037.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid decimal literal. >+ public void test_Literals038() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals038.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid decimal literal. >+ public void test_Literals039() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals039.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid decimal literal. >+ public void test_Literals040() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals040.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals041() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals041.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals042() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals042.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals043() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals043.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals044() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals044.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals045() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals045.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals046() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals046.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals047() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals047.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals048() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals048.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals049() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals049.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals050() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals050.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals051() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals051.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals052() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals052.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals053() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals053.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals054() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals054.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for invalid double literal. >+ public void test_Literals055() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals055.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for string literal containing the predefined entity reference '&'. >+ public void test_Literals056() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals056.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals056.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for string literal containing the predefined entity reference '"'. >+ public void test_Literals057() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals057.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals057.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for string literal containing the predefined entity reference '''. >+ public void test_Literals058() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals058.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals058.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for string literal containing the predefined entity reference '<'. >+ public void test_Literals059() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals059.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals059.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test for string literal containing the predefined entity reference '>'. >+ public void test_Literals060() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals060.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals060.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test the escaping of the " (quotation) character in XQuery. >+ public void test_Literals062() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals062.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals062.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test the escaping of the ' (apostrophe) character in XQuery. >+ public void test_Literals063() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals063.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals063.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test the escaping of the ' (apostrophe) and " (quotation) characters in XQuery. >+ public void test_Literals064() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals064.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals064.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test the escaping of the ' (apostrophe) and " (quotation) characters in XQuery. >+ public void test_Literals065() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals065.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals065.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test the escaping of the ' (apostrophe) and " (quotation) characters as part of an XML element constructor. >+ public void test_Literals066() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals066.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals066.xml"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test the escaping of the ' (apostrophe) and " (quotation) characters as part of an XML text node constructor. >+ public void test_Literals068() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals068.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals068.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+ //Test the escaping of the ' (apostrophe) and " (quotation) characters as part of an XML text node constructor. >+ public void test_Literals069() throws Exception { >+ String inputFile = "/TestSources/emptydoc.xml"; >+ String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals069.xq"; >+ String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals069.txt"; >+ String expectedResult = getExpectedResult(resultFile); >+ URL fileURL = bundle.getEntry(inputFile); >+ loadDOMDocument(fileURL); >+ >+ // Get XML Schema Information for the Document >+ XSModel schema = getGrammar(); >+ >+ 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); >+ >+ AnyType result = rs.first(); >+ >+ actual = result.string_value(); >+ } catch (XPathParserException ex) { >+ actual = ex.code(); >+ } catch (StaticError ex) { >+ actual = ex.code(); >+ } >+ >+ assertEquals("XPath Result Error:", expectedResult, actual); >+ >+ >+ } >+ >+} >+ >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 262765
:
125774
|
126252
|
126253
|
134141
|
134165
|
134192