use of org.eclipse.wst.xml.xpath2.api.Item in project webtools.sourceediting by eclipse.
the class ExternalContextExprTest method test_externalcontextitem_11.
// 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();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
AnyType result = rs.first();
actual = result.getStringValue();
} 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);
}
use of org.eclipse.wst.xml.xpath2.api.Item in project webtools.sourceediting by eclipse.
the class ExternalContextExprTest method test_externalcontextitem_2.
// 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();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
AnyType result = rs.first();
actual = result.getStringValue();
} 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);
}
use of org.eclipse.wst.xml.xpath2.api.Item in project webtools.sourceediting by eclipse.
the class ExternalContextExprTest method test_externalcontextitem_15.
// 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();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
AnyType result = rs.first();
actual = result.getStringValue();
} 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);
}
use of org.eclipse.wst.xml.xpath2.api.Item in project webtools.sourceediting by eclipse.
the class ExternalContextExprTest method test_externalcontextitem_24.
// 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/works-mod.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();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildXMLResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.api.Item in project webtools.sourceediting by eclipse.
the class ExternalContextExprTest method test_externalcontextitem_12.
// 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();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
AnyType result = rs.first();
actual = result.getStringValue();
} 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);
}
Aggregations