Examples of ChangeSource


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

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

      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

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

    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

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

  }

  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

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

    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

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

    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

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

    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

Examples of org.openstreetmap.osmosis.core.task.v0_6.ChangeSource

  /**
   * {@inheritDoc}
   */
  @Override
  public void connect(PipeTasks pipeTasks) {
    ChangeSource source;

    // Get the input task. A sink only has one input, this corresponds to
    // pipe index 0.
    source = (ChangeSource) getInputTask(pipeTasks, 0, ChangeSource.class);

    // Cast the input feed to the correct type.
    // Connect the tasks.
    source.setChangeSink(task);

    // Register the task as an output. A source only has one output, this
    // corresponds to pipe index 0.
    setOutputTask(pipeTasks, task, 0);
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.core.task.v0_6.ChangeSource

  /**
   * {@inheritDoc}
   */
  @Override
  public void connect(PipeTasks pipeTasks) {
    ChangeSource source;
   
    // Get the input task. A sink only has one input, this corresponds to
    // pipe index 0.
    source = (ChangeSource) getInputTask(pipeTasks, 0, ChangeSource.class);
   
    // Cast the input feed to the correct type.
    // Connect the tasks.
    source.setChangeSink(task);
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.core.task.v0_6.ChangeSource

  /**
   * {@inheritDoc}
   */
  @Override
  public void connect(PipeTasks pipeTasks) {
    ChangeSource source;
   
    // Get the input task. A sink only has one input, this corresponds to
    // pipe index 0.
    source = (ChangeSource) getInputTask(pipeTasks, 0, ChangeSource.class);
   
    // Connect the tasks.
    source.setChangeSink(task);
   
    // Register the task as an output. A source only has one output, this
    // corresponds to pipe index 0.
    setOutputTask(pipeTasks, task, 0);
  }
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.