Package com.google.enterprise.connector.spi

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


   * @return a Traverser instance
   */
  private Traverser createTraverser(MockRepositoryEventList mrel) {
    MockRepository r = new MockRepository(mrel);
    QueryManager qm = new MockJcrQueryManager(r.getStore());
    TraversalManager qtm = new JcrTraversalManager(qm);
    Traverser traverser = new QueryTraverser(new MockPusher(System.out), qtm,
        stateStore, connectorName, traversalContext, clock);
    instantiator.setupTraverser(connectorName, traverser);
    return traverser;
  }
View Full Code Here


  public void testResumeTraversal() throws RepositoryException {
    MockRepositoryEventList mrel =
        new MockRepositoryEventList("MockRepositoryEventLog1.txt");
    MockRepository r = new MockRepository(mrel);
    QueryManager qm = new MockJcrQueryManager(r.getStore());
    TraversalManager qtm = new JcrTraversalManager(qm);

    {
      MockRepositoryDocument mockDoc = r.getStore().getDocByID("doc2");
      Document doc = new JcrDocument(new MockJcrNode(mockDoc));
      String checkpointString = JcrDocumentList.checkpoint(doc);
      DocumentList documentList = qtm.resumeTraversal(checkpointString);
      int counter = countDocuments(documentList);
      Assert.assertEquals(2, counter);
    }

    {
      MockRepositoryDocument mockDoc = r.getStore().getDocByID("doc4");
      Document doc = new JcrDocument(new MockJcrNode(mockDoc));
      String checkpointString = JcrDocumentList.checkpoint(doc);
      DocumentList documentList = qtm.resumeTraversal(checkpointString);
      int counter = countDocuments(documentList);
      Assert.assertEquals(0, counter);
    }
  }
View Full Code Here

  public void testStartTraversal() throws RepositoryException {
    MockRepositoryEventList mrel =
        new MockRepositoryEventList("MockRepositoryEventLog1.txt");
    MockRepository r = new MockRepository(mrel);
    QueryManager qm = new MockJcrQueryManager(r.getStore());
    TraversalManager qtm = new JcrTraversalManager(qm);
    {
      DocumentList documentList = qtm.startTraversal();
      int counter = countDocuments(documentList);
      Assert.assertEquals(4, counter);
    }
  }
View Full Code Here

    String gsaActualResponse;

    MockRepositoryEventList mrel = new MockRepositoryEventList(repository);
    MockRepository r = new MockRepository(mrel);
    QueryManager qm = new MockJcrQueryManager(r.getStore());
    TraversalManager qtm = new JcrTraversalManager(qm);

    MockFeedConnection feedConnection = new MockFeedConnection() {
      public boolean supportsInheritedAcls() {
        return supportsInheritedAcls;
      }
    };

    DocPusher dpusher = new DocPusher(feedConnection, dataSource, fsli, dfc);
    DocumentList documentList = qtm.startTraversal();

    Document document = null;
    while ((document = documentList.nextDocument()) != null) {
      assertEquals(PusherStatus.OK, dpusher.take(document, null));
    }
View Full Code Here

    String gsaActualResponse;

    MockRepositoryEventList mrel = new MockRepositoryEventList(repository);
    MockRepository r = new MockRepository(mrel);
    QueryManager qm = new MockJcrQueryManager(r.getStore());
    TraversalManager qtm = new JcrTraversalManager(qm);

    MockFeedConnection feedConnection = new MockFeedConnection() {
      public String getContentEncodings() {
        if (useCompression) {
          return super.getContentEncodings() + ", base64compressed";
        } else {
          return super.getContentEncodings();
        }
      }

      public boolean supportsInheritedAcls() {
        return supportsInheritedAcls;
      }
    };

    DocumentList documentList = qtm.startTraversal();

    int i = 0;
    Document document = null;
    while ((document = documentList.nextDocument()) != null) {
      System.out.println("Test " + i + " output");
View Full Code Here

      new MockRepositoryEventList("MockRepositoryEventLog1.txt");
    MockRepository r = new MockRepository(mrel);
    javax.jcr.Repository jcrRepo = new MockJcrRepository(r);
    Connector repo = new JcrConnector(jcrRepo);
    Session session = repo.login();
    TraversalManager qtm = session.getTraversalManager();
    QueryTraversalUtil.runTraversal(qtm, 2);
  }
View Full Code Here

    MockRepositoryEventList eventList = new MockRepositoryEventList(
        "MockRepositoryEventLogBinaryFile.txt");
    MockRepository mockRepo = new MockRepository(eventList);
    MockJcrRepository mockJcrRepo = new MockJcrRepository(mockRepo);
    JcrConnector jcrConn = new JcrConnector(mockJcrRepo);
    TraversalManager travMgr = jcrConn.login().getTraversalManager();
    Document document = travMgr.startTraversal().nextDocument();
    assertEquals("worddoc",
        Value.getSingleValueString(document, SpiConstants.PROPNAME_DOCID));
    Value v = Value.getSingleValue(document, SpiConstants.PROPNAME_CONTENT);
    InputStream contentStream = ((BinaryValue) v).getInputStream();
    InputStream encodedContentStream =
View Full Code Here

    assertNotNull(docList);
  }

  @Test
  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);
View Full Code Here

      con.setPort(Integer.toString(TestConfiguration.d1port));
      con.setPrincipal(TestConfiguration.d1principal);
      con.setPassword(TestConfiguration.d1password);
      con.setDataSource(dbType, TestConfiguration.dbs.get(dbType));
      Session s = con.login();
      TraversalManager out = s.getTraversalManager();

      DocumentList result = out.startTraversal();
      assertNull(result.nextDocument());
      assertEquals(AdConstants.CHECKPOINT_VALUE, result.checkpoint());

      result = out.resumeTraversal(AdConstants.CHECKPOINT_VALUE);
      assertNull(result);
    }
  }
View Full Code Here

  }


  @Test
  public void testStartTraversal() throws RepositoryException {
    TraversalManager trav = session.getTraversalManager();
    trav.setBatchHint(500);
    DocumentList docList = trav.startTraversal();
    testUserProfiles(docList);
  }
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.