use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.
the class RangeExprTest method test_rangeExpr_12.
// Evaluation of a range expression, using the "fn:min" function.
public void test_rangeExpr_12() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-12.xq";
String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-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);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.
the class RangeExprTest method test_rangeExpr_17.
// Evaluation of a range expression as an argument to the "fn:avg" function.
public void test_rangeExpr_17() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-17.xq";
String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-17.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 = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.
the class RangeExprTest method test_rangeExpr_16.
// Evaluation of a range expression as an argument to the "fn:max" function.
public void test_rangeExpr_16() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-16.xq";
String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-16.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 = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.
the class SeqReverseFuncTest method test_fn_reverseusht1args_1.
// Evaluates the "reverse" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound).
public void test_fn_reverseusht1args_1() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/SeqFunc/GeneralSeqFunc/SeqReverseFunc/fn-reverseusht1args-1.xq";
String resultFile = "/ExpectedTestResults/Functions/SeqFunc/GeneralSeqFunc/SeqReverseFunc/fn-reverseusht1args-1.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 = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.
the class SeqReverseFuncTest method test_fn_reversenint1args_3.
// Evaluates the "reverse" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound).
public void test_fn_reversenint1args_3() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/SeqFunc/GeneralSeqFunc/SeqReverseFunc/fn-reversenint1args-3.xq";
String resultFile = "/ExpectedTestResults/Functions/SeqFunc/GeneralSeqFunc/SeqReverseFunc/fn-reversenint1args-3.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 = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
Aggregations