Search in sources :

Example 1 with Context

use of io.aeron.archive.Archive.Context in project Aeron by real-logic.

the class ArchiveTest method dataBufferIsAllocatedOnDemand.

@Test
void dataBufferIsAllocatedOnDemand() {
    final Context context = new Context();
    final UnsafeBuffer buffer = context.dataBuffer();
    assertNotNull(buffer);
    assertEquals(context.fileIoMaxLength(), buffer.capacity());
    assertSame(buffer, context.dataBuffer());
}
Also used : Context(io.aeron.archive.Archive.Context) CommonContext(io.aeron.CommonContext) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with Context

use of io.aeron.archive.Archive.Context in project Aeron by real-logic.

the class ArchiveTest method replayBufferReturnsDataBufferIfThreadingModeIsNotDEDICATED.

@ParameterizedTest
@EnumSource(value = ArchiveThreadingMode.class, mode = EXCLUDE, names = "DEDICATED")
void replayBufferReturnsDataBufferIfThreadingModeIsNotDEDICATED(final ArchiveThreadingMode threadingMode) {
    final Archive.Context context = new Archive.Context().threadingMode(threadingMode);
    final UnsafeBuffer buffer = context.replayBuffer();
    assertSame(context.dataBuffer(), buffer);
}
Also used : AeronArchive(io.aeron.archive.client.AeronArchive) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) Context(io.aeron.archive.Archive.Context) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with Context

use of io.aeron.archive.Archive.Context in project Aeron by real-logic.

the class ArchiveTest method recordChecksumBufferReturnsNullIfRecordChecksumIsNull.

@Test
void recordChecksumBufferReturnsNullIfRecordChecksumIsNull() {
    final Archive.Context context = new Archive.Context();
    assertNull(context.recordChecksumBuffer());
}
Also used : Context(io.aeron.archive.Archive.Context) CommonContext(io.aeron.CommonContext) AeronArchive(io.aeron.archive.client.AeronArchive) Context(io.aeron.archive.Archive.Context) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with Context

use of io.aeron.archive.Archive.Context in project Aeron by real-logic.

the class ArchiveTest method recordChecksumBufferReturnsValueAssignedIfThreadingModeIsDEDICATED.

@Test
void recordChecksumBufferReturnsValueAssignedIfThreadingModeIsDEDICATED() {
    final UnsafeBuffer buffer = mock(UnsafeBuffer.class);
    final Checksum recordChecksum = mock(Checksum.class);
    final Archive.Context context = new Archive.Context().recordChecksum(recordChecksum).threadingMode(DEDICATED);
    context.recordChecksumBuffer(buffer);
    assertSame(buffer, context.recordChecksumBuffer());
}
Also used : Context(io.aeron.archive.Archive.Context) CommonContext(io.aeron.CommonContext) AeronArchive(io.aeron.archive.client.AeronArchive) Checksum(io.aeron.archive.checksum.Checksum) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) Context(io.aeron.archive.Archive.Context) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with Context

use of io.aeron.archive.Archive.Context in project Aeron by real-logic.

the class ArchiveTest method replayBufferReturnsValueAssignedIfThreadingModeIsDEDICATED.

@Test
void replayBufferReturnsValueAssignedIfThreadingModeIsDEDICATED() {
    final UnsafeBuffer buffer = mock(UnsafeBuffer.class);
    final Archive.Context context = new Archive.Context().threadingMode(DEDICATED);
    context.replayBuffer(buffer);
    assertSame(buffer, context.replayBuffer());
}
Also used : AeronArchive(io.aeron.archive.client.AeronArchive) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) Context(io.aeron.archive.Archive.Context) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Context (io.aeron.archive.Archive.Context)40 Test (org.junit.jupiter.api.Test)36 UnsafeBuffer (org.agrona.concurrent.UnsafeBuffer)30 Image (io.aeron.Image)20 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)20 CommonContext (io.aeron.CommonContext)16 File (java.io.File)16 AeronArchive (io.aeron.archive.client.AeronArchive)14 Checksum (io.aeron.archive.checksum.Checksum)6 EnumSource (org.junit.jupiter.params.provider.EnumSource)4 ArchiveException (io.aeron.archive.client.ArchiveException)2 MediaDriver (io.aeron.driver.MediaDriver)2 Tests (io.aeron.test.Tests)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)2 ManyToOneConcurrentLinkedQueue (org.agrona.concurrent.ManyToOneConcurrentLinkedQueue)2