use of org.jbpm.kie.services.impl.audit.ServicesAwareAuditEventBuilder in project jbpm by kiegroup.
the class AbstractDeploymentService method setupAuditLogger.
protected AuditEventBuilder setupAuditLogger(IdentityProvider identityProvider, String deploymentUnitId) {
ServicesAwareAuditEventBuilder auditEventBuilder = new ServicesAwareAuditEventBuilder();
auditEventBuilder.setIdentityProvider(identityProvider);
auditEventBuilder.setDeploymentUnitId(deploymentUnitId);
return auditEventBuilder;
}
use of org.jbpm.kie.services.impl.audit.ServicesAwareAuditEventBuilder in project jbpm by kiegroup.
the class RuntimeDataServiceTest method testGetTasksAssignedAsPotentialOwnerGroupFromCallback.
@Test
public void testGetTasksAssignedAsPotentialOwnerGroupFromCallback() {
String id = "cdi-manager";
AbstractAuditLogger auditLogger = AuditLoggerFactory.newJPAInstance();
ServicesAwareAuditEventBuilder auditEventBuilder = new ServicesAwareAuditEventBuilder();
auditEventBuilder.setIdentityProvider(new TestIdentifyProviderCDI());
auditEventBuilder.setDeploymentUnitId(id);
auditLogger.setBuilder(auditEventBuilder);
RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(emf).registerableItemsFactory(InjectableRegisterableItemsFactory.getFactory(beanManager, auditLogger));
builder.addAsset(ResourceFactory.newClassPathResource("repo/processes/general/BPMN2-UserTasksAssignedToGroup.bpmn2"), ResourceType.BPMN2);
RuntimeManager manager = managerFactory.newSingletonRuntimeManager(builder.get(), id);
RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
KieSession ksession = runtime.getKieSession();
ProcessInstance processInstance = ksession.startProcess("UserTask");
List<Status> statuses = new ArrayList<Status>();
statuses.add(Status.Ready);
statuses.add(Status.Reserved);
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwnerByStatus("katy", statuses, new QueryFilter());
assertNotNull(tasks);
assertEquals(1, tasks.size());
ksession.abortProcessInstance(processInstance.getId());
}
use of org.jbpm.kie.services.impl.audit.ServicesAwareAuditEventBuilder in project jbpm by kiegroup.
the class RuntimeDataServiceTest method testGetProcessInstanceHistory.
@Test
public void testGetProcessInstanceHistory() throws IOException {
// BZ1048741
assertNotNull(managerFactory);
String id = "custom-manager";
AbstractAuditLogger auditLogger = AuditLoggerFactory.newJPAInstance();
ServicesAwareAuditEventBuilder auditEventBuilder = new ServicesAwareAuditEventBuilder();
auditEventBuilder.setIdentityProvider(new TestIdentifyProviderCDI());
auditEventBuilder.setDeploymentUnitId(id);
auditLogger.setBuilder(auditEventBuilder);
RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(emf).registerableItemsFactory(InjectableRegisterableItemsFactory.getFactory(beanManager, auditLogger));
builder.addAsset(ResourceFactory.newClassPathResource("repo/processes/general/hello.bpmn"), ResourceType.BPMN2);
RuntimeManager manager = managerFactory.newSingletonRuntimeManager(builder.get(), id);
RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
KieSession ksession = runtime.getKieSession();
ProcessInstance processInstance = ksession.startProcess("hello");
Collection<NodeInstanceDesc> nodeInstanceLogs = runtimeDataService.getProcessInstanceHistoryCompleted(processInstance.getId(), new QueryContext());
// assert if logs are ordered by log.id ASC
Iterator<NodeInstanceDesc> iterator = nodeInstanceLogs.iterator();
NodeInstanceDesc log0 = iterator.next();
assertEquals("End", log0.getName());
NodeInstanceDesc log1 = iterator.next();
assertEquals("Hello", log1.getName());
NodeInstanceDesc log2 = iterator.next();
assertEquals("Start", log2.getName());
Collection<NodeInstanceDesc> fullNodeInstanceLogs = runtimeDataService.getProcessInstanceFullHistory(processInstance.getId(), new QueryContext());
// assert if logs are ordered by log.date DESC, log.id DESC
Iterator<NodeInstanceDesc> fullIterator = fullNodeInstanceLogs.iterator();
NodeInstanceDesc fullLog0 = fullIterator.next();
assertEquals("Start", fullLog0.getName());
assertEquals(true, fullLog0.isCompleted());
NodeInstanceDesc fullLog1 = fullIterator.next();
assertEquals("Hello", fullLog1.getName());
assertEquals(true, fullLog1.isCompleted());
NodeInstanceDesc fullLog2 = fullIterator.next();
assertEquals("End", fullLog2.getName());
assertEquals(true, fullLog2.isCompleted());
NodeInstanceDesc fullLog3 = fullIterator.next();
assertEquals("End", fullLog3.getName());
assertEquals(false, fullLog3.isCompleted());
NodeInstanceDesc fullLog4 = fullIterator.next();
assertEquals("Hello", fullLog4.getName());
assertEquals(false, fullLog4.isCompleted());
NodeInstanceDesc fullLog5 = fullIterator.next();
assertEquals("Start", fullLog5.getName());
assertEquals(false, fullLog5.isCompleted());
manager.close();
}
use of org.jbpm.kie.services.impl.audit.ServicesAwareAuditEventBuilder in project jbpm by kiegroup.
the class HumanResourcesHiringTest method simpleExecutionTest.
@Test
public void simpleExecutionTest() {
assertNotNull(managerFactory);
String id = "custom-manager";
AbstractAuditLogger auditLogger = AuditLoggerFactory.newJPAInstance();
ServicesAwareAuditEventBuilder auditEventBuilder = new ServicesAwareAuditEventBuilder();
auditEventBuilder.setIdentityProvider(new TestIdentifyProviderCDI());
auditEventBuilder.setDeploymentUnitId(id);
auditLogger.setBuilder(auditEventBuilder);
RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(emf).registerableItemsFactory(InjectableRegisterableItemsFactory.getFactory(beanManager, auditLogger));
builder.addAsset(ResourceFactory.newClassPathResource("repo/processes/hr/hiring.bpmn2"), ResourceType.BPMN2);
RuntimeManager manager = managerFactory.newSingletonRuntimeManager(builder.get(), id);
testHiringProcess(manager, EmptyContext.get());
manager.close();
}
Aggregations