use of org.kie.server.api.model.admin.ExecutionErrorInstance in project droolsjbpm-integration by kiegroup.
the class QueryDataServiceIntegrationTest method testErrorHandlingFailedToSignal.
@Test
public void testErrorHandlingFailedToSignal() throws Exception {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("nullAccepted", false);
QueryDefinition query = createErrorsQueryDefinition();
Long processInstanceId = null;
try {
queryClient.registerQuery(query);
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 should fail as it provides null as event");
} catch (KieServicesException e) {
// expected
}
errors = queryClient.query(query.getName(), QueryServicesClient.QUERY_MAP_ERROR, 0, 10, ExecutionErrorInstance.class);
errors = filterErrorsByProcessInstanceId(errors, processInstanceId);
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 (Exception e) {
logger.error("Unexpected error", e);
fail(e.getMessage());
} finally {
queryClient.unregisterQuery(query.getName());
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 JobServiceIntegrationTest method getErrorByProcessId.
private ExecutionErrorInstance getErrorByProcessId(Long processInstanceId) {
List<ExecutionErrorInstance> errors = processAdminClient.getErrorsByProcessInstance(CONTAINER_ID, processInstanceId, true, 0, 10);
assertEquals(1, errors.size());
ExecutionErrorInstance error = errors.get(0);
assertNotNull(error);
return error;
}
use of org.kie.server.api.model.admin.ExecutionErrorInstance in project droolsjbpm-integration by kiegroup.
the class JobServiceIntegrationTest method testRunProcessAutoAckCommandSunnyScenario.
@Test
public void testRunProcessAutoAckCommandSunnyScenario() throws Exception {
Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK_WITH_ROLLBACK);
assertNotNull(processInstanceId);
completeTaskAndGenerateError();
completeTaskWithoutError();
runProcessAutoAckErrorCommand();
ExecutionErrorInstance error = getErrorByProcessId(processInstanceId);
// since task was completed auto ack should work
assertTrue(error.isAcknowledged());
assertNotNull(error.getAcknowledgedAt());
assertNotNull(error.getAcknowledgedBy());
}
use of org.kie.server.api.model.admin.ExecutionErrorInstance in project droolsjbpm-integration by kiegroup.
the class ProcessInstanceAdminServiceIntegrationTest method testErrorHandlingFailedToStart.
@Test
public void testErrorHandlingFailedToStart() throws Exception {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("timer", "invalid value");
try {
processClient.startProcess(CONTAINER_ID, PROCESS_ID_TIMER, parameters);
fail("Process instance should fail as it has invalid timer expression");
} catch (KieServicesException e) {
// expected as the variable to configure timer duration is invalid
}
List<ExecutionErrorInstance> errors = processAdminClient.getErrors(CONTAINER_ID, false, 0, 10);
errors = filterErrorsByProcessId(errors, PROCESS_ID_TIMER);
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_TIMER, errorInstance.getProcessId());
assertEquals("timer", errorInstance.getActivityName());
assertFalse(errorInstance.isAcknowledged());
assertNull(errorInstance.getAcknowledgedAt());
assertNull(errorInstance.getAcknowledgedBy());
processAdminClient.acknowledgeError(CONTAINER_ID, errorInstance.getErrorId());
errors = processAdminClient.getErrors(CONTAINER_ID, false, 0, 10);
errors = filterErrorsByProcessId(errors, PROCESS_ID_TIMER);
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());
}
use of org.kie.server.api.model.admin.ExecutionErrorInstance in project droolsjbpm-integration by kiegroup.
the class ProcessInstanceAdminServiceIntegrationTest method testErrorHandlingFailedToStartBulkAck.
@Test
public void testErrorHandlingFailedToStartBulkAck() throws Exception {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("timer", "invalid value");
try {
processClient.startProcess(CONTAINER_ID, PROCESS_ID_TIMER, parameters);
fail("Process instance should fail as it has invalid timer expression");
} catch (KieServicesException e) {
// expected as the variable to configure timer duration is invalid
}
try {
processClient.startProcess(CONTAINER_ID, PROCESS_ID_TIMER, parameters);
fail("Process instance should fail as it has invalid timer expression");
} catch (KieServicesException e) {
// expected as the variable to configure timer duration is invalid
}
List<ExecutionErrorInstance> errors = processAdminClient.getErrors(CONTAINER_ID, false, 0, 10);
errors = filterErrorsByProcessId(errors, PROCESS_ID_TIMER);
assertNotNull(errors);
assertEquals(2, errors.size());
ExecutionErrorInstance errorInstance = errors.get(0);
assertFalse(errorInstance.isAcknowledged());
assertNull(errorInstance.getAcknowledgedAt());
assertNull(errorInstance.getAcknowledgedBy());
ExecutionErrorInstance errorInstance2 = errors.get(1);
assertFalse(errorInstance2.isAcknowledged());
assertNull(errorInstance2.getAcknowledgedAt());
assertNull(errorInstance2.getAcknowledgedBy());
processAdminClient.acknowledgeError(CONTAINER_ID, errorInstance.getErrorId(), errorInstance2.getErrorId());
errors = processAdminClient.getErrors(CONTAINER_ID, false, 0, 10);
errors = filterErrorsByProcessId(errors, PROCESS_ID_TIMER);
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());
}
Aggregations