use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.
the class TestKafkaProducerManager method testRequestTimeoutSetFromDefault.
@Test
public void testRequestTimeoutSetFromDefault() {
KafkaProducerManager manager = new KafkaProducerManager(new SystemPropertiesConfiguration());
KafkaPublishTask.Input input = getInput();
Properties props = manager.getProducerProperties(input);
Assert.assertEquals(props.getProperty(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG), "100");
}
use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.
the class TestKafkaPublishTask method kafkaPublishSuccess_Completed.
@Test
public void kafkaPublishSuccess_Completed() 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())).thenReturn(Mockito.mock(Future.class));
kPublishTask.start(Mockito.mock(Workflow.class), task, Mockito.mock(WorkflowExecutor.class));
Assert.assertEquals(Task.Status.COMPLETED, task.getStatus());
}
use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.
the class TestKafkaPublishTask method integerSerializer_integerObject.
@Test
public void integerSerializer_integerObject() {
KafkaPublishTask kPublishTask = new KafkaPublishTask(new SystemPropertiesConfiguration(), new KafkaProducerManager(new SystemPropertiesConfiguration()), objectMapper);
KafkaPublishTask.Input input = new KafkaPublishTask.Input();
input.setKeySerializer(IntegerSerializer.class.getCanonicalName());
input.setKey(String.valueOf(Integer.MAX_VALUE));
Assert.assertEquals(kPublishTask.getKey(input), new Integer(Integer.MAX_VALUE));
}
use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.
the class TestKafkaPublishTask method kafkaPublishSuccess_AsyncComplete.
@Test
public void kafkaPublishSuccess_AsyncComplete() {
Task task = getTask();
task.getInputData().put("asyncComplete", true);
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())).thenReturn(Mockito.mock(Future.class));
kPublishTask.start(Mockito.mock(Workflow.class), task, Mockito.mock(WorkflowExecutor.class));
Assert.assertEquals(Task.Status.IN_PROGRESS, task.getStatus());
}
use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.
the class TestKafkaPublishTask method missingBootStrapServers_Fail.
@Test
public void missingBootStrapServers_Fail() {
Task task = new Task();
KafkaPublishTask.Input input = new KafkaPublishTask.Input();
Map<String, Object> value = new HashMap<>();
input.setValue(value);
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());
}
Aggregations