use of org.agrona.concurrent.ringbuffer.RingBuffer in project Aeron by real-logic.
the class IpcPublicationTest method setUp.
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
final RingBuffer fromClientCommands = new ManyToOneRingBuffer(new UnsafeBuffer(ByteBuffer.allocateDirect(Configuration.CONDUCTOR_BUFFER_LENGTH)));
final RawLogFactory mockRawLogFactory = mock(RawLogFactory.class);
final UnsafeBuffer counterBuffer = new UnsafeBuffer(ByteBuffer.allocateDirect(BUFFER_LENGTH));
final CountersManager countersManager = new CountersManager(new UnsafeBuffer(ByteBuffer.allocateDirect(BUFFER_LENGTH * 2)), counterBuffer);
when(mockRawLogFactory.newIpcPublication(anyInt(), anyInt(), anyLong(), anyInt())).thenReturn(LogBufferHelper.newTestLogBuffers(TERM_BUFFER_LENGTH));
final MediaDriver.Context ctx = new MediaDriver.Context().toDriverCommands(fromClientCommands).rawLogBuffersFactory(mockRawLogFactory).clientProxy(mock(ClientProxy.class)).toConductorFromReceiverCommandQueue(mock(OneToOneConcurrentArrayQueue.class)).toConductorFromSenderCommandQueue(mock(OneToOneConcurrentArrayQueue.class)).epochClock(new SystemEpochClock()).countersManager(countersManager).systemCounters(mock(SystemCounters.class)).nanoClock(nanoClock);
ctx.countersValuesBuffer(counterBuffer);
driverProxy = new DriverProxy(fromClientCommands);
driverConductor = new DriverConductor(ctx);
driverProxy.addPublication(CommonContext.IPC_CHANNEL, STREAM_ID);
driverConductor.doWork();
ipcPublication = driverConductor.getIpcSharedPublication(STREAM_ID);
publisherLimit = new UnsafeBufferPosition(counterBuffer, ipcPublication.publisherLimitId());
}
Aggregations