Search in sources :

Example 6 with TestLogFactory

use of io.aeron.driver.buffer.TestLogFactory in project aeron by real-logic.

the class DriverConductorTest method before.

@BeforeEach
public void before() {
    counterKeyAndLabel.putInt(COUNTER_KEY_OFFSET, 42);
    counterKeyAndLabel.putStringAscii(COUNTER_LABEL_OFFSET, COUNTER_LABEL);
    final UnsafeBuffer counterBuffer = new UnsafeBuffer(ByteBuffer.allocate(BUFFER_LENGTH));
    final UnsafeBuffer metaDataBuffer = new UnsafeBuffer(ByteBuffer.allocate(Configuration.countersMetadataBufferLength(BUFFER_LENGTH)));
    spyCountersManager = spy(new CountersManager(metaDataBuffer, counterBuffer, StandardCharsets.US_ASCII));
    spySystemCounters = spy(new SystemCounters(spyCountersManager));
    when(spySystemCounters.get(SystemCounterDescriptor.ERRORS)).thenReturn(mockErrorCounter);
    when(mockErrorCounter.appendToLabel(any())).thenReturn(mockErrorCounter);
    final MediaDriver.Context ctx = new MediaDriver.Context().tempBuffer(new UnsafeBuffer(new byte[METADATA_LENGTH])).timerIntervalNs(DEFAULT_TIMER_INTERVAL_NS).publicationTermBufferLength(TERM_BUFFER_LENGTH).ipcTermBufferLength(TERM_BUFFER_LENGTH).unicastFlowControlSupplier(Configuration.unicastFlowControlSupplier()).multicastFlowControlSupplier(Configuration.multicastFlowControlSupplier()).driverCommandQueue(new ManyToOneConcurrentArrayQueue<>(Configuration.CMD_QUEUE_CAPACITY)).errorHandler(mockErrorHandler).logFactory(new TestLogFactory()).countersManager(spyCountersManager).epochClock(epochClock).nanoClock(nanoClock).senderCachedNanoClock(nanoClock).receiverCachedNanoClock(nanoClock).cachedEpochClock(new CachedEpochClock()).cachedNanoClock(new CachedNanoClock()).sendChannelEndpointSupplier(Configuration.sendChannelEndpointSupplier()).receiveChannelEndpointSupplier(Configuration.receiveChannelEndpointSupplier()).congestControlSupplier(Configuration.congestionControlSupplier()).toDriverCommands(toDriverCommands).clientProxy(mockClientProxy).countersValuesBuffer(counterBuffer).systemCounters(spySystemCounters).receiverProxy(receiverProxy).senderProxy(senderProxy).driverConductorProxy(driverConductorProxy).receiveChannelEndpointThreadLocals(new ReceiveChannelEndpointThreadLocals()).conductorCycleThresholdNs(600_000_000).nameResolver(DefaultNameResolver.INSTANCE);
    driverProxy = new DriverProxy(toDriverCommands, toDriverCommands.nextCorrelationId());
    driverConductor = new DriverConductor(ctx);
    driverConductor.onStart();
    doAnswer(closeChannelEndpointAnswer).when(receiverProxy).closeReceiveChannelEndpoint(any());
}
Also used : TestLogFactory(io.aeron.driver.buffer.TestLogFactory) SystemCounters(io.aeron.driver.status.SystemCounters) DriverProxy(io.aeron.DriverProxy) ReceiveChannelEndpointThreadLocals(io.aeron.driver.media.ReceiveChannelEndpointThreadLocals) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

TestLogFactory (io.aeron.driver.buffer.TestLogFactory)6 BeforeEach (org.junit.jupiter.api.BeforeEach)6 DriverProxy (io.aeron.DriverProxy)4 SystemCounters (io.aeron.driver.status.SystemCounters)4 ReceiveChannelEndpointThreadLocals (io.aeron.driver.media.ReceiveChannelEndpointThreadLocals)2 ManyToOneRingBuffer (org.agrona.concurrent.ringbuffer.ManyToOneRingBuffer)2 RingBuffer (org.agrona.concurrent.ringbuffer.RingBuffer)2 AtomicCounter (org.agrona.concurrent.status.AtomicCounter)2 CountersManager (org.agrona.concurrent.status.CountersManager)2 UnsafeBufferPosition (org.agrona.concurrent.status.UnsafeBufferPosition)2