use of com.netflix.conductor.client.exceptions.ConductorClientException in project conductor by Netflix.
the class AbstractHttpEndToEndTest method testCreateInvalidWorkflowDef.
@Test(expected = ConductorClientException.class)
public void testCreateInvalidWorkflowDef() {
try {
WorkflowDef workflowDef = new WorkflowDef();
List<WorkflowDef> workflowDefList = new ArrayList<>();
workflowDefList.add(workflowDef);
metadataClient.registerWorkflowDef(workflowDef);
} catch (ConductorClientException e) {
assertEquals(3, e.getValidationErrors().size());
assertEquals(400, e.getStatus());
assertEquals("Validation failed, check below errors for detail.", e.getMessage());
assertFalse(e.isRetryable());
List<ValidationError> errors = e.getValidationErrors();
List<String> errorMessages = errors.stream().map(ValidationError::getMessage).collect(Collectors.toList());
assertTrue(errorMessages.contains("WorkflowDef name cannot be null or empty"));
assertTrue(errorMessages.contains("WorkflowTask list cannot be empty"));
assertTrue(errorMessages.contains("ownerEmail cannot be empty"));
throw e;
}
}
use of com.netflix.conductor.client.exceptions.ConductorClientException in project conductor by Netflix.
the class AbstractHttpEndToEndTest method testUpdateWorkflowDef.
@Test(expected = ConductorClientException.class)
public void testUpdateWorkflowDef() {
try {
WorkflowDef workflowDef = new WorkflowDef();
List<WorkflowDef> workflowDefList = new ArrayList<>();
workflowDefList.add(workflowDef);
metadataClient.updateWorkflowDefs(workflowDefList);
} catch (ConductorClientException e) {
assertEquals(400, e.getStatus());
assertEquals("Validation failed, check below errors for detail.", e.getMessage());
assertFalse(e.isRetryable());
List<ValidationError> errors = e.getValidationErrors();
List<String> errorMessages = errors.stream().map(ValidationError::getMessage).collect(Collectors.toList());
assertEquals(3, errors.size());
assertTrue(errorMessages.contains("WorkflowTask list cannot be empty"));
assertTrue(errorMessages.contains("WorkflowDef name cannot be null or empty"));
assertTrue(errorMessages.contains("ownerEmail cannot be empty"));
throw e;
}
}
use of com.netflix.conductor.client.exceptions.ConductorClientException in project conductor by Netflix.
the class AbstractHttpEndToEndTest method testMetadataWorkflowDefinition.
@Test(expected = ConductorClientException.class)
public void testMetadataWorkflowDefinition() {
String workflowDefName = "testWorkflowDefMetadata";
WorkflowDef def = new WorkflowDef();
def.setName(workflowDefName);
def.setVersion(1);
WorkflowTask t0 = new WorkflowTask();
t0.setName("t0");
t0.setWorkflowTaskType(TaskType.SIMPLE);
t0.setTaskReferenceName("t0");
WorkflowTask t1 = new WorkflowTask();
t1.setName("t1");
t1.setWorkflowTaskType(TaskType.SIMPLE);
t1.setTaskReferenceName("t1");
def.getTasks().add(t0);
def.getTasks().add(t1);
metadataClient.registerWorkflowDef(def);
metadataClient.unregisterWorkflowDef(workflowDefName, 1);
try {
metadataClient.getWorkflowDef(workflowDefName, 1);
} catch (ConductorClientException e) {
int statusCode = e.getStatus();
String errorMessage = e.getMessage();
boolean retryable = e.isRetryable();
assertEquals(404, statusCode);
assertEquals("No such workflow found by name: testWorkflowDefMetadata, version: 1", errorMessage);
assertFalse(retryable);
throw e;
}
}
use of com.netflix.conductor.client.exceptions.ConductorClientException in project conductor by Netflix.
the class AbstractHttpEndToEndTest method testUpdateWorkflow.
@Test(expected = ConductorClientException.class)
public void testUpdateWorkflow() {
TaskDef taskDef = new TaskDef();
taskDef.setName("taskUpdate");
ArrayList<TaskDef> tasks = new ArrayList<>();
tasks.add(taskDef);
metadataClient.registerTaskDefs(tasks);
WorkflowDef def = new WorkflowDef();
def.setName("testWorkflowDel");
def.setVersion(1);
WorkflowTask workflowTask = new WorkflowTask();
workflowTask.setName("taskUpdate");
workflowTask.setTaskReferenceName("taskUpdate");
List<WorkflowTask> workflowTaskList = new ArrayList<>();
workflowTaskList.add(workflowTask);
def.setTasks(workflowTaskList);
List<WorkflowDef> workflowList = new ArrayList<>();
workflowList.add(def);
metadataClient.registerWorkflowDef(def);
def.setVersion(2);
metadataClient.updateWorkflowDefs(workflowList);
WorkflowDef def1 = metadataClient.getWorkflowDef(def.getName(), 2);
assertNotNull(def1);
try {
metadataClient.getTaskDef("test");
} catch (ConductorClientException e) {
int statuCode = e.getStatus();
assertEquals(404, statuCode);
assertEquals("No such taskType found by name: test", e.getMessage());
assertFalse(e.isRetryable());
throw e;
}
}
use of com.netflix.conductor.client.exceptions.ConductorClientException in project conductor by Netflix.
the class AbstractHttpEndToEndTest method testInvalidResource.
@Test(expected = ConductorClientException.class)
public void testInvalidResource() {
MetadataClient metadataClient = new MetadataClient();
metadataClient.setRootURI(String.format("%sinvalid", apiRoot));
WorkflowDef def = new WorkflowDef();
def.setName("testWorkflowDel");
def.setVersion(1);
try {
metadataClient.registerWorkflowDef(def);
} catch (ConductorClientException e) {
int statusCode = e.getStatus();
boolean retryable = e.isRetryable();
assertEquals(404, statusCode);
assertFalse(retryable);
throw e;
}
}
Aggregations