use of io.aeron.driver.cmd.NewPublicationCmd in project Aeron by real-logic.
the class SenderTest method setUp.
@Before
public void setUp() throws Exception {
final SendChannelEndpoint mockSendChannelEndpoint = mock(SendChannelEndpoint.class);
when(mockSendChannelEndpoint.udpChannel()).thenReturn(udpChannel);
when(mockSendChannelEndpoint.send(any())).thenAnswer(saveByteBufferAnswer);
when(mockSystemCounters.get(any())).thenReturn(mock(AtomicCounter.class));
sender = new Sender(new MediaDriver.Context().controlTransportPoller(mockTransportPoller).systemCounters(mockSystemCounters).senderCommandQueue(senderCommandQueue).nanoClock(() -> currentTimestamp));
LogBufferDescriptor.initialiseTailWithTermId(rawLog.metaData(), 0, INITIAL_TERM_ID);
termAppenders = new TermAppender[PARTITION_COUNT];
for (int i = 0; i < PARTITION_COUNT; i++) {
termAppenders[i] = new TermAppender(rawLog.termBuffers()[i], rawLog.metaData(), i);
}
publication = new NetworkPublication(1, mockSendChannelEndpoint, () -> currentTimestamp, () -> currentTimestamp / (1_000_000L), rawLog, mock(Position.class), new AtomicLongPosition(), new AtomicLongPosition(), SESSION_ID, STREAM_ID, INITIAL_TERM_ID, MAX_FRAME_LENGTH, mockSystemCounters, flowControl, mockRetransmitHandler, new NetworkPublicationThreadLocals(), Configuration.PUBLICATION_UNBLOCK_TIMEOUT_NS, false);
senderCommandQueue.offer(new NewPublicationCmd(publication));
}
Aggregations