use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.
the class TestSystemTaskExecutor method testMultipleQueuesExecution.
@Test
public void testMultipleQueuesExecution() {
System.setProperty("workflow.system.task.worker.thread.count", "1");
System.setProperty("workflow.isolated.system.task.worker.thread.count", "1");
String sysTask = "taskId";
String isolatedTask = "isolatedTaskId";
Configuration configuration = new SystemPropertiesConfiguration();
when(queueDAO.pop(TEST_TASK, 1, 200)).thenReturn(Collections.singletonList(sysTask));
when(queueDAO.pop(ISOLATED_TASK, 1, 200)).thenReturn(Collections.singletonList(isolatedTask));
systemTaskExecutor = new SystemTaskExecutor(queueDAO, workflowExecutor, configuration, executionService);
CountDownLatch sysTaskLatch = new CountDownLatch(1);
CountDownLatch isolatedTaskLatch = new CountDownLatch(1);
doAnswer(invocation -> {
Object[] args = invocation.getArguments();
String taskId = args[1].toString();
if (taskId.equals(sysTask)) {
sysTaskLatch.countDown();
}
if (taskId.equals(isolatedTask)) {
isolatedTaskLatch.countDown();
}
return null;
}).when(workflowExecutor).executeSystemTask(any(), anyString(), anyInt());
scheduledExecutorService.scheduleAtFixedRate(() -> systemTaskExecutor.pollAndExecute(TEST_TASK), 0, 1, TimeUnit.SECONDS);
ScheduledExecutorService isoTaskService = Executors.newSingleThreadScheduledExecutor();
isoTaskService.scheduleAtFixedRate(() -> systemTaskExecutor.pollAndExecute(ISOLATED_TASK), 0, 1, TimeUnit.SECONDS);
Uninterruptibles.awaitUninterruptibly(sysTaskLatch);
Uninterruptibles.awaitUninterruptibly(isolatedTaskLatch);
shutdownExecutorService(isoTaskService);
}
use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.
the class TestSystemTaskExecutor method testPollAndExecuteSystemTask.
@Test
public void testPollAndExecuteSystemTask() {
System.setProperty("workflow.system.task.worker.thread.count", "1");
Configuration configuration = new SystemPropertiesConfiguration();
when(queueDAO.pop(anyString(), anyInt(), anyInt())).thenReturn(Collections.singletonList("taskId"));
systemTaskExecutor = new SystemTaskExecutor(queueDAO, workflowExecutor, configuration, executionService);
CountDownLatch latch = new CountDownLatch(1);
doAnswer(invocation -> {
latch.countDown();
return null;
}).when(workflowExecutor).executeSystemTask(any(), anyString(), anyInt());
scheduledExecutorService.scheduleAtFixedRate(() -> systemTaskExecutor.pollAndExecute(TEST_TASK), 0, 1, TimeUnit.SECONDS);
Uninterruptibles.awaitUninterruptibly(latch);
verify(workflowExecutor).executeSystemTask(any(), anyString(), anyInt());
}
use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.
the class TestSystemTaskWorkerCoordinator method testIsFromCoordinatorExecutionNameSpace.
@Test
public void testIsFromCoordinatorExecutionNameSpace() {
System.setProperty("workflow.system.task.worker.executionNameSpace", "exeNS");
Configuration configuration = new SystemPropertiesConfiguration();
SystemTaskWorkerCoordinator systemTaskWorkerCoordinator = new SystemTaskWorkerCoordinator(queueDAO, workflowExecutor, configuration, executionService);
assertTrue(systemTaskWorkerCoordinator.isFromCoordinatorExecutionNameSpace(TEST_QUEUE + EXECUTION_NAMESPACE_CONSTANT));
}
use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.
the class TestKafkaProducerManager method testRequestTimeoutSetFromInput.
@Test
public void testRequestTimeoutSetFromInput() {
KafkaProducerManager manager = new KafkaProducerManager(new SystemPropertiesConfiguration());
KafkaPublishTask.Input input = getInput();
input.setRequestTimeoutMs(200);
Properties props = manager.getProducerProperties(input);
Assert.assertEquals(props.getProperty(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG), "200");
}
use of com.netflix.conductor.core.config.SystemPropertiesConfiguration in project conductor by Netflix.
the class TestKafkaPublishTask method longSerializer_longObject.
@Test
public void longSerializer_longObject() {
KafkaPublishTask kPublishTask = new KafkaPublishTask(new SystemPropertiesConfiguration(), new KafkaProducerManager(new SystemPropertiesConfiguration()), objectMapper);
KafkaPublishTask.Input input = new KafkaPublishTask.Input();
input.setKeySerializer(LongSerializer.class.getCanonicalName());
input.setKey(String.valueOf(Long.MAX_VALUE));
Assert.assertEquals(kPublishTask.getKey(input), new Long(Long.MAX_VALUE));
}
Aggregations