Search in sources :

Example 11 with SystemPropertiesConfiguration

use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.

the class TestKafkaPublishTask method missingValue_Fail.

@Test
public void missingValue_Fail() {
    Task task = new Task();
    KafkaPublishTask.Input input = new KafkaPublishTask.Input();
    input.setBootStrapServers("localhost:9092");
    input.setTopic("testTopic");
    task.getInputData().put(KafkaPublishTask.REQUEST_PARAMETER_NAME, input);
    KafkaPublishTask kPublishTask = new KafkaPublishTask(new SystemPropertiesConfiguration(), new KafkaProducerManager(new SystemPropertiesConfiguration()), objectMapper);
    kPublishTask.start(Mockito.mock(Workflow.class), task, Mockito.mock(WorkflowExecutor.class));
    Assert.assertEquals(Task.Status.FAILED, task.getStatus());
}
Also used : Task(com.netflix.conductor.common.metadata.tasks.Task) Workflow(com.netflix.conductor.common.run.Workflow) SystemPropertiesConfiguration(com.netflix.conductor.core.config.SystemPropertiesConfiguration) WorkflowExecutor(com.netflix.conductor.core.execution.WorkflowExecutor) Test(org.junit.Test)

Example 12 with SystemPropertiesConfiguration

use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.

the class TestKafkaPublishTask method kafkaPublishUnknownException_Fail.

@Test
public void kafkaPublishUnknownException_Fail() throws ExecutionException, InterruptedException {
    Task task = getTask();
    KafkaProducerManager producerManager = Mockito.mock(KafkaProducerManager.class);
    KafkaPublishTask kPublishTask = new KafkaPublishTask(new SystemPropertiesConfiguration(), producerManager, objectMapper);
    Producer producer = Mockito.mock(Producer.class);
    Mockito.when(producerManager.getProducer(Mockito.any())).thenReturn(producer);
    Mockito.when(producer.send(Mockito.any())).thenThrow(new RuntimeException("Unknown exception"));
    kPublishTask.start(Mockito.mock(Workflow.class), task, Mockito.mock(WorkflowExecutor.class));
    Assert.assertEquals(Task.Status.FAILED, task.getStatus());
    Assert.assertEquals("Failed to invoke kafka task due to: Unknown exception", task.getReasonForIncompletion());
}
Also used : Task(com.netflix.conductor.common.metadata.tasks.Task) Producer(org.apache.kafka.clients.producer.Producer) Workflow(com.netflix.conductor.common.run.Workflow) SystemPropertiesConfiguration(com.netflix.conductor.core.config.SystemPropertiesConfiguration) WorkflowExecutor(com.netflix.conductor.core.execution.WorkflowExecutor) Test(org.junit.Test)

Example 13 with SystemPropertiesConfiguration

use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.

the class TestKafkaPublishTask method missingRequest_Fail.

@Test
public void missingRequest_Fail() {
    KafkaPublishTask kPublishTask = new KafkaPublishTask(new SystemPropertiesConfiguration(), new KafkaProducerManager(new SystemPropertiesConfiguration()), objectMapper);
    Task task = new Task();
    kPublishTask.start(Mockito.mock(Workflow.class), task, Mockito.mock(WorkflowExecutor.class));
    Assert.assertEquals(Task.Status.FAILED, task.getStatus());
}
Also used : Task(com.netflix.conductor.common.metadata.tasks.Task) Workflow(com.netflix.conductor.common.run.Workflow) SystemPropertiesConfiguration(com.netflix.conductor.core.config.SystemPropertiesConfiguration) WorkflowExecutor(com.netflix.conductor.core.execution.WorkflowExecutor) Test(org.junit.Test)

Example 14 with SystemPropertiesConfiguration

use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.

the class ServletContextListener method getInjector.

@Override
protected Injector getInjector() {
    loadProperties();
    SystemPropertiesConfiguration config = new SystemPropertiesConfiguration();
    serverInjector = Guice.createInjector(new ModulesProvider(config).get());
    return serverInjector;
}
Also used : ModulesProvider(com.netflix.conductor.bootstrap.ModulesProvider) SystemPropertiesConfiguration(com.netflix.conductor.core.config.SystemPropertiesConfiguration)

Example 15 with SystemPropertiesConfiguration

use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.

the class TestSystemTaskExecutor method testGetExecutionConfigForIsolatedSystemTask.

@Test
public void testGetExecutionConfigForIsolatedSystemTask() {
    System.setProperty("workflow.isolated.system.task.worker.thread.count", "7");
    Configuration configuration = new SystemPropertiesConfiguration();
    systemTaskExecutor = new SystemTaskExecutor(queueDAO, workflowExecutor, configuration, executionService);
    assertEquals(systemTaskExecutor.getExecutionConfig("test-iso").getSemaphoreUtil().availableSlots(), 7);
}
Also used : Configuration(com.netflix.conductor.core.config.Configuration) SystemPropertiesConfiguration(com.netflix.conductor.core.config.SystemPropertiesConfiguration) SystemPropertiesConfiguration(com.netflix.conductor.core.config.SystemPropertiesConfiguration) Test(org.junit.Test)

Aggregations

SystemPropertiesConfiguration (com.netflix.conductor.core.config.SystemPropertiesConfiguration)22 Test (org.junit.Test)21 Configuration (com.netflix.conductor.core.config.Configuration)9 Task (com.netflix.conductor.common.metadata.tasks.Task)7 Workflow (com.netflix.conductor.common.run.Workflow)7 WorkflowExecutor (com.netflix.conductor.core.execution.WorkflowExecutor)7 CountDownLatch (java.util.concurrent.CountDownLatch)6 Producer (org.apache.kafka.clients.producer.Producer)4 Future (java.util.concurrent.Future)3 Properties (java.util.Properties)2 ModulesProvider (com.netflix.conductor.bootstrap.ModulesProvider)1 HashMap (java.util.HashMap)1 ExecutionException (java.util.concurrent.ExecutionException)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 IntegerSerializer (org.apache.kafka.common.serialization.IntegerSerializer)1 LongSerializer (org.apache.kafka.common.serialization.LongSerializer)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1