use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger in project webtools.sourceediting by eclipse.
the class TestBugs method testTypedValueEnhancement_Bug323900_3.
public void testTypedValueEnhancement_Bug323900_3() throws Exception {
// Bug 323900
URL fileURL = bundle.getEntry("/bugTestFiles/bug323900_2.xml");
URL schemaURL = bundle.getEntry("/bugTestFiles/bug323900_2.xsd");
loadDOMDocument(fileURL, schemaURL);
// Get XSModel object for the Schema
XSModel schema = getGrammar(schemaURL);
setupDynamicContext(schema);
String xpath = "data(X)";
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
assertTrue(rs.get(0) instanceof XSInteger);
assertEquals(BigInteger.ONE, ((XSInteger) rs.get(0)).int_value());
assertTrue(rs.get(1) instanceof XSInteger);
assertEquals(BigInteger.valueOf(2), ((XSInteger) rs.get(1)).int_value());
assertTrue(rs.get(2) instanceof XSString);
assertEquals("3.3", ((XSString) rs.get(2)).getStringValue());
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger in project webtools.sourceediting by eclipse.
the class TestBugs method testTypedValueEnhancement_Bug323900_5.
public void testTypedValueEnhancement_Bug323900_5() throws Exception {
// Bug 323900
URL fileURL = bundle.getEntry("/bugTestFiles/bug323900_4.xml");
URL schemaURL = bundle.getEntry("/bugTestFiles/bug323900_3.xsd");
loadDOMDocument(fileURL, schemaURL);
// Get XSModel object for the Schema
XSModel schema = getGrammar(schemaURL);
setupDynamicContext(schema);
String xpath = "data(X)";
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
XSInteger result = (XSInteger) rs.get(0);
assertEquals("10", result.getStringValue());
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger in project webtools.sourceediting by eclipse.
the class TestBugs method testFunctionAtomization.
public void testFunctionAtomization() throws Exception {
// Bug 318313
URL fileURL = bundle.getEntry("/bugTestFiles/bug318313.xml");
URL schemaURL = bundle.getEntry("/bugTestFiles/bug318313.xsd");
loadDOMDocument(fileURL, schemaURL);
// Get XSModel object for the Schema
XSModel schema = getGrammar(schemaURL);
setupDynamicContext(schema);
String xpath = "abs(X)";
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
XSInteger result = (XSInteger) rs.first();
String actual = result.getStringValue();
assertEquals("100", actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger in project webtools.sourceediting by eclipse.
the class TestBugs method testTypedValueEnhancement_BugUsingSeqIntoVariable_3.
public void testTypedValueEnhancement_BugUsingSeqIntoVariable_3() throws Exception {
// Bug 325262
setupDynamicContext(null);
ResultSequence rs = ResultSequenceFactory.create_new();
rs.add(new XSInteger(BigInteger.valueOf(2)));
rs.add(new XSInteger(BigInteger.valueOf(4)));
rs.add(new XSInteger(BigInteger.valueOf(6)));
setVariable("value", rs);
String xpath = "count(data($value)) = 3";
compileXPath(xpath);
ResultSequence rsRes = evaluate(domDoc);
XSBoolean result = (XSBoolean) rsRes.get(0);
assertEquals("true", result.getStringValue());
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger in project webtools.sourceediting by eclipse.
the class FnMinutesFromTime method minutes_from_time.
/**
* Minutes-from-Time operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of fn:minutes-from-time operation.
*/
public static ResultSequence minutes_from_time(Collection args) throws DynamicError {
Collection cargs = Function.convert_arguments(args, expected_args());
ResultSequence arg1 = (ResultSequence) cargs.iterator().next();
if (arg1.empty()) {
return ResultBuffer.EMPTY;
}
XSTime dt = (XSTime) arg1.first();
int res = dt.minute();
return new XSInteger(BigInteger.valueOf(res));
}
Aggregations