use of org.zalando.nakadi.service.subscription.StreamingContext in project nakadi by zalando.
the class StreamingStateTest method prepareMocks.
@Before
public void prepareMocks() throws Exception {
state = new StreamingState();
final StreamingContext contextMock = mock(StreamingContext.class);
when(contextMock.getCursorComparator()).thenReturn(Comparator.comparing(NakadiCursor::getOffset));
when(contextMock.getSessionId()).thenReturn(SESSION_ID);
when(contextMock.isInState(Mockito.same(state))).thenReturn(true);
subscription = mock(Subscription.class);
when(contextMock.getSubscription()).thenReturn(subscription);
timelineService = mock(TimelineService.class);
when(contextMock.getTimelineService()).thenReturn(timelineService);
final MetricRegistry metricRegistry = mock(MetricRegistry.class);
when(metricRegistry.register(any(), any())).thenReturn(null);
when(contextMock.getMetricRegistry()).thenReturn(metricRegistry);
zkMock = mock(ZkSubscriptionClient.class);
when(contextMock.getZkClient()).thenReturn(zkMock);
cursorConverter = mock(CursorConverter.class);
when(contextMock.getCursorConverter()).thenReturn(cursorConverter);
final Client client = mock(Client.class);
when(client.getClientId()).thenReturn("consumingAppId");
final StreamParameters spMock = createStreamParameters(1000, 100L, 100, 100L, 100, 100, 100, client);
when(contextMock.getParameters()).thenReturn(spMock);
state.setContext(contextMock, "test");
}
Aggregations