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

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


  public void testCheckpointAndChange_internal() throws Exception {
    DiffingConnectorCheckpoint fccp = DiffingConnectorCheckpoint.newFirst();
    DeleteDocumentHandle ddh = new DeleteDocumentHandle("abc");
    Change c = new Change(Change.FactoryType.INTERNAL, ddh, MCP);
    CheckpointAndChange checkpointAndChange = new CheckpointAndChange(fccp, c);
    String stringForm = checkpointAndChange.getJson().toString();
    JSONObject json = new JSONObject(stringForm);
    CheckpointAndChange copy = new CheckpointAndChange(json, internalFactory,
        clientFactory);
    assertEquals(fccp, copy.getCheckpoint());
    assertEquals(c.getMonitorCheckpoint(),
        copy.getChange().getMonitorCheckpoint());
    assertEquals(c.getDocumentHandle().getDocumentId(),
        copy.getChange().getDocumentHandle().getDocumentId());
  }
View Full Code Here


  public void testCheckpointAndChange_client() throws Exception {
    DiffingConnectorCheckpoint fccp = DiffingConnectorCheckpoint.newFirst();
    MockDocumentHandle mdh = new MockDocumentHandle("abc", "data");
    Change c = new Change(Change.FactoryType.CLIENT, mdh, MCP);
    CheckpointAndChange checkpointAndChange = new CheckpointAndChange(fccp, c);
    String stringForm = checkpointAndChange.getJson().toString();
    JSONObject json = new JSONObject(stringForm);
    CheckpointAndChange copy = new CheckpointAndChange(json, internalFactory,
        clientFactory);
    assertEquals(fccp, copy.getCheckpoint());
    assertEquals(c.getMonitorCheckpoint(),
        copy.getChange().getMonitorCheckpoint());
    MockDocumentHandle mdhCopy =
        (MockDocumentHandle)copy.getChange().getDocumentHandle();
    assertEquals(mdh.getDocumentId(), mdhCopy.getDocumentId());
    assertEquals(mdh.getExtra(), mdhCopy.getExtra());
  }
View Full Code Here

    CheckpointAndChangeQueue q = new CheckpointAndChangeQueue(changeSource,
        persistDir, internalFactory, clientFactory);
    q.setMaximumQueueSize(3);
    q.start(null);
    Iterator<CheckpointAndChange> it = q.resume(null).iterator();
    CheckpointAndChange checkpointAndChange = it.next();
    MockChangeSource.validateChange(0, checkpointAndChange.getChange());
    assertTrue(it.hasNext());
    checkpointAndChange = it.next();
    MockChangeSource.validateChange(1, checkpointAndChange.getChange());
    assertTrue(it.hasNext());
    String checkpoint = checkChangesAndReturnLastCheckpoint(
        q.resume(checkpointAndChange.getCheckpoint().toString()), 2, 3);
    checkpoint = checkChangesAndReturnLastCheckpoint(q.resume(checkpoint), 5, 3);
    assertFalse(q.resume(checkpoint).iterator().hasNext());
  }
View Full Code Here

  private String checkChangesAndReturnLastCheckpoint(List<CheckpointAndChange> list,
      int start, int count) {
    Iterator<CheckpointAndChange> it = list.iterator();
    String result = null;
    for (int ix = 0; ix < count; ix++) {
      CheckpointAndChange checkpointAndChange = it.next();
      result = checkpointAndChange.getCheckpoint().toString();
      MockChangeSource.validateChange(start + ix, checkpointAndChange.getChange());
    }
    assertFalse(it.hasNext());
    return result;
  }
View Full Code Here

TOP

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

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.