Search in sources :

Example 26 with ResourceSet

use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.

the class JaxpXsdCatalogTest method executeAndEvaluate.

private void executeAndEvaluate(final String query, final String expectedValue) throws XMLDBException, SAXException, IOException, XpathException {
    final ResourceSet results = existEmbeddedServer.executeQuery(query);
    assertEquals(1, results.getSize());
    final String r = (String) results.getResource(0).getContent();
    assertXpathEvaluatesTo(expectedValue, "//status/text()", r);
}
Also used : ResourceSet(org.xmldb.api.base.ResourceSet)

Example 27 with ResourceSet

use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.

the class JaxpXsdCatalogTest method clearGrammarCache.

@Before
public void clearGrammarCache() throws XMLDBException {
    final ResourceSet results = existEmbeddedServer.executeQuery("validation:clear-grammar-cache()");
    results.getResource(0).getContent();
}
Also used : ResourceSet(org.xmldb.api.base.ResourceSet)

Example 28 with ResourceSet

use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.

the class SwitchTest method oneCaseCaseMatch.

@Test
public void oneCaseCaseMatch() throws XMLDBException {
    final String query = "xquery version '3.0';" + "let $animal := 'Cat' return " + "switch ($animal)" + "case 'Cow' return 'Moo'" + "case 'Cat' return 'Meow'" + "case 'Duck' return 'Quack'" + "default return 'Odd noise!'";
    final ResourceSet results = existEmbeddedServer.executeQuery(query);
    final String r = (String) results.getResource(0).getContent();
    assertEquals("Meow", r);
}
Also used : ResourceSet(org.xmldb.api.base.ResourceSet) Test(org.junit.Test)

Example 29 with ResourceSet

use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.

the class SwitchTest method twoCaseCaseMatch.

@Test
public void twoCaseCaseMatch() throws XMLDBException {
    final String query = "xquery version '3.0';" + "let $animal := 'Calf' return " + "switch ($animal)" + "case 'Cow' case 'Calf' return 'Moo'" + "case 'Cat' return 'Meow'" + "case 'Duck' return 'Quack'" + "default return 'Odd noise!'";
    final ResourceSet results = existEmbeddedServer.executeQuery(query);
    final String r = (String) results.getResource(0).getContent();
    assertEquals("Moo", r);
}
Also used : ResourceSet(org.xmldb.api.base.ResourceSet) Test(org.junit.Test)

Example 30 with ResourceSet

use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.

the class BaseConverterTest method testBaseConverterIntToHex.

@Test
public void testBaseConverterIntToHex() throws XMLDBException {
    final String query = "util:integer-to-base(10, 16)";
    final ResourceSet result = existXmldbEmbeddedServer.executeQuery(query);
    final String r = (String) result.getResource(0).getContent();
    assertEquals("a", r);
}
Also used : ResourceSet(org.xmldb.api.base.ResourceSet) Test(org.junit.Test)

Aggregations

ResourceSet (org.xmldb.api.base.ResourceSet)383 XPathQueryService (org.xmldb.api.modules.XPathQueryService)123 Test (org.junit.Test)117 EXistXPathQueryService (org.exist.xmldb.EXistXPathQueryService)100 XMLResource (org.xmldb.api.modules.XMLResource)80 Collection (org.xmldb.api.base.Collection)55 Resource (org.xmldb.api.base.Resource)45 XQueryService (org.xmldb.api.modules.XQueryService)29 XMLDBException (org.xmldb.api.base.XMLDBException)23 EXistResource (org.exist.xmldb.EXistResource)20 BinaryResource (org.xmldb.api.modules.BinaryResource)17 CollectionManagementService (org.xmldb.api.modules.CollectionManagementService)14 Node (org.w3c.dom.Node)11 IndexQueryService (org.exist.xmldb.IndexQueryService)9 Diff (org.xmlunit.diff.Diff)9 EXistCollectionManagementService (org.exist.xmldb.EXistCollectionManagementService)8 UserManagementService (org.exist.xmldb.UserManagementService)8 Source (javax.xml.transform.Source)7 ResourceIterator (org.xmldb.api.base.ResourceIterator)7 XUpdateQueryService (org.xmldb.api.modules.XUpdateQueryService)6