Search in sources :

Example 1 with KafkaConfig

use of org.zalando.nakadi.repository.kafka.KafkaConfig in project nakadi by zalando.

the class EventTypeControllerTestCase method init.

@Before
public void init() throws Exception {
    final NakadiSettings nakadiSettings = new NakadiSettings(0, 0, 0, TOPIC_RETENTION_TIME_MS, 0, 60, NAKADI_POLL_TIMEOUT, NAKADI_SEND_TIMEOUT, 0, NAKADI_EVENT_MAX_BYTES, NAKADI_SUBSCRIPTION_MAX_PARTITIONS, "service", "nakadi", "I am warning you");
    final PartitionsCalculator partitionsCalculator = new KafkaConfig().createPartitionsCalculator("t2.large", TestUtils.OBJECT_MAPPER, nakadiSettings);
    when(timelineService.getTopicRepository((Timeline) any())).thenReturn(topicRepository);
    when(timelineService.getTopicRepository((EventTypeBase) any())).thenReturn(topicRepository);
    when(transactionTemplate.execute(any())).thenAnswer(invocation -> {
        final TransactionCallback callback = (TransactionCallback) invocation.getArguments()[0];
        return callback.doInTransaction(null);
    });
    final EventTypeService eventTypeService = new EventTypeService(eventTypeRepository, timelineService, partitionResolver, enrichment, subscriptionRepository, schemaEvolutionService, partitionsCalculator, featureToggleService, authorizationValidator, timelineSync, transactionTemplate, nakadiSettings, nakadiKpiPublisher, "et-log-event-type");
    final EventTypeOptionsValidator eventTypeOptionsValidator = new EventTypeOptionsValidator(TOPIC_RETENTION_MIN_MS, TOPIC_RETENTION_MAX_MS);
    final EventTypeController controller = new EventTypeController(eventTypeService, featureToggleService, eventTypeOptionsValidator, applicationService, adminService, nakadiSettings);
    doReturn(randomUUID).when(uuid).randomUUID();
    doReturn(true).when(applicationService).exists(any());
    doReturn(true).when(featureToggleService).isFeatureEnabled(CHECK_PARTITIONS_KEYS);
    mockMvc = standaloneSetup(controller).setMessageConverters(new StringHttpMessageConverter(), TestUtils.JACKSON_2_HTTP_MESSAGE_CONVERTER).setCustomArgumentResolvers(new ClientResolver(settings, featureToggleService)).setControllerAdvice(new ExceptionHandling()).build();
}
Also used : TransactionCallback(org.springframework.transaction.support.TransactionCallback) PartitionsCalculator(org.zalando.nakadi.repository.kafka.PartitionsCalculator) EventTypeService(org.zalando.nakadi.service.EventTypeService) EventTypeOptionsValidator(org.zalando.nakadi.validation.EventTypeOptionsValidator) ClientResolver(org.zalando.nakadi.security.ClientResolver) NakadiSettings(org.zalando.nakadi.config.NakadiSettings) StringHttpMessageConverter(org.springframework.http.converter.StringHttpMessageConverter) KafkaConfig(org.zalando.nakadi.repository.kafka.KafkaConfig) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 StringHttpMessageConverter (org.springframework.http.converter.StringHttpMessageConverter)1 TransactionCallback (org.springframework.transaction.support.TransactionCallback)1 NakadiSettings (org.zalando.nakadi.config.NakadiSettings)1 KafkaConfig (org.zalando.nakadi.repository.kafka.KafkaConfig)1 PartitionsCalculator (org.zalando.nakadi.repository.kafka.PartitionsCalculator)1 ClientResolver (org.zalando.nakadi.security.ClientResolver)1 EventTypeService (org.zalando.nakadi.service.EventTypeService)1 EventTypeOptionsValidator (org.zalando.nakadi.validation.EventTypeOptionsValidator)1