use of org.jbpm.runtime.manager.impl.AbstractRuntimeManager in project jbpm by kiegroup.
the class ProcessInstanceAdminServiceImpl method acknowledgeError.
@Override
public void acknowledgeError(String... errorId) throws ExecutionErrorNotFoundException {
for (String error : errorId) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("errorId", error);
params.put("ack", new Short("0"));
List<ExecutionError> execErrors = commandService.execute(new QueryNameCommand<List<ExecutionError>>("getErrorById", params));
if (execErrors.isEmpty()) {
throw new ExecutionErrorNotFoundException("No execution error found for id " + errorId);
}
ExecutionError errorInstance = execErrors.get(0);
RuntimeManager runtimeManager = RuntimeManagerRegistry.get().getManager(errorInstance.getDeploymentId());
if (runtimeManager != null) {
((AbstractRuntimeManager) runtimeManager).getExecutionErrorManager().getStorage().acknowledge(identityProvider.getName(), errorInstance.getErrorId());
}
}
}
use of org.jbpm.runtime.manager.impl.AbstractRuntimeManager in project jbpm by kiegroup.
the class ExecutionErrorHandlingRuntimeManagerTest method testBasicScriptFailure.
@Test
public void testBasicScriptFailure() {
RuntimeEngine runtime1 = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
KieSession ksession1 = runtime1.getKieSession();
assertNotNull(ksession1);
try {
ksession1.startProcess("BrokenScriptTask");
fail("Start process should fail due to broken script");
} catch (Throwable e) {
// expected
}
manager.disposeRuntimeEngine(runtime1);
ExecutionErrorManager errorManager = ((AbstractRuntimeManager) manager).getExecutionErrorManager();
ExecutionErrorStorage storage = errorManager.getStorage();
List<ExecutionError> errors = storage.list(0, 10);
assertNotNull(errors);
assertEquals(1, errors.size());
assertExecutionError(errors.get(0), "Process", "BrokenScriptTask", "Hello");
}
use of org.jbpm.runtime.manager.impl.AbstractRuntimeManager in project jbpm by kiegroup.
the class ExecutionErrorHandlingRuntimeManagerTest method testFailureAfterUserTaskNoWorkItemHandler.
@Test
public void testFailureAfterUserTaskNoWorkItemHandler() {
RuntimeEngine runtime1 = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
KieSession ksession1 = runtime1.getKieSession();
assertNotNull(ksession1);
ProcessInstance pi = ksession1.startProcess("UserTaskWithCustomTask");
manager.disposeRuntimeEngine(runtime1);
runtime1 = manager.getRuntimeEngine(ProcessInstanceIdContext.get(pi.getId()));
ksession1 = runtime1.getKieSession();
TaskService taskService = runtime1.getTaskService();
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
assertEquals(1, tasks.size());
long taskId = tasks.get(0).getId();
taskService.start(taskId, "john");
Map<String, Object> results = new HashMap<>();
results.put("output1", "rollback");
try {
taskService.complete(taskId, "john", results);
fail("Complete task should fail due to no work item handler found error");
} catch (Throwable e) {
// expected
}
manager.disposeRuntimeEngine(runtime1);
ExecutionErrorManager errorManager = ((AbstractRuntimeManager) manager).getExecutionErrorManager();
ExecutionErrorStorage storage = errorManager.getStorage();
List<ExecutionError> errors = storage.list(0, 10);
assertNotNull(errors);
assertEquals(1, errors.size());
assertExecutionError(errors.get(0), "Process", "UserTaskWithCustomTask", "Manual Task 2");
String errorMessage = errors.get(0).getErrorMessage();
assertTrue(errorMessage.contains("Could not find work item handler for Manual Task"));
}
Aggregations