Package com.google.enterprise.connector.spi

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


    // Get the first set of documents.
    tm.setBatchHint(20);
    DocumentList docList = tm.startTraversal();
    assertNotNull("startTraversal returned a null document list", docList);
    while (docList != null) {
      Document doc;
      while (null != (doc = docList.nextDocument())) {
        documents.add((NotesConnectorDocument) doc);
      }
      String checkpoint = docList.checkpoint();
      // Resume traversal.
View Full Code Here


    assertTrue(tm instanceof NotesTraversalManager);

    // Get the first set of documents.
    tm.setBatchHint(5);
    DocumentList docList = tm.startTraversal();
    Document doc;
    String checkpoint = null;
    List<String> docIdList = new ArrayList<String>(10);
    assertNotNull("startTraversal returned a null document list", docList);
    while (null != (doc = docList.nextDocument())) {
      String docId = doc.findProperty(SpiConstants.PROPNAME_DOCID)
          .nextValue().toString();
      assertNotNull("Missing doc id", docId);
      docIdList.add(docId);
    }
    checkpoint = docList.checkpoint();
    assertNotNull("Checkpoint was null", checkpoint);
    assertTrue("No docs found", docIdList.size() > 0);

    // Resume traversal.
    tm.setBatchHint(5);
    docList = tm.resumeTraversal(checkpoint);
    while (null != (doc = docList.nextDocument())) {
      String docId = doc.findProperty(SpiConstants.PROPNAME_DOCID).
          nextValue().toString();
      assertNotNull("Missing doc id", docId);
      assertFalse("Found same docid in new doc list: " + docId,
          docIdList.contains(docId));
    }
View Full Code Here

    List<String> duplicatesFirstTraversal = new ArrayList<String>(100);
    // Get the first set of documents.
    tm.setBatchHint(20);
    DocumentList docList = tm.startTraversal();
    while (docList != null) {
      Document doc = null;
      while (null != (doc = docList.nextDocument())) {
        String docId = doc.findProperty(SpiConstants.PROPNAME_DOCID).
            nextValue().toString();
        if (!docIdListFirstTraversal.add(docId)) {
          duplicatesFirstTraversal.add(docId);
        }
      }
      String checkpoint = docList.checkpoint();
      assertNotNull("Checkpoint was null", checkpoint);

      // Resume traversal.
      tm.setBatchHint(20);
      docList = tm.resumeTraversal(checkpoint);
    }
    assertTrue("No documents traversed", docIdListFirstTraversal.size() > 0);
    // TODO: do we want to investigate the presence of duplicates?
    //if (duplicatesFirstTraversal.size() > 0) {
    //  System.out.println("Found duplicates during first traversal: " +
    //      duplicatesFirstTraversal.size());
    //}

    Set<String> docIdListSecondTraversal = new HashSet<String>(100);
    List<String> duplicatesSecondTraversal = new ArrayList<String>(100);
    // Get the second set of documents.
    tm.setBatchHint(20);
    docList = tm.startTraversal();
    while (docList != null) {
      Document doc = null;
      while (null != (doc = docList.nextDocument())) {
        String docId = doc.findProperty(SpiConstants.PROPNAME_DOCID).
            nextValue().toString();
        if (!docIdListSecondTraversal.add(docId)) {
          duplicatesSecondTraversal.add(docId);
        }
      }
View Full Code Here

    // Get the first set of documents.
    tm.setBatchHint(25);
    DocumentList docList = tm.startTraversal();
    assertNotNull("startTraversal returned a null document list", docList);
    Document doc;
    while (null != (doc = docList.nextDocument())) {
      String docId = doc.findProperty(SpiConstants.PROPNAME_DOCID).
          nextValue().toString();
      if (docId.contains(("/$File/"))) {
        assertNotNull("Missing attachment filename " + docId,
            doc.findProperty(NCCONST.PROPNAME_NCATTACHMENTFILENAME));
      } else {
        assertNull("Has attachment filename " + docId,
            doc.findProperty(NCCONST.PROPNAME_NCATTACHMENTFILENAME));
      }
    }
  }
View Full Code Here

    loadProperties();
  }
 
  public Document nextDocument() throws RepositoryException {
    try {
      Document doc = null;
      do {
        doc = traversalStep();
      } while (doc == null);
      return doc;
    } catch (NoMoreStepsException nmse) {
View Full Code Here

    // one user
    users.add("a");
    // one entry
    entries.add(getEntryWithId(nonceId));
   
    Document doc = docList.nextDocument();
    assertNotNull(doc);
    assertTrue(hasId(doc, nonceId));
  }
View Full Code Here

    entry.setUpdated(dt);
    entry.addHtmlLink(uri, "en", "example");
    entry.setContent(
        TextConstruct.create(TextConstruct.Type.TEXT, contentNonce, null));
   
    Document doc = null;
    try {
      doc = EntryDocumentizer.makeDocument(entry);
    } catch (RepositoryException re) {
      fail(re.toString());
    }
View Full Code Here

    int counter = 0;

    while (true) {
      counter = 0;
      Document pm = null;
      while ((pm = documentList.nextDocument()) != null) {
        System.out.println("pm change");
        counter++;

        if (counter == batchHint) {
          System.out.println("counter == batchhint !!!!");
          // this test program only takes batchHint results from each
          // resultSet. The real connector manager may take fewer -
          // for example, if it receives a shutdown request
          break;
        }
        int k = pm.getPropertyNames().size();
        System.out.println("counter " + counter + ",  num properties " + k);
        System.out.println(pm.findProperty(
            SpiConstants.PROPNAME_DISPLAYURL).nextValue());
        push.take(pm);
      }
      String checkpoint = "";
      if (counter != 0) {
View Full Code Here

  /*
   * Test method for
   * 'com.google.enterprise.connector.dctm.DctmDocumentList.nextDocument()'
   */
  public void testNextDocument() throws RepositoryException {
    Document doc = null;
    int counter = 0;
    while ((doc = documentList.nextDocument()) != null) {
      assertTrue(doc instanceof DctmSysobjectDocument);
      counter++;
    }
View Full Code Here

    this.checkpoint = checkpoint;
  }

  @Override
  public Document nextDocument() throws RepositoryException {
    Document retAclDocument;
    Document retDoc = null;
    boolean skippingDoc = false;
    try {
      while (retDoc == null) {
        if (requiredGroupAclStack != null
            && !requiredGroupAclStack.isEmpty()) {
View Full Code Here

TOP

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

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.