@Test public void intersectQueryBuilderTest() { ProcessInstanceLogQueryBuilder builder = this.processInstanceLogQuery(); builder.intersect(); builder.duration(pilTestData[4].getDuration()); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "duration result", 1, resultList.size()); builder.endDate(pilTestData[5].getEnd()); resultList = builder.build().getResultList(); assertEquals( "intersect: duration AND end result", 0, resultList.size()); builder.identity(pilTestData[6].getIdentity()); resultList = builder.build().getResultList(); assertEquals( "intersect: duration AND end AND identity result", 0, resultList.size()); }
@Test public void unionQueryBuilderTest() { ProcessInstanceLogQueryBuilder builder = this.processInstanceLogQuery(); builder.duration(pilTestData[4].getDuration()); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "duration result", 1, resultList.size()); builder.endDate(pilTestData[5].getEnd(), pilTestData[6].getEnd()); resultList = builder.build().getResultList(); assertEquals( "union: duration OR end result", 3, resultList.size()); builder.identity(pilTestData[7].getIdentity(), pilTestData[8].getIdentity()); resultList = builder.build().getResultList(); assertEquals( "union: duration OR end OR identity result", 5, resultList.size()); }
@Test public void intersectUnionQueryBuilderTest() { ProcessInstanceLogQueryBuilder builder = this.processInstanceLogQuery(); builder.duration(pilTestData[0].getDuration(), pilTestData[2].getDuration()); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "duration result", 3, resultList.size()); builder.intersect().endDate(pilTestData[0].getEnd()); resultList = builder.build().getResultList(); assertEquals( "intersect: duration AND end result", 1, resultList.size()); builder.union().processId(pilTestData[10].getProcessId()); resultList = builder.build().getResultList(); assertEquals( "intersect/union: duration AND end OR processId result", 1 + 1, resultList.size()); }
List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); for (int i = 1; i < resultList.size(); ++i) { ProcessInstanceLog pilB = (ProcessInstanceLog) resultList.get(i); resultList = builder.build().getResultList(); for (int i = 1; i < resultList.size(); ++i) { ProcessInstanceLog pilB = (ProcessInstanceLog) resultList.get(i); resultList = builder.build().getResultList(); for (int i = 1; i < resultList.size(); ++i) { ProcessInstanceLog pilA = (ProcessInstanceLog) resultList.get(i - 1); resultList = builder.build().getResultList(); for (int i = 1; i < resultList.size(); ++i) { ProcessInstanceLog pilA = (ProcessInstanceLog) resultList.get(i - 1);
@Test public void testDeleteProcessInstanceInfoLogByTimestamp() { int p = 0; Date endDate = pilTestData[p++].getEnd(); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> logs = this.processInstanceLogQuery().endDate(endDate).build().getResultList(); assertEquals(1, logs.size()); ProcessInstanceLogDeleteBuilder updateBuilder = this.processInstanceLogDelete().endDate(logs.get(0).getEnd()); int result = updateBuilder.build().execute(); assertEquals(1, result); }
List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 1, resultList.size()); String externalId = resultList.get(0).getExternalId(); regex = regex.substring(0, regex.length()-1) + "."; builder.regex().identity(regex); resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 1, resultList.size()); assertEquals( externalId, resultList.get(0).getExternalId() ); regex = regex.substring(0, 10) + "*"; builder.regex().identity(regex); resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 1, resultList.size()); assertEquals( externalId, resultList.get(0).getExternalId() ); String regex2 = "*" + pilTestData[0].getIdentity().substring(10); builder.regex().intersect().identity(regex, regex2); resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 1, resultList.size()); assertEquals( externalId, resultList.get(0).getExternalId() ); regex2 = "*" + pilTestData[5].getIdentity().substring(10); builder.regex().intersect().identity(regex, regex2); resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 0, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 2, resultList.size());
List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "duration min + max result", 1, resultList.size()); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> durationOrderedProcInstLogList = this.processInstanceLogQuery().build().getResultList(); Collections.sort(durationOrderedProcInstLogList, new Comparator<org.kie.api.runtime.manager.audit.ProcessInstanceLog>() { long max = durationOrderedProcInstLogList.get(0).getDuration(); builder.durationMax(max); resultList = builder.build().getResultList(); verifyMaxMinDuration( resultList, MAX, max ); long min = durationOrderedProcInstLogList.get(lastElemIndex).getDuration(); builder.durationMin(min); resultList = builder.build().getResultList(); verifyMaxMinDuration(resultList, MIN, min); max = durationOrderedProcInstLogList.get(0).getDuration(); builder.durationMax(max); resultList = builder.build().getResultList(); for( org.kie.api.runtime.manager.audit.ProcessInstanceLog log : resultList ) { long dur = log.getDuration(); max = durationOrderedProcInstLogList.get(0).getDuration(); builder.durationMax(max); resultList = builder.build().getResultList(); verifyMaxMinDuration(resultList, BOTH, min, max); builder.durationMin(min);
ProcessInstanceLogQueryBuilder builder = this.processInstanceLogQuery().duration(duration); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "duration query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "end date query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "identity query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "process id query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "process instance id query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "process name query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "process version query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "start date query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "status query result", 2, resultList.size());
private int getProcessLogSize(String processId) { return new JPAAuditLogService(emf).processInstanceLogQuery() .processId(processId) .build() .getResultList() .size(); }
private void assertProcessInstanceSLACompliance(JPAAuditLogService logService, Long processInstanceId, int slaCompliance) { List<ProcessInstanceLog> logs = logService.processInstanceLogQuery() .processInstanceId(processInstanceId) .build() .getResultList(); assertEquals(1, logs.size()); ProcessInstanceLog log = logs.get(0); assertEquals(processInstanceId, log.getProcessInstanceId()); assertEquals(slaCompliance, ((org.jbpm.process.audit.ProcessInstanceLog)log).getSlaCompliance().intValue()); }
@Test public void intersectQueryBuilderTest() { ProcessInstanceLogQueryBuilder builder = this.processInstanceLogQuery(); builder.intersect(); builder.duration(pilTestData[4].getDuration()); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "duration result", 1, resultList.size()); builder.endDate(pilTestData[5].getEnd()); resultList = builder.build().getResultList(); assertEquals( "intersect: duration AND end result", 0, resultList.size()); builder.identity(pilTestData[6].getIdentity()); resultList = builder.build().getResultList(); assertEquals( "intersect: duration AND end AND identity result", 0, resultList.size()); }
@Test public void unionQueryBuilderTest() { ProcessInstanceLogQueryBuilder builder = this.processInstanceLogQuery(); builder.duration(pilTestData[4].getDuration()); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "duration result", 1, resultList.size()); builder.endDate(pilTestData[5].getEnd(), pilTestData[6].getEnd()); resultList = builder.build().getResultList(); assertEquals( "union: duration OR end result", 3, resultList.size()); builder.identity(pilTestData[7].getIdentity(), pilTestData[8].getIdentity()); resultList = builder.build().getResultList(); assertEquals( "union: duration OR end OR identity result", 5, resultList.size()); }
@Test public void intersectUnionQueryBuilderTest() { ProcessInstanceLogQueryBuilder builder = this.processInstanceLogQuery(); builder.duration(pilTestData[0].getDuration(), pilTestData[2].getDuration()); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "duration result", 3, resultList.size()); builder.intersect().endDate(pilTestData[0].getEnd()); resultList = builder.build().getResultList(); assertEquals( "intersect: duration AND end result", 1, resultList.size()); builder.union().processId(pilTestData[10].getProcessId()); resultList = builder.build().getResultList(); assertEquals( "intersect/union: duration AND end OR processId result", 1 + 1, resultList.size()); }
List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); for (int i = 1; i < resultList.size(); ++i) { ProcessInstanceLog pilB = (ProcessInstanceLog) resultList.get(i); resultList = builder.build().getResultList(); for (int i = 1; i < resultList.size(); ++i) { ProcessInstanceLog pilB = (ProcessInstanceLog) resultList.get(i); resultList = builder.build().getResultList(); for (int i = 1; i < resultList.size(); ++i) { ProcessInstanceLog pilA = (ProcessInstanceLog) resultList.get(i - 1); resultList = builder.build().getResultList(); for (int i = 1; i < resultList.size(); ++i) { ProcessInstanceLog pilA = (ProcessInstanceLog) resultList.get(i - 1);
List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 1, resultList.size()); String externalId = resultList.get(0).getExternalId(); regex = regex.substring(0, regex.length()-1) + "."; builder.regex().identity(regex); resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 1, resultList.size()); assertEquals( externalId, resultList.get(0).getExternalId() ); regex = regex.substring(0, 10) + "*"; builder.regex().identity(regex); resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 1, resultList.size()); assertEquals( externalId, resultList.get(0).getExternalId() ); String regex2 = "*" + pilTestData[0].getIdentity().substring(10); builder.regex().intersect().identity(regex, regex2); resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 1, resultList.size()); assertEquals( externalId, resultList.get(0).getExternalId() ); regex2 = "*" + pilTestData[5].getIdentity().substring(10); builder.regex().intersect().identity(regex, regex2); resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 0, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "literal regex identity result", 2, resultList.size());
@Test public void testDeleteProcessInstanceInfoLogByTimestamp() { int p = 0; Date endDate = pilTestData[p++].getEnd(); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> logs = this.processInstanceLogQuery().endDate(endDate).build().getResultList(); assertEquals(1, logs.size()); ProcessInstanceLogDeleteBuilder updateBuilder = this.processInstanceLogDelete().endDate(logs.get(0).getEnd()); int result = updateBuilder.build().execute(); assertEquals(1, result); }
List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "duration min + max result", 1, resultList.size()); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> durationOrderedProcInstLogList = this.processInstanceLogQuery().build().getResultList(); Collections.sort(durationOrderedProcInstLogList, new Comparator<org.kie.api.runtime.manager.audit.ProcessInstanceLog>() { long max = durationOrderedProcInstLogList.get(0).getDuration(); builder.durationMax(max); resultList = builder.build().getResultList(); verifyMaxMinDuration( resultList, MAX, max ); long min = durationOrderedProcInstLogList.get(lastElemIndex).getDuration(); builder.durationMin(min); resultList = builder.build().getResultList(); verifyMaxMinDuration(resultList, MIN, min); max = durationOrderedProcInstLogList.get(0).getDuration(); builder.durationMax(max); resultList = builder.build().getResultList(); for( org.kie.api.runtime.manager.audit.ProcessInstanceLog log : resultList ) { long dur = log.getDuration(); max = durationOrderedProcInstLogList.get(0).getDuration(); builder.durationMax(max); resultList = builder.build().getResultList(); verifyMaxMinDuration(resultList, BOTH, min, max); builder.durationMin(min);
ProcessInstanceLogQueryBuilder builder = this.processInstanceLogQuery().duration(duration); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList(); assertEquals( "duration query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "end date query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "identity query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "process id query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "process instance id query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "process name query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "process version query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "start date query result", 2, resultList.size()); resultList = builder.build().getResultList(); assertEquals( "status query result", 2, resultList.size());
ProcessInstanceLog log = auditService.findProcessInstance(procInstId); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> logs = auditService.processInstanceLogQuery().startDate(log.getStart()).build().getResultList(); assertNotNull( "Null List of ProcessInstanceLog", logs ); assertFalse( "Empty List of ProcessInstanceLog", logs.isEmpty() );
= auditLogService.processInstanceLogQuery().processInstanceId(procInstId).build(); List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> procLogs = procQuery.getResultList(); assertFalse( "No proc logs?!?", procLogs.isEmpty() );