Package com.google.enterprise.connector.spi

Examples of com.google.enterprise.connector.spi.DocumentList.nextDocument()


  public void testStartTraversal() throws RepositoryException {
    TraversalManager trav = session.getTraversalManager();
    trav.setBatchHint(500);
    DocumentList docList = trav.startTraversal();
    assertNotNull(docList);
    Document doc = docList.nextDocument();
    assertNotNull(doc);
    while (doc != null) {
      Property propDocId = doc.findProperty(SpiConstants.PROPNAME_DOCID);
      assertNotNull(propDocId);
      assertTrue(propDocId.nextValue().toString().contains("social"));
View Full Code Here


    assertNotNull(doc);
    while (doc != null) {
      Property propDocId = doc.findProperty(SpiConstants.PROPNAME_DOCID);
      assertNotNull(propDocId);
      assertTrue(propDocId.nextValue().toString().contains("social"));
      doc = docList.nextDocument();
    }
  }

}
View Full Code Here

    TraversalManager qtm = new JcrTraversalManager(qm);
    MockPusher pusher = new MockPusher(System.out);
    DocumentList documentList = qtm.startTraversal();
    int counter = 0;
    Document document = null;
    while ((document = documentList.nextDocument()) != null) {
      pusher.take(document);
      counter++;
    }
    Assert.assertEquals(4, counter);
    Assert.assertEquals(4, pusher.getTotalDocs());
View Full Code Here

  public void testInactive() {
    try {
      DocumentList docs = tm.startTraversal();
      tm.deactivate();
      docs.nextDocument();
      fail("DocumentList stayed active despite inactive TraversalManager.");
    } catch (RepositoryException re) {
      assertTrue(re.getMessage().contains(
          "Inactive FileTraversalManager referanced."));
    }
View Full Code Here

      assertEquals(0, monitorManager.getCleanCount());
      assertEquals(1, monitorManager.getGuaranteeCount());
    }

    for (int k = 0; k < BATCH_SIZE; ++k) {
      Document doc = docs.nextDocument();
      assertNotNull(doc);
    }
    assertNull(docs.nextDocument());

    // TODO: Investigate: this loop looks weird cause it goes for BATCH_COUNT-1.
View Full Code Here

    for (int k = 0; k < BATCH_SIZE; ++k) {
      Document doc = docs.nextDocument();
      assertNotNull(doc);
    }
    assertNull(docs.nextDocument());

    // TODO: Investigate: this loop looks weird cause it goes for BATCH_COUNT-1.
    for (int batch = 1; batch < BATCH_COUNT; batch++) {
      docs = tm.resumeTraversal(docs.checkpoint());
      assertEquals(1 + batch, monitorManager.getGuaranteeCount());
View Full Code Here

    // TODO: Investigate: this loop looks weird cause it goes for BATCH_COUNT-1.
    for (int batch = 1; batch < BATCH_COUNT; batch++) {
      docs = tm.resumeTraversal(docs.checkpoint());
      assertEquals(1 + batch, monitorManager.getGuaranteeCount());
      for (int k = 0; k < BATCH_SIZE; ++k) {
        Document doc = docs.nextDocument();
        assertNotNull(doc);
        String docId = Value.getSingleValueString(doc, SpiConstants.PROPNAME_DOCID);
        assertEquals(String.format("/foo/bar/file.%d", batch * BATCH_SIZE + k),
            docId);
      }
View Full Code Here

        assertNotNull(doc);
        String docId = Value.getSingleValueString(doc, SpiConstants.PROPNAME_DOCID);
        assertEquals(String.format("/foo/bar/file.%d", batch * BATCH_SIZE + k),
            docId);
      }
      assertNull(docs.nextDocument());
    }

    docs = tm.resumeTraversal(docs.checkpoint());
    for (int k = 0; k < EXTRA; ++k) {
      assertNotNull(docs.nextDocument());
View Full Code Here

      assertNull(docs.nextDocument());
    }

    docs = tm.resumeTraversal(docs.checkpoint());
    for (int k = 0; k < EXTRA; ++k) {
      assertNotNull(docs.nextDocument());
    }
    assertNull(docs.nextDocument());
  }
}
View Full Code Here

    docs = tm.resumeTraversal(docs.checkpoint());
    for (int k = 0; k < EXTRA; ++k) {
      assertNotNull(docs.nextDocument());
    }
    assertNull(docs.nextDocument());
  }
}
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.