use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.
the class SeqZeroOrOneFuncTest method test_fn_zero_or_oneintg1args_2.
// Evaluates the "zero-or-one" function with the arguments set as follows: $arg = xs:integer(mid range).
public void test_fn_zero_or_oneintg1args_2() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-oneintg1args-2.xq";
String resultFile = "/ExpectedTestResults/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-oneintg1args-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);
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 SeqZeroOrOneFuncTest method test_fn_zero_or_onesht1args_2.
// Evaluates the "zero-or-one" function with the arguments set as follows: $arg = xs:short(mid range).
public void test_fn_zero_or_onesht1args_2() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-onesht1args-2.xq";
String resultFile = "/ExpectedTestResults/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-onesht1args-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);
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 StaticBaseURIFuncTest method test_fn_static_base_1.
// Evaluates the "static-base-uri" function with incorrect arity.
public void test_fn_static_base_1() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/AccessorFunc/StaticBaseURIFunc/fn-static-base-uri-1.xq";
String expectedResult = "XPST0017";
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 StaticBaseURIFuncTest method test_fn_static_base_14.
// Evaluates the "static-base-uri" function used as argument to fn:string-before.
public void test_fn_static_base_14() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/AccessorFunc/StaticBaseURIFunc/fn-static-base-uri-14.xq";
String resultFile = "/ExpectedTestResults/Functions/AccessorFunc/StaticBaseURIFunc/fn-static-base-uri-14.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 baseuri = "http://www.example.com";
setBaseUri(baseuri);
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 StaticBaseURIFuncTest method test_fn_static_base_13.
// Evaluates the "static-base-uri" function used as argument to fn:string-before.
public void test_fn_static_base_13() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/AccessorFunc/StaticBaseURIFunc/fn-static-base-uri-13.xq";
String resultFile = "/ExpectedTestResults/Functions/AccessorFunc/StaticBaseURIFunc/fn-static-base-uri-13.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 baseuri = "http://www.example.com";
setBaseUri(baseuri);
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