Package com.google.enterprise.connector.spi

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


  }

  public static List<Document> traverseAll(NotesConnectorSession
      connectorSession) throws RepositoryLoginException, RepositoryException {
    ArrayList<Document> documents = new ArrayList<Document>();
    TraversalManager tm = ConnectorFixture.getTraversalManager(
        connectorSession);
    // 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.
      tm.setBatchHint(20);
      docList = tm.resumeTraversal(checkpoint);
    }
    return documents;
  }
View Full Code Here


   * @throws RepositoryException
   */
  public void testTraversalReturnsNewDocumentsOnResume()
      throws RepositoryLoginException, RepositoryException {
    NotesConnectorSession session = (NotesConnectorSession) connector.login();
    TraversalManager tm = ConnectorFixture.getTraversalManager(session);
    assertNotNull(tm);
    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,
View Full Code Here

   * and return the list of docid values.
   */
  public void testTraverseAllDocuments()
      throws RepositoryLoginException, RepositoryException {
    Session session = connector.login();
    TraversalManager tm = ConnectorFixture.getTraversalManager(
        (NotesConnectorSession) session);

    Set<String> docIdListFirstTraversal = new HashSet<String>(100);
    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);
        }
      }
      String checkpoint = docList.checkpoint();
      assertNotNull("Checkpoint was null", checkpoint);

      // Resume traversal.
      tm.setBatchHint(20);
      docList = tm.resumeTraversal(checkpoint);
    }
    assertTrue("No documents traversed on second traversal",
        docIdListSecondTraversal.size() > 0);

    assertEquals("Set of documents in first and second traversals differ",
View Full Code Here

   */
  // TODO: use a known test database with attachments.
  public void testTraversalCheckAttachments()
      throws RepositoryLoginException, RepositoryException {
    Session session = connector.login();
    TraversalManager tm = ConnectorFixture.getTraversalManager(
        (NotesConnectorSession) session);

    // 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();
View Full Code Here

    try {
      Connector connector = new AfydConnector(null, "ignored.properties", null);
      Session session = connector.login();
      AuthenticationManager authnManager = session.getAuthenticationManager();
      AuthorizationManager authzManager = session.getAuthorizationManager();
      TraversalManager traversalManager = session.getTraversalManager();
    } catch (ClassCastException cce) {
      Assert.fail(cce.toString());
    } catch (RepositoryException re) {
      // this is OK to throw
    }
View Full Code Here

      /**
       * End simulation
       */

      Session session = connector.login();
      TraversalManager qtm = session.getTraversalManager();
      DctmTraversalUtil.runTraversal(qtm, 10);
    } catch (RepositoryLoginException le) {
      System.out.println("Root Cause : " + le.getCause()
          + " ; Message : " + le.getMessage());
    } catch (RepositoryException re) {
View Full Code Here

    connector.setIs_public("false");
    dctmSession = (DctmSession) connector.login();
  }

  public void testGetQueryTraversalManager() throws RepositoryException {
    TraversalManager dctmQm = dctmSession.getTraversalManager();
    String serverUrl = ((DctmTraversalManager) dctmQm).getServerUrl();
    assertNotNull(dctmQm);

    assertEquals(DmInitialize.DM_WEBTOP_SERVER_URL, serverUrl);
  }
View Full Code Here

    connector.setClientX(DmInitialize.DM_CLIENTX);
    connector.setWebtop_display_url(DmInitialize.DM_WEBTOP_SERVER_URL);
    connector.setIs_public("false");
    Session session = connector.login();
    assertNotNull(session);
    TraversalManager qtm = session.getTraversalManager();
    assertNotNull(qtm);
    assertEquals(DmInitialize.DM_WEBTOP_SERVER_URL,
        ((DctmTraversalManager) qtm).getServerUrl());
  }
View Full Code Here

    connector.setClientX(DmInitialize.DM_CLIENTX);
    connector.setWebtop_display_url(DmInitialize.DM_WEBTOP_SERVER_URL);
    connector.setIs_public("true");
    Session session = connector.login();
    assertNotNull(session);
    TraversalManager qtm = session.getTraversalManager();
    assertNotNull(qtm);
    assertEquals(DmInitialize.DM_WEBTOP_SERVER_URL,
        ((DctmTraversalManager) qtm).getServerUrl());
  }
View Full Code Here

    connector.setIs_public("false");
    dctmSession = (DctmSession) connector.login();
  }

  public void testGetQueryTraversalManager() throws RepositoryException {
    TraversalManager DctmQm = dctmSession.getTraversalManager();
    String serverUrl = ((DctmTraversalManager) DctmQm).getServerUrl();
    assertNotNull(DctmQm);

    assertEquals(serverUrl, DmInitialize.DM_WEBTOP_SERVER_URL);
  }
View Full Code Here

TOP

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

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.