Search in sources :

Example 1 with SkipTaskRequest

use of com.netflix.conductor.common.metadata.workflow.SkipTaskRequest in project conductor by Netflix.

the class AbstractProtoMapper method fromProto.

public SkipTaskRequest fromProto(SkipTaskRequestPb.SkipTaskRequest from) {
    SkipTaskRequest to = new SkipTaskRequest();
    Map<String, Object> taskInputMap = new HashMap<String, Object>();
    for (Map.Entry<String, Value> pair : from.getTaskInputMap().entrySet()) {
        taskInputMap.put(pair.getKey(), fromProto(pair.getValue()));
    }
    to.setTaskInput(taskInputMap);
    Map<String, Object> taskOutputMap = new HashMap<String, Object>();
    for (Map.Entry<String, Value> pair : from.getTaskOutputMap().entrySet()) {
        taskOutputMap.put(pair.getKey(), fromProto(pair.getValue()));
    }
    to.setTaskOutput(taskOutputMap);
    if (from.hasTaskInputMessage()) {
        to.setTaskInputMessage(fromProto(from.getTaskInputMessage()));
    }
    if (from.hasTaskOutputMessage()) {
        to.setTaskOutputMessage(fromProto(from.getTaskOutputMessage()));
    }
    return to;
}
Also used : SkipTaskRequest(com.netflix.conductor.common.metadata.workflow.SkipTaskRequest) HashMap(java.util.HashMap) Value(com.google.protobuf.Value) Object(java.lang.Object) String(java.lang.String) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with SkipTaskRequest

use of com.netflix.conductor.common.metadata.workflow.SkipTaskRequest in project conductor by Netflix.

the class WorkflowServiceTest method testInvalidSkipTaskFromWorkflow.

@Test(expected = ConstraintViolationException.class)
public void testInvalidSkipTaskFromWorkflow() {
    try {
        SkipTaskRequest skipTaskRequest = new SkipTaskRequest();
        workflowService.skipTaskFromWorkflow(null, null, skipTaskRequest);
    } catch (ConstraintViolationException ex) {
        assertEquals(2, ex.getConstraintViolations().size());
        Set<String> messages = getConstraintViolationMessages(ex.getConstraintViolations());
        assertTrue(messages.contains("WorkflowId name cannot be null or empty."));
        assertTrue(messages.contains("TaskReferenceName cannot be null or empty."));
        throw ex;
    }
}
Also used : SkipTaskRequest(com.netflix.conductor.common.metadata.workflow.SkipTaskRequest) ConstraintViolationException(javax.validation.ConstraintViolationException) Test(org.junit.Test)

Example 3 with SkipTaskRequest

use of com.netflix.conductor.common.metadata.workflow.SkipTaskRequest in project conductor by Netflix.

the class WorkflowServiceImpl method skipTaskFromWorkflow.

@Override
public void skipTaskFromWorkflow(WorkflowServicePb.SkipTaskRequest req, StreamObserver<WorkflowServicePb.SkipTaskResponse> response) {
    try {
        SkipTaskRequest skipTask = PROTO_MAPPER.fromProto(req.getRequest());
        workflowService.skipTaskFromWorkflow(req.getWorkflowId(), req.getTaskReferenceName(), skipTask);
        response.onNext(WorkflowServicePb.SkipTaskResponse.getDefaultInstance());
        response.onCompleted();
    } catch (Exception e) {
        GRPC_HELPER.onError(response, e);
    }
}
Also used : SkipTaskRequest(com.netflix.conductor.common.metadata.workflow.SkipTaskRequest) ApplicationException(com.netflix.conductor.core.execution.ApplicationException)

Aggregations

SkipTaskRequest (com.netflix.conductor.common.metadata.workflow.SkipTaskRequest)3 Value (com.google.protobuf.Value)1 ApplicationException (com.netflix.conductor.core.execution.ApplicationException)1 Object (java.lang.Object)1 String (java.lang.String)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConstraintViolationException (javax.validation.ConstraintViolationException)1 Test (org.junit.Test)1