Package org.xmldb.api.base

Examples of org.xmldb.api.base.ResourceSet


    try
    {
      Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
      XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
      ResourceSet resultSet = xpathservice.query(query);

      ResourceIterator results = resultSet.getIterator();

      List res = asList(results);
      assertEquals(1, res.size());
    }
    finally
View Full Code Here


        public Result runQuery() throws Exception {
            Collection col = IndexedSearchTest.this.client.getCollection(IndexedSearchTest.INDEXED_SEARCH_TEST_COLLECTION_PATH);
            XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");

            org.apache.xindice.Stopwatch aStopwatch = new org.apache.xindice.Stopwatch("Non-indexed starts-with query", true);
            ResourceSet resultSet = xpathservice.query(itsTestQuery);
            aStopwatch.stop();
            return new Result(resultSet, aStopwatch.elapsed());
        }
View Full Code Here

         *
         * @param theResult Result to check
         */
        public void checkResult(Result theResult) throws Exception {
            assertNotNull("Parameter theResult is null", theResult);
            ResourceSet aResourceSet = theResult.getResourceSet();
            assertNotNull("theResult contains a null ResourceSet", aResourceSet);
            if (itsExpectedResourceCount >= 0) {
                assertEquals("Result did not contain expected number of resources",
                             itsExpectedResourceCount, aResourceSet.getSize());
            }

            if (itsExpectedResources != null && itsExpectedResources.length > 1) {
                for (int anIndex = 0; anIndex < itsExpectedResources.length / 2; anIndex += 2) {
                    XMLResource aResource = (XMLResource) aResourceSet.getResource(anIndex);
                    Node aNode = aResource.getContentAsDOM();
                    int anExpectedSourceDocumentIndex = ((Integer) itsExpectedResources[anIndex]).intValue();
                    String anExpected = "<?xml version=\"1.0\"?>\n" + addSource((String) itsExpectedResources[anIndex + 1],
                                                                                TEST_DOCUMENT_PREFIX + anIndex,
                                                                                IndexedSearchTest.INDEXED_SEARCH_TEST_COLLECTION_PATH);
View Full Code Here

  {
    String query = "//person[last='Smith']";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
    assertEquals(2, res.size());
  }
View Full Code Here

  {
    String query = "//person[first='John' and last='Smith']";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
    assertEquals(1, res.size());
  }
View Full Code Here

  {
    String query = "//person[first='John' or last='Smith']";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
    assertEquals(2, res.size());
  }
View Full Code Here

  {
    String query = "//person[first='John' or first='Sally']";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
    assertEquals(2, res.size());
  }
View Full Code Here

  {
    String query = "//person[last='Smith' and (first='John' or first='Sally')]";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
    assertEquals(2, res.size());
  }
View Full Code Here

    // search all records whose last name contains 'Smi'
    String query = "//person[contains(last, 'Smi')]";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();
    List res = asList(results);
    assertEquals(2, res.size());
  }
View Full Code Here

    // search all records whose last name begins with 'Smi'
    String query = "//person[(string-length(//person/last) >= 3) and (substring(//person/last, 1, 3)='Smi')]";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();
    List res = asList(results);
    assertEquals(2, res.size());

    this.client.removeDocument(TEST_COLLECTION_PATH, "doc3");
  }
View Full Code Here

TOP

Related Classes of org.xmldb.api.base.ResourceSet

Copyright © 2018 www.massapicom. 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.