Package com.google.enterprise.connector.util.diffing

Examples of com.google.enterprise.connector.util.diffing.CheckpointAndChangeQueue.resume()


        persistDir, internalFactory, clientFactory);
    q.setMaximumQueueSize(2);
    q.start(null);
    List<CheckpointAndChange> firstBatch = q.resume(null);
    String checkpoint = firstBatch.get(1).getCheckpoint().toString();
    List<CheckpointAndChange> secondBatch = q.resume(checkpoint);
    q.start(null);
    assertTrue(0 == persistDir.listFiles().length);
    List<CheckpointAndChange> firstBatchAgain = q.resume(null);
    assertEquals(firstBatch, firstBatchAgain);
  }
View Full Code Here


    List<CheckpointAndChange> firstBatch = q.resume(null);
    String checkpoint = firstBatch.get(1).getCheckpoint().toString();
    List<CheckpointAndChange> secondBatch = q.resume(checkpoint);
    q.start(null);
    assertTrue(0 == persistDir.listFiles().length);
    List<CheckpointAndChange> firstBatchAgain = q.resume(null);
    assertEquals(firstBatch, firstBatchAgain);
  }

  public void testWithMoreResumeCallsThanFileDescriptors() throws IOException {
    final int NUM_RESUME_CALLS = 1000;
View Full Code Here

        persistDir, internalFactory, clientFactory);
    q.setMaximumQueueSize(2);
    String checkpoint = null;
    q.start(checkpoint);
    for (int i = 0; i < NUM_RESUME_CALLS; i++) {
       List<CheckpointAndChange> batch = q.resume(checkpoint);
       checkpoint = batch.get(1).getCheckpoint().toString();
       assertTrue(1 >= persistDir.listFiles().length);
    }
    assertTrue(1 == persistDir.listFiles().length);
  }
View Full Code Here

        persistDir, internalFactory, clientFactory);
    q.setMaximumQueueSize(2);
    String checkpoint = null;
    q.start(checkpoint);

    List<CheckpointAndChange> batch = q.resume(checkpoint);
    Map<String, MonitorCheckpoint> monPoints = q.getMonitorRestartPoints();
    assertEquals(2, monPoints.size());
    assertTrue(monPoints.containsKey(MON_A));
    assertTrue(monPoints.containsKey(MON_B));
    assertEquals(0, monPoints.get(MON_A).getOffset1());
View Full Code Here

    assertEquals(0, monPoints.get(MON_A).getOffset1());
    assertEquals(0, monPoints.get(MON_B).getOffset1());
    assertEquals(0, monPoints.get(MON_A).getOffset2());
    assertEquals(0, monPoints.get(MON_B).getOffset2());
    checkpoint = batch.get(0).getCheckpoint().toString();
    batch = q.resume(checkpoint);
    monPoints = q.getMonitorRestartPoints();
    assertEquals(2, monPoints.size());
    assertTrue(monPoints.containsKey(MON_A));
    assertTrue(monPoints.containsKey(MON_B));
    assertEquals(1, monPoints.get(MON_A).getOffset1());
View Full Code Here

    assertEquals(1, monPoints.get(MON_A).getOffset1());
    assertEquals(0, monPoints.get(MON_B).getOffset1());
    assertEquals(1, monPoints.get(MON_A).getOffset2());
    assertEquals(0, monPoints.get(MON_B).getOffset2());
    // Can do it again.
    batch = q.resume(checkpoint);
    monPoints = q.getMonitorRestartPoints();
    assertEquals(2, monPoints.size());
    assertTrue(monPoints.containsKey(MON_A));
    assertTrue(monPoints.containsKey(MON_B));
    assertEquals(1, monPoints.get(MON_A).getOffset1());
View Full Code Here

    CheckpointAndChangeQueue q = new CheckpointAndChangeQueue(changeSource,
        persistDir, internalFactory, clientFactory);
    q.setMaximumQueueSize(15);
    String checkpoint = null;
    q.start(checkpoint);
    List<CheckpointAndChange> batch = q.resume(checkpoint);
    Map<String, MonitorCheckpoint> monPoints = q.getMonitorRestartPoints();
    assertEquals(5, monPoints.size());
    assertTrue(monPoints.containsKey(MON_A));
    assertTrue(monPoints.containsKey(MON_B));
    assertTrue(monPoints.containsKey(MON_C));
View Full Code Here

      ChangeSource changeSource = new MockChangeSource(6);
      CheckpointAndChangeQueue q = new CheckpointAndChangeQueue(changeSource,
          persistDirSeed, internalFactory, clientFactory);
      q.setMaximumQueueSize(2);
      q.start(checkpoint);
      List<CheckpointAndChange> firstBatch = q.resume(checkpoint);
      checkpoint = firstBatch.get(1).getCheckpoint().toString();
      List<CheckpointAndChange> secondBatch = q.resume(checkpoint);
      checkpoint = secondBatch.get(1).getCheckpoint().toString();
      q.resume(checkpoint);
      monPoints = q.getMonitorRestartPoints();
View Full Code Here

          persistDirSeed, internalFactory, clientFactory);
      q.setMaximumQueueSize(2);
      q.start(checkpoint);
      List<CheckpointAndChange> firstBatch = q.resume(checkpoint);
      checkpoint = firstBatch.get(1).getCheckpoint().toString();
      List<CheckpointAndChange> secondBatch = q.resume(checkpoint);
      checkpoint = secondBatch.get(1).getCheckpoint().toString();
      q.resume(checkpoint);
      monPoints = q.getMonitorRestartPoints();
      File recoveryFiles[] = persistDirSeed.listFiles();
      assertEquals(1, recoveryFiles.length);
View Full Code Here

      q.start(checkpoint);
      List<CheckpointAndChange> firstBatch = q.resume(checkpoint);
      checkpoint = firstBatch.get(1).getCheckpoint().toString();
      List<CheckpointAndChange> secondBatch = q.resume(checkpoint);
      checkpoint = secondBatch.get(1).getCheckpoint().toString();
      q.resume(checkpoint);
      monPoints = q.getMonitorRestartPoints();
      File recoveryFiles[] = persistDirSeed.listFiles();
      assertEquals(1, recoveryFiles.length);
      File recoveryFile = recoveryFiles[0];
      recoveryFile.renameTo(new File(persistDir, recoveryFile.getName()));
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.