Examples of 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
  • edu.harvard.wcfia.yoshikoder.document.DocumentList
    @author will
  • org.openntf.domino.impl.DocumentList

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

      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

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

      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

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

      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

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

        traversalContext.setTraversalTimeLimitSeconds(1);
        mtm.setTraversalContext(traversalContext);
        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);
        assertNull(documentList.nextDocument());
        assertNotNull(documentList.checkpoint()); // It's not MockDocumentList.
        assertEquals(1, mtm.count); // Would have been 2 without the timeout.
      }
    View Full Code Here

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

       * Test method for
       * 'com.google.enterprise.connector.dctm.DctmDocumentList.nextDocument()'
       */
      public void testNextDocument() throws RepositoryException {
        int counter = 0;
        DocumentList propertyMapList = qtm.startTraversal();
        Document pm = null;
        Property prop = null;

        while ((pm = propertyMapList.nextDocument()) != null) {

          assertTrue(pm instanceof DctmSysobjectDocument);
          prop = pm.findProperty(SpiConstants.PROPNAME_DOCID);

          assertNotNull(prop);
    View Full Code Here

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

       */
      public void testCheckpoint() throws RepositoryException {
        String checkPoint = null;

        int counter = 0;
        DocumentList propertyMapList = qtm.startTraversal();

        while ((propertyMapList.nextDocument()) != null) {
          counter++;
        }
        assertEquals(DmInitialize.DM_RETURN_TOP_UNBOUNDED, counter);

        // XXX: This time comes back as if the timestamp value were in
        // seconds, but in MockDmTimeTest we get milliseconds. Also, this
        // time is local time. Should it be UTC?
        SimpleDateFormat iso8601 =
          new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String lastModified = iso8601.format(new Date(260 * 1000));

        checkPoint = propertyMapList.checkpoint();
        assertTrue(checkPoint,
            checkPoint.indexOf("\"uuid\":[\"doc26\"]") != -1);
        assertTrue(checkPoint,
            checkPoint.indexOf("\"lastModified\":[\"" + lastModified + "\"]") != -1);
      }
    View Full Code Here

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

       * Tests document containing no parent ACL document, no inherit-from field.
       */
      @Test
      public void documentContainsDirectDefaultAcls() throws Exception {
        String[][] data = {{expectedId, timeStr}};
        @SuppressWarnings("unchecked") DocumentList doclist =
            getDocumentList(data, directAces, defaultAces);

        Document doc = doclist.nextDocument();
        assertTrue(doc instanceof FileDocument);
        Property inheritFrom =
            doc.findProperty(SpiConstants.PROPNAME_ACLINHERITFROM_DOCID);
        assertNull(inheritFrom);
        assertDocContainsDirectDefaultAces(doc, 0);

        assertNull("Document should not have TMPL or FLDR ACL document",
            doclist.nextDocument());
      }
    View Full Code Here

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

       * existed.
       */
      @Test
      public void documentContainsDirectDefaultTemplateAcls() throws Exception {
        String[][] data = {{expectedId, timeStr}};
        @SuppressWarnings("unchecked") DocumentList doclist =
            getDocumentList(data, directAces, defaultAces, templateAces);

        Document doc = doclist.nextDocument();
        assertTrue(doc instanceof FileDocument);
        assertDocInheritFrom(doc, expectedId + AclDocument.SEC_POLICY_POSTFIX);
        assertDocContainsDirectDefaultAces(doc, 0);

        Document acl = doclist.nextDocument();
        assertTrue(acl instanceof AclDocument);
        assertEquals(expectedId + AclDocument.SEC_POLICY_POSTFIX,
            Value.getSingleValueString(acl, SpiConstants.PROPNAME_DOCID));
        assertAclContainsAces(acl, PermissionSource.SOURCE_TEMPLATE, 0);

        assertNull(doclist.nextDocument());
      }
    View Full Code Here

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

       * existed.
       */
      @Test
      public void documentContainsDirectDefaultParentAcls() throws Exception {
        String[][] data = {{expectedId, timeStr}};
        @SuppressWarnings("unchecked") DocumentList doclist =
            getDocumentList(data, directAces, defaultAces, parentAces);

        Document doc = doclist.nextDocument();
        assertTrue(doc instanceof FileDocument);
        assertDocInheritFrom(doc, expectedId + AclDocument.SEC_FOLDER_POSTFIX);
        assertDocContainsDirectDefaultAces(doc, 0);

        Document acl = doclist.nextDocument();
        assertTrue(acl instanceof AclDocument);
        assertEquals(expectedId + AclDocument.SEC_FOLDER_POSTFIX,
            Value.getSingleValueString(acl, SpiConstants.PROPNAME_DOCID));
        assertAclContainsAces(acl, PermissionSource.SOURCE_PARENT, 0);

        assertNull(doclist.nextDocument());
      }
    View Full Code Here

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

       */
      @Test
      public void documentContainsDirectDefaultTemplateParentAcls()
          throws Exception {
        String[][] data = {{expectedId, timeStr}};
        @SuppressWarnings("unchecked") DocumentList doclist =
            getDocumentList(data, directAces, defaultAces, templateAces,
                parentAces);

        Document doc = doclist.nextDocument();
        assertTrue(doc instanceof FileDocument);
        assertDocInheritFrom(doc, expectedId + AclDocument.SEC_POLICY_POSTFIX);
        assertDocContainsDirectDefaultAces(doc, 0);

        Document fldrAcl = doclist.nextDocument();
        assertTrue(fldrAcl instanceof AclDocument);
        assertAclContainsAces(fldrAcl, PermissionSource.SOURCE_PARENT, 0);

        Document tmplAcl = doclist.nextDocument();
        assertTrue(tmplAcl instanceof AclDocument);
        assertDocInheritFrom(tmplAcl, expectedId + AclDocument.SEC_FOLDER_POSTFIX);
        assertAclContainsAces(tmplAcl, PermissionSource.SOURCE_TEMPLATE, 0);

        assertNull(doclist.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.