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());
}
Aggregations