Examples of XQueryService


Examples of org.xmldb.api.modules.XQueryService

        queryAndAssert(service, query, 0, "");
    }
   
    @Test
    public void union() throws XMLDBException {
        final XQueryService service = getQueryService();

        String query = "()  union ()";
        queryAndAssert( service, query, 0, "");

        String message = "";
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService

        queryAndAssert(service, query, 2, "");
    }

    @Test
    public void except() throws XMLDBException {
        final XQueryService service = getQueryService();

        String query = "()  except ()";
        queryAndAssert(service, query, 0, "");

        query = "()  except  (1)";
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService

        queryAndAssert(service, query, 1, "");
    }

    @Test
    public void convertToBoolean() throws XMLDBException {
        final XQueryService service = getQueryService();
       

        ResourceSet result = queryAndAssert(
                service,
                "let $doc := <element attribute=''/>" + "return ("
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService

     * @throws XMLDBException
     */
    @Ignore
    @Test
    public void xpointerElementNameHandling() throws XMLDBException {
        final XQueryService service = storeXMLStringAndGetQueryService(
                "xpointer.xml", xpointerElementName);

        ResourceSet result = service.queryResource("xpointer.xml",
                "/test/.[local-name()='xpointer']");
        printResult(result);
        assertEquals(1, result.getSize());

        result = service.queryResource("xpointer.xml", "/test/xpointer");
        printResult(result);
        assertEquals(1, result.getSize());
    }
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService

        assertXMLEqual("<test><test:name xmlns:test=\"http://test.org\"/><test:name xmlns:test=\"http://test.org\"/></test>", result.getResource(0).getContent().toString());
    }

    @Test
    public void substring() throws XMLDBException {
        final XQueryService service = getQueryService();
       
        // Testcases by MIKA
        final String validQuery = "substring(\"MK-1234\", 4,1)";
        ResourceSet result = queryAndAssert( service, validQuery, 1, validQuery);
        assertEquals("1", result.getResource(0).getContent().toString());
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService

        return result;
    }

    /** For queries without associated data */
    private XQueryService getQueryService() throws XMLDBException {
        final XQueryService service = (XQueryService) testCollection.getService(
            "XPathQueryService", "1.0");
        return service;
    }
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService

        final XMLResource doc =
            (XMLResource) testCollection.createResource(
                documentName, "XMLResource" );
        doc.setContent(content);
        testCollection.storeResource(doc);
        final XQueryService service =
            (XQueryService) testCollection.getService(
                "XPathQueryService",
                "1.0");
        return service;
    }
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService

    @Test (expected=XMLDBException.class)
    public void manualRelease() throws XMLDBException {
        System.out.println("---manualRelease");
        Collection test = DatabaseManager.getCollection(baseURI + "/db/rpctest", "admin", "");
        XQueryService service = (XQueryService) test.getService("XQueryService", "1.0");
        ResourceSet result = service.query("//chapter[@xml:id = 'chapter1']");
        Assert.assertEquals(1, result.getSize());

        // clear should release the query result on the server
        result.clear();
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService

        }

        public void run() {
            try {
                Collection test = DatabaseManager.getCollection(baseURI + "/db/rpctest", "admin", "");
                XQueryService service = (XQueryService) test.getService("XQueryService", "1.0");
                int n = random.nextInt(DOC_COUNT) + 1;
                service.declareVariable("n", "chapter" + n);
                ResourceSet result = service.query(query);
                Assert.assertEquals(1, result.getSize());
            } catch (XMLDBException e) {
                e.printStackTrace();
                Assert.fail(e.getMessage());
            }
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService

  }

  public void testResourceSet() {
    try {
      String query = "//SPEECH[SPEAKER = 'HAMLET']";
      XQueryService service = (XQueryService) testCollection.getService("XQueryService", "1.0");
      service.setProperty("highlight-matches", "none");
      CompiledExpression compiled = service.compile(query);
      ResourceSet result = service.execute(compiled);
     
      assertEquals(result.getSize(), 359);
     
      for (int i = 0; i < result.getSize(); i++) {
        XMLResource r = (XMLResource) result.getResource(i);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.