use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.
the class StringJoinFuncTest method test_fn_string_join_2.
// Evaluates the "string-join" function as per example 2 for this function in the FandO specs.
public void test_fn_string_join_2() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/AllStringFunc/GeneralStringFunc/StringJoinFunc/fn-string-join-2.xq";
String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/GeneralStringFunc/StringJoinFunc/fn-string-join-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 StringJoinFuncTest method test_fn_string_join_5.
// Evaluates the "string-join" function with the arguments set as follows: $arg1 = "" $arg2 = "". Use of fn:count to avoid empty file.
public void test_fn_string_join_5() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/AllStringFunc/GeneralStringFunc/StringJoinFunc/fn-string-join-5.xq";
String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/GeneralStringFunc/StringJoinFunc/fn-string-join-5.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 StringJoinFuncTest method test_fn_string_join2args_5.
// Evaluates the "string-join" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(upper bound).
public void test_fn_string_join2args_5() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/AllStringFunc/GeneralStringFunc/StringJoinFunc/fn-string-join2args-5.xq";
String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/GeneralStringFunc/StringJoinFunc/fn-string-join2args-5.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 StringJoinFuncTest method test_fn_string_join_16.
// Evaluates the "string-join" function with the arguments set as follows: $arg1 = "a" $arg2 = "A".
public void test_fn_string_join_16() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/AllStringFunc/GeneralStringFunc/StringJoinFunc/fn-string-join-16.xq";
String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/GeneralStringFunc/StringJoinFunc/fn-string-join-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 StringJoinFuncTest method test_fn_string_join_21.
// Evaluates the "string-join" function using "string-join" backwards. Arguments set as follows: $arg1 = "string-join" $arg2 = "nioj-gnirts".
public void test_fn_string_join_21() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Functions/AllStringFunc/GeneralStringFunc/StringJoinFunc/fn-string-join-21.xq";
String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/GeneralStringFunc/StringJoinFunc/fn-string-join-21.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