Search in sources :

Example 1 with CursorOperationsService

use of org.zalando.nakadi.service.CursorOperationsService in project nakadi by zalando.

the class PartitionsControllerTest method before.

@Before
public void before() throws InternalNakadiException, NoSuchEventTypeException {
    eventTypeRepositoryMock = mock(EventTypeRepository.class);
    topicRepositoryMock = mock(TopicRepository.class);
    eventTypeCache = mock(EventTypeCache.class);
    timelineService = Mockito.mock(TimelineService.class);
    cursorOperationsService = Mockito.mock(CursorOperationsService.class);
    when(timelineService.getActiveTimelinesOrdered(eq(UNKNOWN_EVENT_TYPE))).thenThrow(NoSuchEventTypeException.class);
    when(timelineService.getActiveTimelinesOrdered(eq(TEST_EVENT_TYPE))).thenReturn(Collections.singletonList(TIMELINE));
    when(timelineService.getAllTimelinesOrdered(eq(TEST_EVENT_TYPE))).thenReturn(Collections.singletonList(TIMELINE));
    when(timelineService.getTopicRepository((Timeline) any())).thenReturn(topicRepositoryMock);
    final CursorConverter cursorConverter = new CursorConverterImpl(eventTypeCache, timelineService);
    final PartitionsController controller = new PartitionsController(timelineService, cursorConverter, cursorOperationsService, eventTypeRepositoryMock, authorizationValidator);
    settings = mock(SecuritySettings.class);
    final FeatureToggleService featureToggleService = Mockito.mock(FeatureToggleService.class);
    mockMvc = standaloneSetup(controller).setMessageConverters(new StringHttpMessageConverter(), TestUtils.JACKSON_2_HTTP_MESSAGE_CONVERTER).setCustomArgumentResolvers(new ClientResolver(settings, featureToggleService)).setControllerAdvice(new ExceptionHandling()).build();
}
Also used : CursorConverterImpl(org.zalando.nakadi.service.converter.CursorConverterImpl) SecuritySettings(org.zalando.nakadi.config.SecuritySettings) EventTypeCache(org.zalando.nakadi.repository.db.EventTypeCache) CursorConverter(org.zalando.nakadi.service.CursorConverter) ClientResolver(org.zalando.nakadi.security.ClientResolver) StringHttpMessageConverter(org.springframework.http.converter.StringHttpMessageConverter) CursorOperationsService(org.zalando.nakadi.service.CursorOperationsService) FeatureToggleService(org.zalando.nakadi.service.FeatureToggleService) EventTypeRepository(org.zalando.nakadi.repository.EventTypeRepository) TimelineService(org.zalando.nakadi.service.timeline.TimelineService) TopicRepository(org.zalando.nakadi.repository.TopicRepository) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 StringHttpMessageConverter (org.springframework.http.converter.StringHttpMessageConverter)1 SecuritySettings (org.zalando.nakadi.config.SecuritySettings)1 EventTypeRepository (org.zalando.nakadi.repository.EventTypeRepository)1 TopicRepository (org.zalando.nakadi.repository.TopicRepository)1 EventTypeCache (org.zalando.nakadi.repository.db.EventTypeCache)1 ClientResolver (org.zalando.nakadi.security.ClientResolver)1 CursorConverter (org.zalando.nakadi.service.CursorConverter)1 CursorOperationsService (org.zalando.nakadi.service.CursorOperationsService)1 FeatureToggleService (org.zalando.nakadi.service.FeatureToggleService)1 CursorConverterImpl (org.zalando.nakadi.service.converter.CursorConverterImpl)1 TimelineService (org.zalando.nakadi.service.timeline.TimelineService)1