Search in sources :

Example 1 with Context

use of io.aeron.driver.MediaDriver.Context in project Aeron by real-logic.

the class MediaDriverContextTest method nakMulticastMaxBackoffNsValueFromSystemProperty.

@Test
public void nakMulticastMaxBackoffNsValueFromSystemProperty() {
    System.setProperty(NAK_MULTICAST_MAX_BACKOFF_PROP_NAME, "333");
    try {
        final Context context = new Context();
        assertEquals(333, context.nakMulticastMaxBackoffNs());
    } finally {
        System.clearProperty(NAK_MULTICAST_MAX_BACKOFF_PROP_NAME);
    }
}
Also used : Context(io.aeron.driver.MediaDriver.Context) Test(org.junit.jupiter.api.Test)

Example 2 with Context

use of io.aeron.driver.MediaDriver.Context in project Aeron by real-logic.

the class MediaDriverContextTest method nakMulticastMaxBackoffNsDefaultValue.

@Test
public void nakMulticastMaxBackoffNsDefaultValue() {
    final Context context = new Context();
    assertEquals(NAK_MAX_BACKOFF_DEFAULT_NS, context.nakMulticastMaxBackoffNs());
}
Also used : Context(io.aeron.driver.MediaDriver.Context) Test(org.junit.jupiter.api.Test)

Example 3 with Context

use of io.aeron.driver.MediaDriver.Context in project aeron by real-logic.

the class ClusterLoggingAgentTest method testClusterEventsLogging.

private void testClusterEventsLogging(final String enabledEvents, final EnumSet<ClusterEventCode> expectedEvents) {
    before(enabledEvents, expectedEvents);
    final Context mediaDriverCtx = new Context().errorHandler(Tests::onError).dirDeleteOnStart(true).threadingMode(ThreadingMode.SHARED);
    final AeronArchive.Context aeronArchiveContext = new AeronArchive.Context().controlRequestChannel("aeron:ipc?term-length=64k").controlRequestStreamId(AeronArchive.Configuration.localControlStreamId()).controlResponseChannel("aeron:ipc?term-length=64k").controlResponseStreamId(AeronArchive.Configuration.localControlStreamId() + 1).controlResponseStreamId(101);
    final Archive.Context archiveCtx = new Archive.Context().errorHandler(Tests::onError).archiveDir(new File(testDir, "archive")).deleteArchiveOnStart(true).recordingEventsEnabled(false).threadingMode(ArchiveThreadingMode.SHARED);
    final ConsensusModule.Context consensusModuleCtx = new ConsensusModule.Context().errorHandler(ClusterTests.errorHandler(0)).clusterDir(new File(testDir, "consensus-module")).archiveContext(aeronArchiveContext.clone()).clusterMemberId(0).clusterMembers("0,localhost:20110,localhost:20220,localhost:20330,localhost:20440,localhost:8010").logChannel("aeron:udp?term-length=256k|control-mode=manual|control=localhost:20550").ingressChannel("aeron:udp?term-length=64k").replicationChannel("aeron:udp?endpoint=localhost:0");
    final ClusteredService clusteredService = mock(ClusteredService.class);
    final ClusteredServiceContainer.Context clusteredServiceCtx = new ClusteredServiceContainer.Context().errorHandler(ClusterTests.errorHandler(0)).archiveContext(aeronArchiveContext.clone()).clusterDir(new File(testDir, "service")).clusteredService(clusteredService);
    clusteredMediaDriver = ClusteredMediaDriver.launch(mediaDriverCtx, archiveCtx, consensusModuleCtx);
    container = ClusteredServiceContainer.launch(clusteredServiceCtx);
    Tests.await(WAIT_LIST::isEmpty);
    final Counter state = clusteredMediaDriver.consensusModule().context().electionStateCounter();
    final Supplier<String> message = () -> ElectionState.get(state).toString();
    while (ElectionState.CLOSED != ElectionState.get(state)) {
        Tests.sleep(1, message);
    }
}
Also used : Context(io.aeron.driver.MediaDriver.Context) AeronArchive(io.aeron.archive.client.AeronArchive) Archive(io.aeron.archive.Archive) ClusteredService(io.aeron.cluster.service.ClusteredService) AeronArchive(io.aeron.archive.client.AeronArchive) ClusterTests(io.aeron.test.cluster.ClusterTests) Tests(io.aeron.test.Tests) Counter(io.aeron.Counter) ConsensusModule(io.aeron.cluster.ConsensusModule) File(java.io.File) ClusteredServiceContainer(io.aeron.cluster.service.ClusteredServiceContainer)

Example 4 with Context

use of io.aeron.driver.MediaDriver.Context in project aeron by real-logic.

the class MediaDriverContextTest method nakMulticastMaxBackoffNsExplicitValue.

@Test
public void nakMulticastMaxBackoffNsExplicitValue() {
    final Context context = new Context();
    context.nakMulticastMaxBackoffNs(Long.MIN_VALUE);
    assertEquals(Long.MIN_VALUE, context.nakMulticastMaxBackoffNs());
}
Also used : Context(io.aeron.driver.MediaDriver.Context) Test(org.junit.jupiter.api.Test)

Example 5 with Context

use of io.aeron.driver.MediaDriver.Context in project aeron by real-logic.

the class MediaDriverContextTest method nakMulticastMaxBackoffNsValueFromSystemProperty.

@Test
public void nakMulticastMaxBackoffNsValueFromSystemProperty() {
    System.setProperty(NAK_MULTICAST_MAX_BACKOFF_PROP_NAME, "333");
    try {
        final Context context = new Context();
        assertEquals(333, context.nakMulticastMaxBackoffNs());
    } finally {
        System.clearProperty(NAK_MULTICAST_MAX_BACKOFF_PROP_NAME);
    }
}
Also used : Context(io.aeron.driver.MediaDriver.Context) Test(org.junit.jupiter.api.Test)

Aggregations

Context (io.aeron.driver.MediaDriver.Context)8 Test (org.junit.jupiter.api.Test)6 Counter (io.aeron.Counter)2 Archive (io.aeron.archive.Archive)2 AeronArchive (io.aeron.archive.client.AeronArchive)2 ConsensusModule (io.aeron.cluster.ConsensusModule)2 ClusteredService (io.aeron.cluster.service.ClusteredService)2 ClusteredServiceContainer (io.aeron.cluster.service.ClusteredServiceContainer)2 Tests (io.aeron.test.Tests)2 ClusterTests (io.aeron.test.cluster.ClusterTests)2 File (java.io.File)2