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

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


/**
* Unit test for {@link MonitorCheckpoint}
*/
public class MonitorCheckpointTest extends TestCase {
  public void testFields() {
    MonitorCheckpoint mcp = new MonitorCheckpoint("foo", 13, 987654321, 876543210);
    assertEquals("foo", mcp.getMonitorName());
    assertEquals(13, mcp.getSnapshotNumber());
    assertEquals(987654321, mcp.getOffset1());
    assertEquals(876543210, mcp.getOffset2());
  }
View Full Code Here


    assertEquals(987654321, mcp.getOffset1());
    assertEquals(876543210, mcp.getOffset2());
  }

  public void testEquals() {
    MonitorCheckpoint mcp1 = new MonitorCheckpoint("foo", 13, 987654321, 876543210);

    MonitorCheckpoint mcp2 = new MonitorCheckpoint("foo", 13, 987654321, 876543210);
    assertEquals(mcp1, mcp2);
    assertEquals(mcp1.hashCode(), mcp2.hashCode());

    MonitorCheckpoint mcp3 = new MonitorCheckpoint("bar", 13, 987654321, 876543210);
    assertFalse(mcp1.equals(mcp3));
    assertFalse(mcp1.hashCode() == mcp3.hashCode());

    MonitorCheckpoint mcp4 = new MonitorCheckpoint("foo", 17, 987654321, 876543210);
    assertFalse(mcp1.equals(mcp4));
    assertFalse(mcp1.hashCode() == mcp4.hashCode());

    MonitorCheckpoint mcp5 = new MonitorCheckpoint("foo", 13, 907654321, 876543210);
    assertFalse(mcp1.equals(mcp5));
    assertFalse(mcp1.hashCode() == mcp5.hashCode());

    MonitorCheckpoint mcp6 = new MonitorCheckpoint("foo", 13, 907654321, 8765432170L);
    assertFalse(mcp1.equals(mcp6));
    assertFalse(mcp1.hashCode() == mcp6.hashCode());
  }
View Full Code Here

    assertFalse(mcp1.equals(mcp6));
    assertFalse(mcp1.hashCode() == mcp6.hashCode());
  }

  public void testJson() throws JSONException {
    MonitorCheckpoint mcp1 = new MonitorCheckpoint("foo", 13, 987654321, 876543210);
    JSONObject json = mcp1.getJson();
    MonitorCheckpoint mcp2 = new MonitorCheckpoint(json);
    assertEquals(mcp1, mcp2);
  }
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

TOP

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

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.