use of com.netflix.conductor.common.metadata.tasks.TaskDef in project conductor by Netflix.
the class MetadataServiceTest method testUpdateTaskDefNameNull.
@Test(expected = ConstraintViolationException.class)
public void testUpdateTaskDefNameNull() {
try {
TaskDef taskDef = new TaskDef();
metadataService.updateTaskDef(taskDef);
} catch (ConstraintViolationException ex) {
assertEquals(2, ex.getConstraintViolations().size());
Set<String> messages = getConstraintViolationMessages(ex.getConstraintViolations());
assertTrue(messages.contains("TaskDef name cannot be null or empty"));
assertTrue(messages.contains("ownerEmail cannot be empty"));
throw ex;
}
fail("metadataService.updateTaskDef did not throw ConstraintViolationException !");
}
use of com.netflix.conductor.common.metadata.tasks.TaskDef in project conductor by Netflix.
the class MetadataServiceTest method testRegisterTaskDefNoResponseTimeout.
@Test(expected = ConstraintViolationException.class)
public void testRegisterTaskDefNoResponseTimeout() {
try {
TaskDef taskDef = new TaskDef();
taskDef.setName("somename");
taskDef.setOwnerEmail("sample@test.com");
// wrong
taskDef.setResponseTimeoutSeconds(0);
metadataService.registerTaskDef(Collections.singletonList(taskDef));
} catch (ConstraintViolationException ex) {
assertEquals(1, ex.getConstraintViolations().size());
Set<String> messages = getConstraintViolationMessages(ex.getConstraintViolations());
assertTrue(messages.contains("TaskDef responseTimeoutSeconds: 0 should be minimum 1 second"));
throw ex;
}
fail("metadataService.registerTaskDef did not throw ConstraintViolationException !");
}
use of com.netflix.conductor.common.metadata.tasks.TaskDef in project conductor by Netflix.
the class MetadataServiceTest method testUpdateTaskDefDaoException.
@Test(expected = ApplicationException.class)
public void testUpdateTaskDefDaoException() {
TaskDef taskDef = new TaskDef();
taskDef.setName("test");
taskDef.setOwnerEmail("sample@test.com");
when(metadataDAO.getTaskDef(any())).thenReturn(null);
metadataService.updateTaskDef(taskDef);
}
use of com.netflix.conductor.common.metadata.tasks.TaskDef in project conductor by Netflix.
the class MetadataServiceTest method testUpdateTaskDefNotExisting.
@Test(expected = ApplicationException.class)
public void testUpdateTaskDefNotExisting() {
TaskDef taskDef = new TaskDef();
taskDef.setName("test");
taskDef.setOwnerEmail("sample@test.com");
when(metadataDAO.getTaskDef(any())).thenReturn(null);
metadataService.updateTaskDef(taskDef);
}
use of com.netflix.conductor.common.metadata.tasks.TaskDef in project conductor by Netflix.
the class WorkflowDefConstraintTest method testWorkflowTaskName.
@Test
public void testWorkflowTaskName() {
// name is null
TaskDef taskDef = new TaskDef();
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<Object>> result = validator.validate(taskDef);
assertEquals(2, result.size());
}
Aggregations