use of org.jbpm.process.audit.JPAAuditLogService in project jbpm by kiegroup.
the class SLATrackingCommandTest method testSLATrackingOnUserTask.
@Test
public void testSLATrackingOnUserTask() throws Exception {
CountDownAsyncJobListener countDownListener = configureListener(1);
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().userGroupCallback(userGroupCallback).entityManagerFactory(emf).addAsset(ResourceFactory.newClassPathResource("BPMN2-UserTaskWithSLAOnTask.bpmn2"), ResourceType.BPMN2).addEnvironmentEntry("SLATimerMode", "false").get();
manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
assertNotNull(manager);
RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
KieSession ksession = runtime.getKieSession();
assertNotNull(ksession);
ProcessInstance processInstance = ksession.startProcess("UserTask");
assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
List<TaskSummary> tasks = runtime.getTaskService().getTasksAssignedAsPotentialOwner("john", "en-UK");
assertEquals(1, tasks.size());
JPAAuditLogService logService = new JPAAuditLogService(emf);
assertNodeInstanceSLACompliance(logService, processInstance.getId(), "Hello", ProcessInstance.SLA_PENDING);
scheduleSLATracking(manager.getIdentifier());
countDownListener.waitTillCompleted();
assertNodeInstanceSLACompliance(logService, processInstance.getId(), "Hello", ProcessInstance.SLA_PENDING);
// wait for due date of SLA to pass
Thread.sleep(3000);
countDownListener.reset(1);
scheduleSLATracking(manager.getIdentifier());
countDownListener.waitTillCompleted();
runtime.getTaskService().start(tasks.get(0).getId(), "john");
runtime.getTaskService().complete(tasks.get(0).getId(), "john", null);
assertNodeInstanceSLACompliance(logService, processInstance.getId(), "Hello", ProcessInstance.SLA_VIOLATED);
}
use of org.jbpm.process.audit.JPAAuditLogService in project jbpm by kiegroup.
the class SLATrackingCommandTest method testSLATrackingOnProcessInstanceSLAMet.
@Test
public void testSLATrackingOnProcessInstanceSLAMet() throws Exception {
CountDownAsyncJobListener countDownListener = configureListener(1);
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().userGroupCallback(userGroupCallback).entityManagerFactory(emf).addAsset(ResourceFactory.newClassPathResource("BPMN2-UserTaskWithSLA.bpmn2"), ResourceType.BPMN2).addEnvironmentEntry("SLATimerMode", "false").get();
manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
assertNotNull(manager);
RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
KieSession ksession = runtime.getKieSession();
assertNotNull(ksession);
ProcessInstance processInstance = ksession.startProcess("UserTask");
assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
List<TaskSummary> tasks = runtime.getTaskService().getTasksAssignedAsPotentialOwner("john", "en-UK");
assertEquals(1, tasks.size());
JPAAuditLogService logService = new JPAAuditLogService(emf);
assertProcessInstanceSLACompliance(logService, processInstance.getId(), ProcessInstance.SLA_PENDING);
scheduleSLATracking(manager.getIdentifier());
countDownListener.waitTillCompleted();
assertProcessInstanceSLACompliance(logService, processInstance.getId(), ProcessInstance.SLA_PENDING);
runtime.getTaskService().start(tasks.get(0).getId(), "john");
runtime.getTaskService().complete(tasks.get(0).getId(), "john", null);
assertProcessInstanceSLACompliance(logService, processInstance.getId(), ProcessInstance.SLA_MET);
}
use of org.jbpm.process.audit.JPAAuditLogService in project jbpm by kiegroup.
the class LogCleanupCommandTest method setUp.
// ------------------------ Test Methods ------------------------
@Override
public void setUp() throws Exception {
super.setUp();
taskAuditService = new TaskJPAAuditService(getEmf());
taskAuditService.clear();
auditLogService = new JPAAuditLogService(getEmf());
auditLogService.clear();
emfErrors = EntityManagerFactoryManager.get().getOrCreate("org.jbpm.persistence.complete");
}
use of org.jbpm.process.audit.JPAAuditLogService in project jbpm by kiegroup.
the class VariableInstanceLogCleanTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
auditService = new JPAAuditLogService(getEmf());
auditService.clear();
}
use of org.jbpm.process.audit.JPAAuditLogService in project jbpm by kiegroup.
the class HumanTaskResolver method testConcurrentInvocationsIncludingUserTasks.
@Test(timeout = 10000)
public void testConcurrentInvocationsIncludingUserTasks() throws Exception {
CountDownLatch latch = new CountDownLatch(THREADS);
for (int i = 0; i < THREADS; i++) {
ProcessRunner pr = new ProcessRunner(i, getEmf(), latch);
Thread t = new Thread(pr, i + "-process-runner");
t.start();
}
latch.await();
AuditLogService logService = new JPAAuditLogService(getEmf());
List<? extends ProcessInstanceLog> logs = logService.findProcessInstances("com.sample.humantask.concurrent");
assertEquals(2, logs.size());
for (ProcessInstanceLog log : logs) {
assertEquals(ProcessInstance.STATE_COMPLETED, log.getStatus().intValue());
}
logService.dispose();
}
Aggregations