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

Examples of com.google.enterprise.connector.util.diffing.ChangeSource


    assertTrue(deleteDir(persistDirAux));
  }

  public void testRecoveryFromOneIncompleteFileOnly() throws IOException {
    ChangeSource changeSource = new MockChangeSource(6);
    CheckpointAndChangeQueue q = new CheckpointAndChangeQueue(changeSource,
        persistDir, internalFactory, clientFactory);
    File persistFile = new File(persistDir, "recovery.1234");
    FileWriter writer = new FileWriter(persistFile);
    writer.write("omonee-harmony");
View Full Code Here


      assertTrue(-1 != e.getMessage().indexOf("Found incomplete recovery file: "));
    }
  }

  public void testReStart() throws IOException {
    ChangeSource changeSource = new MockChangeSource(6);
    CheckpointAndChangeQueue q = new CheckpointAndChangeQueue(changeSource,
        persistDir, internalFactory, clientFactory);
    q.setMaximumQueueSize(2);
    q.start(null);
    List<CheckpointAndChange> firstBatch = q.resume(null);
View Full Code Here

    assertEquals(firstBatch, firstBatchAgain);
  }

  public void testWithMoreResumeCallsThanFileDescriptors() throws IOException {
    final int NUM_RESUME_CALLS = 1000;
    ChangeSource changeSource = new MockChangeSource(NUM_RESUME_CALLS * 3);
    CheckpointAndChangeQueue q = new CheckpointAndChangeQueue(changeSource,
        persistDir, internalFactory, clientFactory);
    q.setMaximumQueueSize(2);
    String checkpoint = null;
    q.start(checkpoint);
View Full Code Here

  }

  public void testTrackingMonitorState() throws IOException {
    final String MON_A = "A Monitor";
    final String MON_B = "I am mon B";
    ChangeSource changeSource = new MockChangeSource(Arrays.asList(new Change[] {
        newChange(0, MON_A), newChange(0, MON_B), newChange(1, MON_A),
        newChange(1, MON_B), newChange(2, MON_B), newChange(2, MON_A)
    }));
    CheckpointAndChangeQueue q = new CheckpointAndChangeQueue(changeSource,
        persistDir, internalFactory, clientFactory);
View Full Code Here

    final String MON_A = "A Monitor";
    final String MON_B = "I am mon B";
    final String MON_C = "C me";
    final String MON_D = "D is for diploma";
    final String MON_E = "Um.....eeee";
    ChangeSource changeSource = new MockChangeSource(Arrays.asList(new Change[] {
        newChange(0, MON_A), newChange(0, MON_B), newChange(1, MON_A),
        newChange(0, MON_C), newChange(0, MON_D), newChange(0, MON_E),
        newChange(1, MON_C), newChange(1, MON_D), newChange(1, MON_E),
        newChange(1, MON_B), newChange(2, MON_B), newChange(2, MON_A),
        newChange(2, MON_E), newChange(2, MON_C), newChange(2, MON_D),
View Full Code Here

    File persistDirSeed = testDirectoryManager.makeDirectory("queue-to-stop");
    Map<String, MonitorCheckpoint> monPoints = null;

    String checkpoint = null;
    { /* Make recovery file that finishes 2nd batch. */
      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();
      File recoveryFiles[] = persistDirSeed.listFiles();
      assertEquals(1, recoveryFiles.length);
      File recoveryFile = recoveryFiles[0];
      recoveryFile.renameTo(new File(persistDir, recoveryFile.getName()));
    }

    ChangeSource changeSource = new MockChangeSource(6);
    CheckpointAndChangeQueue q = new CheckpointAndChangeQueue(changeSource,
        persistDir, internalFactory, clientFactory);
    q.setMaximumQueueSize(2);
    q.start(checkpoint);
    // Note: It's important that q.resume(checkpoint) is not called.
View Full Code Here

    File persistDirSeed = testDirectoryManager.makeDirectory("queue-to-stop");
    Map<String, MonitorCheckpoint> monPoints = null;

    String checkpoint = null;
    { /* Make recovery file that finishes 2nd batch. */
      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(0).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()));
    }

    ChangeSource changeSource = new MockChangeSource(6);
    CheckpointAndChangeQueue q = new CheckpointAndChangeQueue(changeSource,
        persistDir, internalFactory, clientFactory);
    q.setMaximumQueueSize(2);
    q.start(checkpoint);
    // Note: It's important that q.resume(checkpoint) is not called.
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.util.diffing.ChangeSource

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.