use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.
the class GetRunningXQueriesTest method caller.
@Test
public void caller() throws XMLDBException, XpathException, IOException, SAXException {
final ResourceSet result = existXmldbEmbeddedServer.executeQuery("system:get-running-xqueries()");
assertNotNull(result);
final String resultDoc = (String) result.getResource(0).getContent();
assertXpathEvaluatesTo("1", "count(//@caller)", resultDoc);
}
use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.
the class Base64FunctionsTest method testBase64DecodeUrlSafe.
@Test
public void testBase64DecodeUrlSafe() throws XMLDBException {
final String query = "util:base64-decode( 'LsO_ZA' )";
final ResourceSet result = existXmldbEmbeddedServer.executeQuery(query);
final String r = (String) result.getResource(0).getContent();
assertEquals(".ÿd", r);
}
use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.
the class EvalTest method evalwithPI.
@Test
public void evalwithPI() throws XPathException, XMLDBException {
final String query = "let $query := 'let $a := <test><?pi test?></test> return count($a//processing-instruction())'\n" + "return\n" + "util:eval($query)";
final ResourceSet result = existEmbeddedServer.executeQuery(query);
final String r = (String) result.getResource(0).getContent();
assertEquals("1", r);
}
use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.
the class EvalTest method evalAndSerializeSubsequence.
@Test
public void evalAndSerializeSubsequence() throws XMLDBException {
final String query = "let $query := \"for $i in (1 to 10) return <i>{$i}</i>\"\n" + "return\n" + "util:eval-and-serialize($query, (), 1, 4)";
final ResourceSet result = existEmbeddedServer.executeQuery(query);
final Resource r = result.getResource(0);
assertEquals("<i>1</i><i>2</i><i>3</i><i>4</i>", r.getContent());
}
use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.
the class EvalTest method testEvalWithContextVariable.
@Test
public void testEvalWithContextVariable() throws XPathException, XMLDBException {
final String query = "let $xml := <test><a/><b/></test>\n" + "let $context := <static-context>\n" + "<variable name='xml'>{$xml}</variable>\n" + "</static-context>\n" + "let $query := 'count($xml//*) mod 2 = 0'\n" + "return\n" + "util:eval-with-context($query, $context, false())";
final ResourceSet result = existEmbeddedServer.executeQuery(query);
final String r = (String) result.getResource(0).getContent();
assertEquals("true", r);
}
Aggregations