use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.
the class TestBugs method testFnNumber_Evaluation2.
public void testFnNumber_Evaluation2() throws Exception {
// Bug 298519
bundle = Platform.getBundle("org.w3c.xqts.testsuite");
URL fileURL = bundle.getEntry("/TestSources/emptydoc.xml");
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = "number(xs:unsignedByte('20')) ge 18";
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
XSBoolean result = (XSBoolean) rs.first();
String actual = result.getStringValue();
assertEquals("true", actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.
the class TestBugs method testBug341862_TypedBooleanNode.
public void testBug341862_TypedBooleanNode() throws Exception {
// bug 341862
URL fileURL = bundle.getEntry("/bugTestFiles/bug341862.xml");
URL schemaURL = bundle.getEntry("/bugTestFiles/bug341862.xsd");
loadDOMDocument(fileURL, schemaURL);
// Get XSModel object for the Schema
XSModel schema = getGrammar(schemaURL);
setupDynamicContext(schema);
// test a)
String xpath = "/X/a[1] = true()";
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
String actual = ((XSBoolean) rs.first()).getStringValue();
assertEquals("true", actual);
// test b)
xpath = "/X/a[1]/@att = true()";
compileXPath(xpath);
rs = evaluate(domDoc);
actual = ((XSBoolean) rs.first()).getStringValue();
assertEquals("true", actual);
// test c)
xpath = "/X/a[2] = true()";
compileXPath(xpath);
rs = evaluate(domDoc);
actual = ((XSBoolean) rs.first()).getStringValue();
assertEquals("true", actual);
// test d)
xpath = "/X/a[2]/@att = true()";
compileXPath(xpath);
rs = evaluate(domDoc);
actual = ((XSBoolean) rs.first()).getStringValue();
assertEquals("true", actual);
// test e)
xpath = "/X/a[3] = false()";
compileXPath(xpath);
rs = evaluate(domDoc);
actual = ((XSBoolean) rs.first()).getStringValue();
assertEquals("true", actual);
// test f)
xpath = "/X/a[3]/@att = false()";
compileXPath(xpath);
rs = evaluate(domDoc);
actual = ((XSBoolean) rs.first()).getStringValue();
assertEquals("true", actual);
// test g)
xpath = "/X/a[4] = false()";
compileXPath(xpath);
rs = evaluate(domDoc);
actual = ((XSBoolean) rs.first()).getStringValue();
assertEquals("true", actual);
// test h)
xpath = "/X/a[4]/@att = false()";
compileXPath(xpath);
rs = evaluate(domDoc);
actual = ((XSBoolean) rs.first()).getStringValue();
assertEquals("true", actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.
the class TestBugs method testBug339025_distinctValuesOnNodeSequence.
public void testBug339025_distinctValuesOnNodeSequence() throws Exception {
// bug 339025
URL fileURL = bundle.getEntry("/bugTestFiles/bug339025.xml");
URL schemaURL = bundle.getEntry("/bugTestFiles/bug339025.xsd");
loadDOMDocument(fileURL, schemaURL);
// Get XSModel object for the Schema
XSModel schema = getGrammar(schemaURL);
setupDynamicContext(schema);
;
// test a)
String xpath = "count(//a) = count(distinct-values(//a))";
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
String actual = ((XSBoolean) rs.first()).getStringValue();
assertEquals("true", actual);
// test b)
xpath = "count(X/a) = count(distinct-values(X/a))";
compileXPath(xpath);
rs = evaluate(domDoc);
actual = ((XSBoolean) rs.first()).getStringValue();
assertEquals("true", actual);
// test c)
xpath = "count(//b) = count(distinct-values(//b))";
compileXPath(xpath);
rs = evaluate(domDoc);
actual = ((XSBoolean) rs.first()).getStringValue();
assertEquals("false", actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.
the class TestBugs method testStringFunctionBug274471.
public void testStringFunctionBug274471() throws Exception {
// Bug 274471
URL fileURL = bundle.getEntry("/bugTestFiles/bug274471.xml");
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = "x/string() = 'unhappy'";
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
XSBoolean result = (XSBoolean) rs.first();
String actual = result.getStringValue();
assertEquals("true", actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean in project webtools.sourceediting by eclipse.
the class TestBugs method testXSBase64Binary.
public void testXSBase64Binary() throws Exception {
// Bug 281046
bundle = Platform.getBundle("org.w3c.xqts.testsuite");
URL fileURL = bundle.getEntry("/TestSources/emptydoc.xml");
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = "xs:base64Binary('cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q') eq xs:base64Binary('cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q')";
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
XSBoolean result = (XSBoolean) rs.first();
String actual = result.getStringValue();
assertEquals("true", actual);
}
Aggregations