Search in sources :

Example 1 with ServiceInterceptor

use of com.netflix.conductor.interceptors.ServiceInterceptor in project conductor by Netflix.

the class EventServiceTest method before.

@Before
public void before() {
    metadataService = Mockito.mock(MetadataService.class);
    eventProcessor = Mockito.mock(SimpleEventProcessor.class);
    eventQueues = Mockito.mock(EventQueues.class);
    Injector injector = Guice.createInjector(new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetadataService.class).toInstance(metadataService);
            bind(EventProcessor.class).toInstance(eventProcessor);
            bind(EventQueues.class).toInstance(eventQueues);
            install(new ValidationModule());
            bindInterceptor(Matchers.any(), Matchers.annotatedWith(Service.class), new ServiceInterceptor(getProvider(Validator.class)));
        }
    });
    eventService = injector.getInstance(EventServiceImpl.class);
}
Also used : Injector(com.google.inject.Injector) EventQueues(com.netflix.conductor.core.events.EventQueues) SimpleEventProcessor(com.netflix.conductor.core.events.SimpleEventProcessor) ServiceInterceptor(com.netflix.conductor.interceptors.ServiceInterceptor) ValidationModule(com.netflix.conductor.core.config.ValidationModule) Validator(javax.validation.Validator) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Example 2 with ServiceInterceptor

use of com.netflix.conductor.interceptors.ServiceInterceptor in project conductor by Netflix.

the class MetadataMapperServiceTest method before.

@Before
public void before() {
    metadataMapperService = Mockito.mock(MetadataMapperService.class);
    Injector injector = Guice.createInjector(new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetadataDAO.class).toInstance(metadataDAO);
            install(new ValidationModule());
            bindInterceptor(Matchers.any(), Matchers.annotatedWith(Service.class), new ServiceInterceptor(getProvider(Validator.class)));
        }
    });
    metadataMapperService = injector.getInstance(MetadataMapperService.class);
}
Also used : Injector(com.google.inject.Injector) ServiceInterceptor(com.netflix.conductor.interceptors.ServiceInterceptor) ValidationModule(com.netflix.conductor.core.config.ValidationModule) Validator(javax.validation.Validator) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Example 3 with ServiceInterceptor

use of com.netflix.conductor.interceptors.ServiceInterceptor in project conductor by Netflix.

the class TaskServiceTest method before.

@Before
public void before() {
    executionService = Mockito.mock(ExecutionService.class);
    queueDAO = Mockito.mock(QueueDAO.class);
    Injector injector = Guice.createInjector(new AbstractModule() {

        @Override
        protected void configure() {
            bind(ExecutionService.class).toInstance(executionService);
            bind(QueueDAO.class).toInstance(queueDAO);
            install(new ValidationModule());
            bindInterceptor(Matchers.any(), Matchers.annotatedWith(Service.class), new ServiceInterceptor(getProvider(Validator.class)));
        }
    });
    taskService = injector.getInstance(TaskServiceImpl.class);
}
Also used : QueueDAO(com.netflix.conductor.dao.QueueDAO) Injector(com.google.inject.Injector) ServiceInterceptor(com.netflix.conductor.interceptors.ServiceInterceptor) ValidationModule(com.netflix.conductor.core.config.ValidationModule) Validator(javax.validation.Validator) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Example 4 with ServiceInterceptor

use of com.netflix.conductor.interceptors.ServiceInterceptor in project conductor by Netflix.

the class WorkflowServiceTest method before.

@Before
public void before() {
    this.mockWorkflowExecutor = Mockito.mock(WorkflowExecutor.class);
    this.mockExecutionService = Mockito.mock(ExecutionService.class);
    this.mockMetadata = Mockito.mock(MetadataService.class);
    Configuration mockConfig = Mockito.mock(Configuration.class);
    when(mockConfig.getIntProperty(anyString(), anyInt())).thenReturn(5_000);
    this.workflowService = new WorkflowServiceImpl(this.mockWorkflowExecutor, this.mockExecutionService, this.mockMetadata, mockConfig);
    Injector injector = Guice.createInjector(new AbstractModule() {

        @Override
        protected void configure() {
            bind(WorkflowExecutor.class).toInstance(mockWorkflowExecutor);
            bind(ExecutionService.class).toInstance(mockExecutionService);
            bind(MetadataService.class).toInstance(mockMetadata);
            bind(Configuration.class).toInstance(mockConfig);
            install(new ValidationModule());
            bindInterceptor(Matchers.any(), Matchers.annotatedWith(Service.class), new ServiceInterceptor(getProvider(Validator.class)));
        }
    });
    workflowService = injector.getInstance(WorkflowServiceImpl.class);
}
Also used : Configuration(com.netflix.conductor.core.config.Configuration) Injector(com.google.inject.Injector) WorkflowExecutor(com.netflix.conductor.core.execution.WorkflowExecutor) ServiceInterceptor(com.netflix.conductor.interceptors.ServiceInterceptor) ValidationModule(com.netflix.conductor.core.config.ValidationModule) Validator(javax.validation.Validator) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Example 5 with ServiceInterceptor

use of com.netflix.conductor.interceptors.ServiceInterceptor in project conductor by Netflix.

the class MetadataServiceTest method before.

@Before
public void before() {
    metadataDAO = Mockito.mock(MetadataDAO.class);
    eventHandlerDAO = Mockito.mock(EventHandlerDAO.class);
    eventQueues = Mockito.mock(EventQueues.class);
    configuration = Mockito.mock(Configuration.class);
    when(configuration.isOwnerEmailMandatory()).thenReturn(true);
    Injector injector = Guice.createInjector(new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetadataDAO.class).toInstance(metadataDAO);
            bind(EventHandlerDAO.class).toInstance(eventHandlerDAO);
            bind(EventQueues.class).toInstance(eventQueues);
            bind(Configuration.class).toInstance(configuration);
            install(new ValidationModule());
            bindInterceptor(Matchers.any(), Matchers.annotatedWith(Service.class), new ServiceInterceptor(getProvider(Validator.class)));
        }
    });
    metadataService = injector.getInstance(MetadataServiceImpl.class);
}
Also used : Configuration(com.netflix.conductor.core.config.Configuration) Injector(com.google.inject.Injector) EventQueues(com.netflix.conductor.core.events.EventQueues) ServiceInterceptor(com.netflix.conductor.interceptors.ServiceInterceptor) ValidationModule(com.netflix.conductor.core.config.ValidationModule) EventHandlerDAO(com.netflix.conductor.dao.EventHandlerDAO) Validator(javax.validation.Validator) MetadataDAO(com.netflix.conductor.dao.MetadataDAO) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Aggregations

ValidationModule (com.netflix.conductor.core.config.ValidationModule)7 ServiceInterceptor (com.netflix.conductor.interceptors.ServiceInterceptor)7 AbstractModule (com.google.inject.AbstractModule)6 Injector (com.google.inject.Injector)6 Validator (javax.validation.Validator)6 Before (org.junit.Before)6 Configuration (com.netflix.conductor.core.config.Configuration)2 EventQueues (com.netflix.conductor.core.events.EventQueues)2 WorkflowExecutor (com.netflix.conductor.core.execution.WorkflowExecutor)2 ArchaiusModule (com.netflix.archaius.guice.ArchaiusModule)1 Service (com.netflix.conductor.annotations.Service)1 CoreModule (com.netflix.conductor.core.config.CoreModule)1 EventModule (com.netflix.conductor.core.config.EventModule)1 SystemPropertiesConfiguration (com.netflix.conductor.core.config.SystemPropertiesConfiguration)1 SimpleEventProcessor (com.netflix.conductor.core.events.SimpleEventProcessor)1 WorkflowSweeper (com.netflix.conductor.core.execution.WorkflowSweeper)1 EventHandlerDAO (com.netflix.conductor.dao.EventHandlerDAO)1 MetadataDAO (com.netflix.conductor.dao.MetadataDAO)1 QueueDAO (com.netflix.conductor.dao.QueueDAO)1 GRPCModule (com.netflix.conductor.grpc.server.GRPCModule)1