Search in sources :

Example 6 with ControlResponseAdapter

use of io.aeron.archive.client.ControlResponseAdapter in project aeron by real-logic.

the class TestUtil method awaitConnectedReply.

public static void awaitConnectedReply(final Subscription controlResponse, final long expectedCorrelationId, final LongConsumer receiveSessionId) {
    final ControlResponseAdapter controlResponseAdapter = new ControlResponseAdapter(new FailControlResponseListener() {

        public void onResponse(final long controlSessionId, final long correlationId, final long relevantId, final ControlResponseCode code, final String errorMessage) {
            if (ControlResponseCode.OK != code) {
                throw new IllegalStateException("expected=" + ControlResponseCode.OK + " actual=" + code);
            }
            if (correlationId != expectedCorrelationId) {
                throw new IllegalStateException("expected=" + expectedCorrelationId + " actual=" + correlationId);
            }
            receiveSessionId.accept(controlSessionId);
        }
    }, controlResponse, 1);
    await(() -> controlResponseAdapter.poll() != 0);
}
Also used : ControlResponseAdapter(io.aeron.archive.client.ControlResponseAdapter) ControlResponseCode(io.aeron.archive.codecs.ControlResponseCode)

Example 7 with ControlResponseAdapter

use of io.aeron.archive.client.ControlResponseAdapter in project aeron by real-logic.

the class TestUtil method awaitResponse.

static void awaitResponse(final Subscription controlResponse, final long expectedCorrelationId) {
    final ControlResponseAdapter controlResponseAdapter = new ControlResponseAdapter(new FailControlResponseListener() {

        public void onResponse(final long controlSessionId, final long correlationId, final long relevantId, final ControlResponseCode code, final String errorMessage) {
            if (correlationId != expectedCorrelationId) {
                throw new IllegalStateException("expected=" + expectedCorrelationId + " actual=" + correlationId);
            }
        }
    }, controlResponse, 1);
    await(() -> controlResponseAdapter.poll() != 0);
}
Also used : ControlResponseAdapter(io.aeron.archive.client.ControlResponseAdapter) ControlResponseCode(io.aeron.archive.codecs.ControlResponseCode)

Example 8 with ControlResponseAdapter

use of io.aeron.archive.client.ControlResponseAdapter in project Aeron by real-logic.

the class ArchiveTests method awaitConnectedReply.

public static void awaitConnectedReply(final Subscription controlResponse, final long expectedCorrelationId, final LongConsumer receiveSessionId) {
    final ControlResponseAdapter controlResponseAdapter = new ControlResponseAdapter(new FailControlResponseListener() {

        public void onResponse(final long controlSessionId, final long correlationId, final long relevantId, final ControlResponseCode code, final String errorMessage) {
            if (ControlResponseCode.OK != code) {
                throw new IllegalStateException("expected=" + ControlResponseCode.OK + " actual=" + code);
            }
            if (correlationId != expectedCorrelationId) {
                throw new IllegalStateException("expected=" + expectedCorrelationId + " actual=" + correlationId);
            }
            receiveSessionId.accept(controlSessionId);
        }
    }, controlResponse, 1);
    Tests.await(() -> controlResponseAdapter.poll() != 0, TIMEOUT_NS);
}
Also used : ControlResponseAdapter(io.aeron.archive.client.ControlResponseAdapter) ControlResponseCode(io.aeron.archive.codecs.ControlResponseCode)

Example 9 with ControlResponseAdapter

use of io.aeron.archive.client.ControlResponseAdapter in project Aeron by real-logic.

the class ArchiveTests method awaitOk.

public static void awaitOk(final Subscription controlResponse, final long expectedCorrelationId) {
    final ControlResponseAdapter controlResponseAdapter = new ControlResponseAdapter(new FailControlResponseListener() {

        public void onResponse(final long controlSessionId, final long correlationId, final long relevantId, final ControlResponseCode code, final String errorMessage) {
            if (ControlResponseCode.OK != code) {
                System.out.println(errorMessage);
                throw new IllegalStateException("expected=" + ControlResponseCode.OK + " actual=" + code);
            }
            if (correlationId != expectedCorrelationId) {
                throw new IllegalStateException("expected=" + expectedCorrelationId + " actual=" + correlationId);
            }
        }
    }, controlResponse, 1);
    Tests.await(() -> controlResponseAdapter.poll() != 0, TIMEOUT_NS);
}
Also used : ControlResponseAdapter(io.aeron.archive.client.ControlResponseAdapter) ControlResponseCode(io.aeron.archive.codecs.ControlResponseCode)

Example 10 with ControlResponseAdapter

use of io.aeron.archive.client.ControlResponseAdapter in project Aeron by real-logic.

the class ArchiveTests method awaitResponse.

static void awaitResponse(final Subscription controlResponse, final long expectedCorrelationId) {
    final ControlResponseAdapter controlResponseAdapter = new ControlResponseAdapter(new FailControlResponseListener() {

        public void onResponse(final long controlSessionId, final long correlationId, final long relevantId, final ControlResponseCode code, final String errorMessage) {
            if (correlationId != expectedCorrelationId) {
                throw new IllegalStateException("expected=" + expectedCorrelationId + " actual=" + correlationId);
            }
        }
    }, controlResponse, 1);
    Tests.await(() -> controlResponseAdapter.poll() != 0, TIMEOUT_NS);
}
Also used : ControlResponseAdapter(io.aeron.archive.client.ControlResponseAdapter) ControlResponseCode(io.aeron.archive.codecs.ControlResponseCode)

Aggregations

ControlResponseAdapter (io.aeron.archive.client.ControlResponseAdapter)11 ControlResponseCode (io.aeron.archive.codecs.ControlResponseCode)9 MutableBoolean (org.agrona.collections.MutableBoolean)2