use of io.aeron.logbuffer.FragmentHandler in project Aeron by real-logic.
the class SubscriptionTest method shouldReadDataFromMultipleSources.
@Test
public void shouldReadDataFromMultipleSources() {
subscription.addImage(imageOneMock);
subscription.addImage(imageTwoMock);
when(imageOneMock.poll(any(FragmentHandler.class), anyInt())).then((invocation) -> {
final FragmentHandler handler = (FragmentHandler) invocation.getArguments()[0];
handler.onFragment(atomicReadBuffer, HEADER_LENGTH, READ_BUFFER_CAPACITY - HEADER_LENGTH, header);
return 1;
});
when(imageTwoMock.poll(any(FragmentHandler.class), anyInt())).then((invocation) -> {
final FragmentHandler handler = (FragmentHandler) invocation.getArguments()[0];
handler.onFragment(atomicReadBuffer, HEADER_LENGTH, READ_BUFFER_CAPACITY - HEADER_LENGTH, header);
return 1;
});
assertThat(subscription.poll(fragmentHandler, FRAGMENT_COUNT_LIMIT), is(2));
}
Aggregations