Package com.google.enterprise.connector.spi

Examples of com.google.enterprise.connector.spi.DocumentList

Boundary cases are important for {@link #checkpoint()}: The typical pattern for consuming an object that implements this interface is as follows (disregarding exception handling):
 DocumentList docList = ... Document doc; while (doc = docList.nextDocument()) { handleDoc(doc); if (whatever reason) break; } String check = doclist.checkpoint(); 
Note: because of the restriction that the next call to {@link #nextDocument()} invalidates the previous Document, and thereare similar restrictions in the {@link Document} interface, it is possibleto provide a single stateful object that implements {@link DocumentList}, {@link Document} and {@link Property}, by returning {@code this}(or {@code null}) to all calls to {@link #nextDocument()} and{@link Document#findProperty(String)}. However, if preferred, the implementor may also use separate objects for each of those interfaces. @since 1.0

    qtm = (DctmTraversalManager) session.getTraversalManager();
  }

  public void testStartTraversal() throws RepositoryException {
    qtm.setBatchHint(DmInitialize.DM_RETURN_TOP_UNBOUNDED);
    DocumentList documentList = qtm.startTraversal();

    int counter = 0;
    while (documentList.nextDocument() != null) {
      counter++;
    }
    assertEquals(DmInitialize.DM_RETURN_TOP_UNBOUNDED, counter);
  }
View Full Code Here


  public void testResumeTraversal() throws RepositoryException {
    String checkPoint =
        "{\"uuid\":\"doc2\",\"lastModified\":\"1969-01-01 01:00:00.010\"}";
    qtm.setBatchHint(DmInitialize.DM_RETURN_TOP_BOUNDED);
    DocumentList documentList = qtm.resumeTraversal(checkPoint);

    assertNotNull(documentList);
    int counter = 0;
    while (documentList.nextDocument() != null) {
      counter++;
    }
    assertEquals(DmInitialize.DM_RETURN_TOP_BOUNDED, counter);
  }
View Full Code Here

  }

  public void testGetDocumentList_start() throws RepositoryException {
    MockTraversalManager mtm = new MockTraversalManager();

    DocumentList documentList = mtm.startTraversal();
    assertNotNull(documentList);
    assertEquals(1, mtm.count);
  }
View Full Code Here

    // The nulls in the checkpoint simulate new content with our execQuery stub.
    MockTraversalManager mtm = new MockTraversalManager();
    String checkpoint =
        "{index:0,uuid:[null,'one'],lastModified=[null,'2010-04-01 00:01:00']}";

    DocumentList documentList = mtm.resumeTraversal(checkpoint);
    assertNotNull(documentList);
    assertEquals(1, mtm.count);
  }
View Full Code Here

  public void testGetDocumentList_resumeSecond() throws RepositoryException {
    MockTraversalManager mtm = new MockTraversalManager();
    String checkpoint =
        "{index:1, uuid:['one'],lastModified=['2010-04-01 00:01:00']}";

    DocumentList documentList = mtm.resumeTraversal(checkpoint);
    assertNotNull(documentList);
    assertEquals(1, mtm.count);
  }
View Full Code Here

    // The nulls in the checkpoint simulate new content with our execQuery stub.
    MockTraversalManager mtm = new MockTraversalManager();
    String checkpoint =
        "{index:0,uuid:['one',null],lastModified=['2010-04-01 00:01:00',null]}";

    DocumentList documentList = mtm.resumeTraversal(checkpoint);
    assertNotNull(documentList);
    assertEquals(2, mtm.count);
  }
View Full Code Here

    // The nulls in the checkpoint simulate new content with our execQuery stub.
    MockTraversalManager mtm = new MockTraversalManager();
    String checkpoint =
        "{index:1,uuid:[null,'one'],lastModified=[null,'2010-04-01 00:01:00']}";

    DocumentList documentList = mtm.resumeTraversal(checkpoint);
    assertNotNull(documentList);
    assertEquals(2, mtm.count);
  }
View Full Code Here

  public void testGetDocumentList_resumeAcls() throws RepositoryException {
    MockTraversalManager mtm = new MockTraversalManager();
    String checkpoint = "{index:0,uuid:['one','another'],"
        + "lastModified=['2010-04-01 00:01:00','2010-10-27 22:55:03']}";

    DocumentList documentList = mtm.resumeTraversal(checkpoint);
    assertNotNull(documentList);
    assertEquals(3, mtm.count);
  }
View Full Code Here

  public void testGetDocumentList_end() throws RepositoryException {
    MockTraversalManager mtm = new MockTraversalManager();
    String checkpoint = "{index:0,aclid:'id1',uuid:['one','another'],"
        + "lastModified=['2010-04-01 00:01:00','2010-10-27 22:55:03']}";

    DocumentList documentList = mtm.resumeTraversal(checkpoint);
    assertNull(documentList);
    assertEquals(3, mtm.count);
  }
View Full Code Here

  public void testGetDocumentList_newAcls()
      throws RepositoryException {
    MockTraversalManager mtm = new MockTraversalManager();
    String checkpoint =
        "{uuid:['one'],lastModified:['2010-04-01 00:01:00'], index:0}";
    DocumentList documentList = mtm.resumeTraversal(checkpoint);
    assertNotNull(documentList);
    assertEquals(2, mtm.count);
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.spi.DocumentList

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.