use of org.eclipse.wst.xml.xpath2.processor.internal.ast.ForExpr in project webtools.sourceediting by eclipse.
the class ForExprWithoutTest method test_ForExpr013.
// Multiple variables based off the same input context.
public void test_ForExpr013() throws Exception {
String inputFile = "/TestSources/fsx.xml";
String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExpr/ForExpr013.xq";
String resultFile = "/ExpectedTestResults/Expressions/FLWORExpr/ForExpr/ForExpr013.xml";
String expectedResult = "<result>" + getExpectedResult(resultFile) + "</result>";
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 = "<result>" + buildXMLResultString(rs) + "</result>";
} 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.processor.internal.ast.ForExpr in project webtools.sourceediting by eclipse.
the class ForExprWithoutTest method test_ForExpr025.
// Redefine existing bound variable. Second binding overrides first.
public void test_ForExpr025() throws Exception {
String inputFile = "/TestSources/fsx.xml";
String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExpr/ForExpr025.xq";
String resultFile = "/ExpectedTestResults/Expressions/FLWORExpr/ForExpr/ForExpr025.xml";
String expectedResult = "<result>" + getExpectedResult(resultFile) + "</result>";
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 = "<result>" + buildXMLResultString(rs) + "</result>";
} 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.processor.internal.ast.ForExpr in project webtools.sourceediting by eclipse.
the class ForExprWithoutTest method test_ForExpr021.
// Test order of iteration between two variables in the same 'for' statement.
public void test_ForExpr021() throws Exception {
String inputFile = "/TestSources/fsx.xml";
String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExpr/ForExpr021.xq";
String resultFile = "/ExpectedTestResults/Expressions/FLWORExpr/ForExpr/ForExpr021.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.processor.internal.ast.ForExpr in project webtools.sourceediting by eclipse.
the class ForExprWithoutTest method test_ForExpr026.
// Missing 'in'.
public void test_ForExpr026() throws Exception {
String inputFile = "/TestSources/fsx.xml";
String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExpr/ForExpr026.xq";
String expectedResult = "XPST0003";
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.processor.internal.ast.ForExpr in project webtools.sourceediting by eclipse.
the class ForExprWithoutTest method test_ForExpr001.
// For+Return - to iterate a constant sequence.
public void test_ForExpr001() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExpr/ForExpr001.xq";
String resultFile = "/ExpectedTestResults/Expressions/FLWORExpr/ForExpr/ForExpr001.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