use of org.agrona.collections.MutableBoolean in project aeron by real-logic.
the class ClusterTest method shouldRejectTakeSnapshotRequestWithAnAuthorisationError.
@Test
@InterruptAfter(10)
void shouldRejectTakeSnapshotRequestWithAnAuthorisationError() {
cluster = aCluster().withStaticNodes(3).start();
systemTestWatcher.cluster(cluster);
final TestNode leader = cluster.awaitLeader();
final List<TestNode> followers = cluster.followers();
final long requestCorrelationId = System.nanoTime();
final MutableBoolean responseReceived = injectAdminResponseEgressListener(requestCorrelationId, AdminRequestType.SNAPSHOT, AdminResponseCode.UNAUTHORISED_ACCESS, "Execution of the " + AdminRequestType.SNAPSHOT + " request was not authorised");
final AeronCluster client = cluster.connectClient();
while (!client.sendAdminRequestToTakeASnapshot(requestCorrelationId)) {
Tests.yield();
}
while (!responseReceived.get()) {
client.pollEgress();
Tests.yield();
}
long time = System.nanoTime();
final long deadline = time + TimeUnit.SECONDS.toNanos(2);
do {
assertEquals(0, cluster.getSnapshotCount(leader));
for (final TestNode follower : followers) {
assertEquals(0, cluster.getSnapshotCount(follower));
}
Tests.sleep(10);
time = System.nanoTime();
} while (time < deadline);
}
use of org.agrona.collections.MutableBoolean in project aeron by real-logic.
the class ArchiveTest method postPublicationValidations.
private void postPublicationValidations(final ArchiveProxy archiveProxy, final Subscription recordingEvents, final int termBufferLength, final int initialTermId, final int maxPayloadLength) {
verifyDescriptorListOngoingArchive(archiveProxy, termBufferLength);
assertNull(trackerError);
final long requestCorrelationId = client.nextCorrelationId();
if (!archiveProxy.stopRecording(publishUri, PUBLISH_STREAM_ID, requestCorrelationId, controlSessionId)) {
throw new IllegalStateException("failed to send stop recording");
}
ArchiveTests.awaitOk(controlResponse, requestCorrelationId);
final MutableBoolean isRecordingStopped = new MutableBoolean();
final RecordingEventsAdapter recordingEventsAdapter = new RecordingEventsAdapter(new FailRecordingEventsListener() {
public void onStop(final long id, final long startPosition, final long stopPosition) {
assertEquals(recordingId, id);
isRecordingStopped.set(true);
}
}, recordingEvents, 1);
while (!isRecordingStopped.get()) {
if (recordingEventsAdapter.poll() == 0) {
Tests.yield();
}
}
verifyDescriptorListOngoingArchive(archiveProxy, termBufferLength);
validateArchiveFile(recordingId);
validateReplay(archiveProxy, initialTermId, maxPayloadLength, termBufferLength);
}
Aggregations