public static OkEvent lockSuccess(long time, int process) { return createOkEvent(time, process, OkEvent.LOCK_SUCCESS, RequestType.LOCK); }
public static InvokeEvent invokeLock(long time, int process, String lockname) { return createInvokeEvent(time, process, RequestType.LOCK, lockname); }
public static FailEvent createFailEvent(long time, int process) { return createFailEvent(time, process, "unknown"); }
@Test public void failureShouldNegateInvokeOnOneProcess() { long time = 0; Event event1 = TestEventUtils.invokeTimestamp(time++, PROCESS_0); Event event2 = TestEventUtils.createFailEvent(time++, PROCESS_0); Event event3 = TestEventUtils.invokeTimestamp(time++, PROCESS_0); Event event4 = TestEventUtils.timestampOk(time++, PROCESS_0, "1"); CheckerTestUtils.assertNoErrors(NonOverlappingReadsMonotonicChecker::new, event1, event2, event3, event4); }
@Test public void shouldSucceedOnOverlappingReadsOnTwoProcesses() { long time = 0; Event event1 = TestEventUtils.invokeTimestamp(time++, PROCESS_0); Event event2 = TestEventUtils.invokeTimestamp(time++, PROCESS_1); Event event3 = TestEventUtils.timestampOk(time++, PROCESS_0, "1"); Event event4 = TestEventUtils.timestampOk(time++, PROCESS_1, "0"); CheckerTestUtils.assertNoErrors(NonOverlappingReadsMonotonicChecker::new, event1, event2, event3, event4); }
@Test public void shouldSucceedOnTwoProcessesOverlapping() { Event event1 = TestEventUtils.timestampOk(ZERO_TIME, PROCESS_0, "1"); Event event2 = TestEventUtils.timestampOk(ZERO_TIME, PROCESS_1, "2"); Event event3 = TestEventUtils.timestampOk(ZERO_TIME, PROCESS_0, "4"); Event event4 = TestEventUtils.timestampOk(ZERO_TIME, PROCESS_1, "3"); CheckerTestUtils.assertNoErrors(MonotonicChecker::new, event1, event2, event3, event4); }
public static InvokeEvent invokeRefresh(long time, int process) { return invokeRefresh(time, process, LOCKNAME); }
private static void assertNoErrors(Event... events) { CheckerTestUtils.assertNoErrors(NemesisResilienceChecker::new, events); }
@Test public void shouldIgnoreFailureOnOtherProcess() { long time = 0; Event event1 = TestEventUtils.invokeTimestamp(time++, PROCESS_0); Event event2 = TestEventUtils.createFailEvent(time++, PROCESS_0); Event event3 = TestEventUtils.invokeTimestamp(time++, PROCESS_1); Event event4 = TestEventUtils.timestampOk(time++, PROCESS_1, "1"); CheckerTestUtils.assertNoErrors(NonOverlappingReadsMonotonicChecker::new, event1, event2, event3, event4); }
@Test public void shouldSucceedOnUniqueValues() { Event event1 = TestEventUtils.timestampOk(ZERO_TIME, PROCESS_0, VALUE_A); Event event2 = TestEventUtils.timestampOk(ZERO_TIME, PROCESS_0, VALUE_B); CheckerTestUtils.assertNoErrors(UniquenessChecker::new, event1, event2); }
public static OkEvent lockFailure(long time, int process) { return createOkEvent(time, process, OkEvent.LOCK_FAILURE, RequestType.LOCK); }
public static InvokeEvent invokeUnlock(long time, int process, String lockname) { return createInvokeEvent(time, process, RequestType.UNLOCK, lockname); }
@Test public void shouldIgnoreOverlappingFailure() { long time = 0; Event event1 = TestEventUtils.invokeTimestamp(time++, PROCESS_0); Event event3 = TestEventUtils.invokeTimestamp(time++, PROCESS_1); Event event2 = TestEventUtils.createFailEvent(time++, PROCESS_0); Event event4 = TestEventUtils.timestampOk(time++, PROCESS_1, "1"); CheckerTestUtils.assertNoErrors(NonOverlappingReadsMonotonicChecker::new, event1, event2, event3, event4); }
@Test public void shouldParseLongValues() { Event event1 = TestEventUtils.timestampOk(ZERO_TIME, PROCESS_0, INT_MAX_PLUS_ONE); CheckerTestUtils.assertNoErrors(MonotonicChecker::new, event1); }
public static OkEvent refreshSuccess(long time, int process) { return createOkEvent(time, process, OkEvent.REFRESH_SUCCESS, RequestType.REFRESH); }
public static InvokeEvent invokeTimestamp(long time, int process) { return createInvokeEvent(time, process, RequestType.TIMESTAMP, TIMESTAMP); }
public static OkEvent unlockSuccess(long time, int process) { return createOkEvent(time, process, OkEvent.UNLOCK_SUCCESS, RequestType.UNLOCK); }
public static OkEvent unlockFailure(long time, int process) { return createOkEvent(time, process, OkEvent.UNLOCK_FAILURE, RequestType.UNLOCK); }
public static OkEvent timestampOk(long time, int process, String value) { return createOkEvent(time, process, value, RequestType.TIMESTAMP); }
public static OkEvent refreshFailure(long time, int process) { return createOkEvent(time, process, OkEvent.REFRESH_FAILURE, RequestType.REFRESH); }