Search in sources :

Example 26 with EventHandler

use of com.netflix.conductor.common.metadata.events.EventHandler in project conductor by Netflix.

the class EventHandlerTest method testWorkflowTaskName.

@Test
public void testWorkflowTaskName() {
    // name is null
    EventHandler taskDef = new EventHandler();
    ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
    Validator validator = factory.getValidator();
    Set<ConstraintViolation<Object>> result = validator.validate(taskDef);
    assertEquals(3, result.size());
    List<String> validationErrors = new ArrayList<>();
    result.forEach(e -> validationErrors.add(e.getMessage()));
    assertTrue(validationErrors.contains("Missing event handler name"));
    assertTrue(validationErrors.contains("Missing event location"));
    assertTrue(validationErrors.contains("No actions specified. Please specify at-least one action"));
}
Also used : ValidatorFactory(javax.validation.ValidatorFactory) ConstraintViolation(javax.validation.ConstraintViolation) ArrayList(java.util.ArrayList) EventHandler(com.netflix.conductor.common.metadata.events.EventHandler) Validator(javax.validation.Validator) Test(org.junit.Test)

Aggregations

EventHandler (com.netflix.conductor.common.metadata.events.EventHandler)26 Test (org.junit.Test)14 ApplicationException (com.netflix.conductor.core.execution.ApplicationException)13 Action (com.netflix.conductor.common.metadata.events.EventHandler.Action)6 ArrayList (java.util.ArrayList)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 TaskDetails (com.netflix.conductor.common.metadata.events.EventHandler.TaskDetails)4 TestConfiguration (com.netflix.conductor.core.execution.TestConfiguration)4 Collections (java.util.Collections)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 TimeUnit (java.util.concurrent.TimeUnit)4 EventExecution (com.netflix.conductor.common.metadata.events.EventExecution)3 StartWorkflow (com.netflix.conductor.common.metadata.events.EventHandler.StartWorkflow)3 Message (com.netflix.conductor.core.events.queue.Message)3 ObservableQueue (com.netflix.conductor.core.events.queue.ObservableQueue)3 JsonUtils (com.netflix.conductor.core.utils.JsonUtils)3 ExecutionService (com.netflix.conductor.service.ExecutionService)3 MetadataService (com.netflix.conductor.service.MetadataService)3 LinkedList (java.util.LinkedList)3