use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class CompAxisTest method testComp.
@Test
public void testComp() throws SirixException {
final AbstractAxis axis1 = new XPathAxis(holder.getReader(), "1.0 = 1.0");
assertEquals(true, axis1.hasNext());
axis1.next();
assertEquals(true, Boolean.parseBoolean(holder.getReader().getValue()));
assertEquals(false, axis1.hasNext());
final AbstractAxis axis2 = new XPathAxis(holder.getReader(), "(1, 2, 3) < (2, 3)");
assertEquals(true, axis2.hasNext());
axis2.next();
assertEquals(true, Boolean.parseBoolean(holder.getReader().getValue()));
assertEquals(false, axis2.hasNext());
final AbstractAxis axis3 = new XPathAxis(holder.getReader(), "(1, 2, 3) > (3, 4)");
assertEquals(true, axis3.hasNext());
axis3.next();
assertEquals(false, Boolean.parseBoolean(holder.getReader().getValue()));
assertEquals(false, axis3.hasNext());
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class FunctionAxisTest method testFunctions.
@Test
public void testFunctions() throws SirixException {
holder.getReader().moveTo(1L);
final AbstractAxis axis1 = new XPathAxis(holder.getReader(), "fn:count(text())");
assertEquals(true, axis1.hasNext());
axis1.next();
assertEquals(3, Integer.parseInt(holder.getReader().getValue()));
assertEquals(false, axis1.hasNext());
final AbstractAxis axis2 = new XPathAxis(holder.getReader(), "fn:count(//node())");
assertEquals(true, axis2.hasNext());
axis2.next();
assertEquals(10, Integer.parseInt(holder.getReader().getValue()));
assertEquals(false, axis2.hasNext());
final AbstractAxis axis3 = new XPathAxis(holder.getReader(), "fn:string(//node())");
assertEquals(true, axis3.hasNext());
axis3.next();
assertEquals("oops1 foo oops2 bar oops3 oops1 foo oops2 bar oops3 foo bar", holder.getReader().getValue());
assertEquals(false, axis3.hasNext());
final AbstractAxis axis4 = new XPathAxis(holder.getReader(), "fn:string()");
assertEquals(true, axis4.hasNext());
axis4.next();
assertEquals("oops1 foo oops2 bar oops3", holder.getReader().getValue());
assertEquals(false, axis4.hasNext());
final AbstractAxis axis5 = new XPathAxis(holder.getReader(), "fn:string(./attribute::attribute())");
assertEquals(true, axis5.hasNext());
axis5.next();
assertEquals("j", holder.getReader().getValue());
assertEquals(false, axis5.hasNext());
holder.getReader().moveToAttribute(0);
final AbstractAxis axis6 = new XPathAxis(holder.getReader(), "fn:string()");
assertEquals(true, axis6.hasNext());
axis6.next();
assertEquals("j", holder.getReader().getValue());
assertEquals(false, axis6.hasNext());
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class FunctionsXMarkTest method testSum.
/**
* Test function sum().
*
* @throws SirixXPathException
*/
@Ignore
@Test
public final void testSum() throws SirixXPathException {
final String query = "fn:sum(/site/open_auctions/open_auction/bidder/increase/text())";
final String result = "96496.5";
XPathStringChecker.testIAxisConventions(new XPathAxis(holder.getReader(), query), new String[] { result });
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class FunctionsXMarkTest method testComment.
/**
* Test comment.
*
* @throws SirixXPathException
*/
@Ignore
@Test
public final void testComment() throws SirixXPathException {
final String query = "2 (: this is a comment :)";
final String result = "2";
XPathStringChecker.testIAxisConventions(new XPathAxis(holder.getReader(), query), new String[] { result });
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class FunctionsXMarkTest method testSubstringBefore.
/**
* Test function substring-before().
*
* @throws SirixXPathException
*/
@Ignore
@Test
public final void testSubstringBefore() throws SirixXPathException {
final String query = "fn:substring-before(\"query\", \"r\")";
final String result = "que";
XPathStringChecker.testIAxisConventions(new XPathAxis(holder.getReader(), query), new String[] { result });
}
Aggregations