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

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


  }

  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

    static Change newChange(int ix, String monitorName) {
      //TODO add some deletes
      MockDocumentHandle mdh = new MockDocumentHandle(PREFIX + ix,
          "extra_" + monitorName);
      return new Change(Change.FactoryType.CLIENT, mdh,
          new MonitorCheckpoint(monitorName, ix, ix, ix));
    }
View Full Code Here

    clientFactory = new MockDocumentHandleFactory();
    }

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

        copy.getDocumentHandle().getDocumentId());
  }

  public void testChange_fromJsonClientFactory() throws Exception {
    MockDocumentHandle mdh = new MockDocumentHandle("aa", "extra");
    Change c = new Change(Change.FactoryType.CLIENT, mdh, MCP);
    String stringForm = c.getJson().toString();
    JSONObject json = new JSONObject(stringForm);
    Change copy = new Change(json, internalFactory, clientFactory);
    assertEquals(c.getMonitorCheckpoint(), copy.getMonitorCheckpoint());
    MockDocumentHandle mdhCopy = (MockDocumentHandle)copy.getDocumentHandle();
    assertEquals(mdhCopy.getDocumentId(), mdh.getDocumentId());
    assertEquals(mdhCopy.getExtra(), mdh.getExtra());
  }
View Full Code Here

TOP

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

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.