use of org.kie.server.api.model.admin.ExecutionErrorInstance in project droolsjbpm-integration by kiegroup.
the class ProcessInstanceAdminServiceIntegrationTest method testErrorHandlingFailedToSignal.
@Test
@Category({ UnstableOnJenkinsPrBuilder.class })
public void testErrorHandlingFailedToSignal() throws Exception {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("nullAccepted", false);
Long processInstanceId = null;
try {
processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_SIGNAL_PROCESS, parameters);
List<ExecutionErrorInstance> errors = processAdminClient.getErrorsByProcessInstance(CONTAINER_ID, processInstanceId, false, 0, 10);
assertNotNull(errors);
assertEquals(0, errors.size());
try {
processClient.signalProcessInstance(CONTAINER_ID, processInstanceId, "Signal1", null);
fail("Process instance signal fail as it provides null as event");
} catch (KieServicesException e) {
// expected
}
errors = processAdminClient.getErrorsByProcessInstance(CONTAINER_ID, processInstanceId, false, 0, 10);
assertNotNull(errors);
assertEquals(1, errors.size());
ExecutionErrorInstance errorInstance = errors.get(0);
assertNotNull(errorInstance.getErrorId());
assertNull(errorInstance.getError());
assertNotNull(errorInstance.getProcessInstanceId());
assertNotNull(errorInstance.getActivityId());
assertNotNull(errorInstance.getErrorDate());
assertEquals(CONTAINER_ID, errorInstance.getContainerId());
assertEquals(PROCESS_ID_SIGNAL_PROCESS, errorInstance.getProcessId());
assertEquals("Signal 1 data", errorInstance.getActivityName());
assertFalse(errorInstance.isAcknowledged());
assertNull(errorInstance.getAcknowledgedAt());
assertNull(errorInstance.getAcknowledgedBy());
errors = processAdminClient.getErrorsByProcessInstanceAndNode(CONTAINER_ID, processInstanceId, "Signal 1 data", false, 0, 10);
assertNotNull(errors);
assertEquals(1, errors.size());
ExecutionErrorInstance errorInstance2 = errors.get(0);
assertEquals(errorInstance.getErrorId(), errorInstance2.getErrorId());
processAdminClient.acknowledgeError(CONTAINER_ID, errorInstance.getErrorId());
errors = processAdminClient.getErrorsByProcessInstance(CONTAINER_ID, processInstanceId, false, 0, 10);
assertNotNull(errors);
assertEquals(0, errors.size());
errorInstance = processAdminClient.getError(CONTAINER_ID, errorInstance.getErrorId());
assertNotNull(errorInstance);
assertNotNull(errorInstance.getErrorId());
assertTrue(errorInstance.isAcknowledged());
assertNotNull(errorInstance.getAcknowledgedAt());
assertEquals(USER_YODA, errorInstance.getAcknowledgedBy());
} catch (KieServicesException e) {
logger.error("Unexpected error", e);
fail(e.getMessage());
} finally {
if (processInstanceId != null) {
processClient.abortProcessInstance(CONTAINER_ID, processInstanceId);
}
}
}
use of org.kie.server.api.model.admin.ExecutionErrorInstance in project droolsjbpm-integration by kiegroup.
the class UserTaskAdminResource method getExecutionErrorById.
@ApiOperation(value = "Returns information about a specified task execution error.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Task instance or Container Id not found"), @ApiResponse(code = 200, response = ExecutionErrorInstance.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_EXEC_ERROR_RESPONSE_JSON) })) })
@GET
@Path(ERROR_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getExecutionErrorById(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "container id that error belongs to", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam(CONTAINER_ID) String containerId, @ApiParam(value = "identifier of the execution error to load", required = true, example = "xxx-yyy-zzz") @PathParam("errorId") String errorId) {
Variant v = getVariant(headers);
Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
try {
ExecutionErrorInstance executionErrorInstance = userTaskAdminServiceBase.getError(errorId);
return createCorrectVariant(executionErrorInstance, headers, Response.Status.OK, conversationIdHeader);
} catch (ExecutionErrorNotFoundException e) {
return notFound(e.getMessage(), v, conversationIdHeader);
} catch (DeploymentNotFoundException e) {
return notFound(MessageFormat.format(CONTAINER_NOT_FOUND, containerId), v, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
use of org.kie.server.api.model.admin.ExecutionErrorInstance in project droolsjbpm-integration by kiegroup.
the class ProcessAdminResource method getExecutionErrorById.
@ApiOperation(value = "Returns information about a specified process execution error.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Process instance or Container Id not found"), @ApiResponse(code = 200, response = ExecutionErrorInstance.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_EXEC_ERROR_RESPONSE_JSON) })) })
@GET
@Path(ERROR_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getExecutionErrorById(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "container id that process error belongs to", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam(CONTAINER_ID) String containerId, @ApiParam(value = "identifier of error to be loaded", required = true, example = "xxx-yyy-zzz") @PathParam("errorId") String errorId) {
Variant v = getVariant(headers);
Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
try {
ExecutionErrorInstance executionErrorInstance = processAdminServiceBase.getError(containerId, errorId);
return createCorrectVariant(executionErrorInstance, headers, Response.Status.OK, conversationIdHeader);
} catch (ExecutionErrorNotFoundException e) {
return notFound(e.getMessage(), v, conversationIdHeader);
} catch (DeploymentNotFoundException e) {
return notFound(MessageFormat.format(CONTAINER_NOT_FOUND, containerId), v, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
Aggregations