use of org.kie.internal.runtime.error.ExecutionErrorManager 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.kie.internal.runtime.error.ExecutionErrorManager 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