Package com.google.enterprise.connector.instantiator

Examples of com.google.enterprise.connector.instantiator.MockInstantiator


            new FileOutputStream("traverser-test.log");

        PusherFactory pusherFactory =
            new DocPusherFactory(new MockFileFeedConnection(out));

        MockInstantiator instantiator =
            new MockInstantiator(new ThreadPool(300, new SystemClock()));

        Traverser traverser = new QueryTraverser(pusherFactory, qtm,
            instantiator.getTraversalStateStore(connectorName),
            connectorName, null, new SystemClock());

        instantiator.setupTraverser(connectorName, traverser);

        System.out.println();
        System.out.println("Running batch test batchsize " + batchHint);

        int docsProcessed = 0;
        int totalDocsProcessed = 0;
        int batchNumber = 0;
        BatchSize batchSize = new BatchSize(batchHint);
        do {
            BatchResult result = traverser.runBatch(batchSize);
            docsProcessed = result.getCountProcessed();
            if (docsProcessed > 0) {
                totalDocsProcessed += docsProcessed;
            }
            System.out.println("Batch# " + batchNumber + " docs " +
                docsProcessed + " checkpoint " +
                instantiator.getConnectorState(connectorName));
            batchNumber++;
        } while (docsProcessed > 0);

        // TODO: There should be some way to parameterize the
        // expected number of documents.
View Full Code Here


  public void testTraversal() throws InterruptedException, RepositoryException {
    final String connectorName = "sharepoint";
    final Session session = this.connector.login();
    GlobalState.forgetState(null);
    final SharepointTraversalManager traversalManager = (SharepointTraversalManager) session.getTraversalManager();
    final MockInstantiator instantiator = new MockInstantiator(new ThreadPool(
        5, new SystemClock()));
    final Traverser traverser = new QueryTraverser(new MockPusher(System.out),
        traversalManager, instantiator.getTraversalStateStore(connectorName),
        connectorName, Context.getInstance().getTraversalContext(),
        new SystemClock());
    BatchResult result = traverser.runBatch(new BatchSize(10));
    int totalDocsProcessed = result.getCountProcessed();
    assertTrue(totalDocsProcessed > 0);
View Full Code Here

  }

  private Instantiator createMockInstantiator() {
    ThreadPool threadPool = new ThreadPool(5,
        new SystemClock() /* TODO: use mock clock? */);
    MockInstantiator instantiator = new MockInstantiator(threadPool);
    instantiator.setupTestTraversers();
    return instantiator;
  }
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    connectorName = getName();
    clock = new AdjustableClock();
    threadPool = new ThreadPool(5, clock);
    instantiator = new MockInstantiator(threadPool);
    pusher = new ValidatingPusher();
    traversalContext = new ProductionTraversalContext();
    traversalContext.setTraversalTimeLimitSeconds(1);
    stateStore = new RecordingTraversalStateStore();
  }
View Full Code Here

  private String connectorName = MockInstantiator.TRAVERSER_NAME1;
  private String docid = "docid";

  private MockInstantiator getMockInstantiator() throws Exception {
    MockInstantiator instantiator =
        new MockInstantiator(new ThreadPool(5, new SystemClock()));
    instantiator.setupTestTraversers();
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, new MockRetriever(), null));
    return instantiator;
  }
View Full Code Here

        new MockConnector(null, null, null, new MockRetriever(), null));
    return instantiator;
  }

  private Manager getProductionManager() throws Exception {
    MockInstantiator instantiator = getMockInstantiator();
    ProductionManager manager = new ProductionManager();
    manager.setInstantiator(instantiator);
    manager.setFeedConnection(new MockFeedConnection());
    return manager;
  }
View Full Code Here

    manager.setFeedConnection(new MockFeedConnection());
    return manager;
  }

  private void patchRealProductionManager() throws Exception {
    MockInstantiator instantiator = getMockInstantiator();
    assertTrue(Context.getInstance().getManager() instanceof ProductionManager);
    ProductionManager manager =
        (ProductionManager) (Context.getInstance().getManager());
    manager.setInstantiator(instantiator);
  }
View Full Code Here

  AuthenticationIdentity identity;
  String connectorName;

  protected void setUp() throws Exception {
    ThreadPool threadPool = new ThreadPool(5, new SystemClock());
    instantiator = new MockInstantiator(threadPool);
    instantiator.setupTestTraversers();
    manager = new ProductionManager();
    manager.setInstantiator(instantiator);
    manager.setFeedConnection(new MockFeedConnection());
    connectorName = MockInstantiator.TRAVERSER_NAME1;
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.instantiator.MockInstantiator

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.