use of com.netflix.conductor.service.MetadataService in project conductor by Netflix.
the class TestSimpleEventProcessor method testExecuteNonRetriableApplicationException.
@Test
public void testExecuteNonRetriableApplicationException() {
AtomicInteger executeInvoked = new AtomicInteger(0);
doAnswer((Answer<Map<String, Object>>) invocation -> {
executeInvoked.incrementAndGet();
throw new ApplicationException(ApplicationException.Code.INVALID_INPUT, "some non-retriable error");
}).when(actionProcessor).execute(any(), any(), any(), any());
SimpleEventProcessor eventProcessor = new SimpleEventProcessor(executionService, metadataService, actionProcessor, eventQueues, jsonUtils, new TestConfiguration(), objectMapper);
EventExecution eventExecution = new EventExecution("id", "messageId");
eventExecution.setStatus(EventExecution.Status.IN_PROGRESS);
eventExecution.setEvent("event");
eventExecution.setName("handler");
Action action = new Action();
action.setAction(Type.start_workflow);
eventExecution.setAction(Type.start_workflow);
eventProcessor.execute(eventExecution, action, "payload");
assertEquals(1, executeInvoked.get());
assertEquals(EventExecution.Status.FAILED, eventExecution.getStatus());
assertNotNull(eventExecution.getOutput().get("exception"));
}
use of com.netflix.conductor.service.MetadataService in project conductor by Netflix.
the class TestIsolatedTaskQueueProducer method addTaskQueuesAddsElementToQueue.
@Test
public void addTaskQueuesAddsElementToQueue() throws InterruptedException {
SystemTaskWorkerCoordinator.taskNameWorkflowTaskMapping.put("HTTP", Mockito.mock(WorkflowSystemTask.class));
MetadataService metadataService = Mockito.mock(MetadataService.class);
IsolatedTaskQueueProducer isolatedTaskQueueProducer = new IsolatedTaskQueueProducer(metadataService, Mockito.mock(Configuration.class));
TaskDef taskDef = new TaskDef();
taskDef.setIsolationGroupId("isolated");
Mockito.when(metadataService.getTaskDefs()).thenReturn(Arrays.asList(taskDef));
isolatedTaskQueueProducer.addTaskQueues();
Assert.assertFalse(SystemTaskWorkerCoordinator.queue.isEmpty());
}
Aggregations