use of io.aeron.cluster.client.ClusterException in project aeron by real-logic.
the class ConsensusModuleContextTest method unknownTimerServiceSupplier.
@Test
void unknownTimerServiceSupplier() {
final String supplierName = "unknown timer service supplier";
System.setProperty(TIMER_SERVICE_SUPPLIER_PROP_NAME, supplierName);
try {
final ClusterException exception = assertThrows(ClusterException.class, context::conclude);
assertEquals("ERROR - invalid TimerServiceSupplier: " + supplierName, exception.getMessage());
} finally {
System.clearProperty(TIMER_SERVICE_SUPPLIER_PROP_NAME);
}
}
use of io.aeron.cluster.client.ClusterException in project aeron by real-logic.
the class RecordingLogTest method shouldNotAllowInvalidateOfSnapshotWithoutParentTerm.
@Test
void shouldNotAllowInvalidateOfSnapshotWithoutParentTerm() {
try (RecordingLog recordingLog = new RecordingLog(tempDir, true)) {
recordingLog.appendSnapshot(-10, 1L, 0, 777L, 0, 0);
recordingLog.appendSnapshot(-11, 1L, 0, 777L, 0, SERVICE_ID);
final ClusterException ex = assertThrows(ClusterException.class, recordingLog::invalidateLatestSnapshot);
assertEquals("ERROR - no matching term for snapshot: leadershipTermId=1", ex.getMessage());
}
}
use of io.aeron.cluster.client.ClusterException in project aeron by real-logic.
the class RecordingLogTest method appendTermShouldRejectNullValueAsRecordingId.
@Test
void appendTermShouldRejectNullValueAsRecordingId() {
try (RecordingLog recordingLog = new RecordingLog(tempDir, true)) {
final ClusterException exception = assertThrows(ClusterException.class, () -> recordingLog.appendTerm(NULL_VALUE, 0, 0, 0));
assertEquals("ERROR - invalid recordingId=-1", exception.getMessage());
assertEquals(0, recordingLog.entries().size());
}
}
use of io.aeron.cluster.client.ClusterException in project aeron by real-logic.
the class RecordingLogTest method appendTermShouldNotAcceptDifferentRecordingIds.
@Test
void appendTermShouldNotAcceptDifferentRecordingIds() {
try (RecordingLog recordingLog = new RecordingLog(tempDir, true)) {
recordingLog.appendTerm(42, 0, 0, 0);
final ClusterException exception = assertThrows(ClusterException.class, () -> recordingLog.appendTerm(21, 1, 0, 0));
assertEquals("ERROR - invalid TERM recordingId=21, expected recordingId=42", exception.getMessage());
assertEquals(1, recordingLog.entries().size());
}
try (RecordingLog recordingLog = new RecordingLog(tempDir, true)) {
final ClusterException exception = assertThrows(ClusterException.class, () -> recordingLog.appendTerm(-5, -5, -5, -5));
assertEquals("ERROR - invalid TERM recordingId=-5, expected recordingId=42", exception.getMessage());
assertEquals(1, recordingLog.entries().size());
}
}
use of io.aeron.cluster.client.ClusterException in project aeron by real-logic.
the class RecordingLogTest method appendSnapshotShouldRejectNullValueAsRecordingId.
@Test
void appendSnapshotShouldRejectNullValueAsRecordingId() {
try (RecordingLog recordingLog = new RecordingLog(tempDir, true)) {
final ClusterException exception = assertThrows(ClusterException.class, () -> recordingLog.appendSnapshot(NULL_VALUE, 0, 0, 0, 0, 0));
assertEquals("ERROR - invalid recordingId=-1", exception.getMessage());
assertEquals(0, recordingLog.entries().size());
}
}
Aggregations