use of org.jbpm.process.audit.strategy.StandaloneJtaStrategy in project jbpm by kiegroup.
the class AuditTaskDeleteTest method setUp.
@Before
public void setUp() throws Exception {
context = setupWithPoolingDataSource("org.jbpm.services.task", "jdbc/jbpm-ds");
emf = (EntityManagerFactory) context.get(ENTITY_MANAGER_FACTORY);
this.persistenceStrategy = new StandaloneJtaStrategy(emf);
produceTaskInstances();
}
use of org.jbpm.process.audit.strategy.StandaloneJtaStrategy in project jbpm by kiegroup.
the class AuditDeleteTest method setUp.
@Before
public void setUp() throws Exception {
context = setupWithPoolingDataSource(JBPM_PERSISTENCE_UNIT_NAME);
emf = (EntityManagerFactory) context.get(ENTITY_MANAGER_FACTORY);
this.persistenceStrategy = new StandaloneJtaStrategy(emf);
if (firstRun) {
clearTables(ProcessInstanceLog.class, VariableInstanceLog.class, NodeInstanceLog.class);
firstRun = false;
}
if (pilTestData == null) {
pilTestData = createTestProcessInstanceLogData();
vilTestData = createTestVariableInstanceLogData();
nilTestData = createTestNodeInstanceLogData();
}
}
use of org.jbpm.process.audit.strategy.StandaloneJtaStrategy in project jbpm by kiegroup.
the class AuditDeleteTest method createTestProcessInstanceLogData.
private ProcessInstanceLog[] createTestProcessInstanceLogData() {
StandaloneJtaStrategy jtaHelper = new StandaloneJtaStrategy(emf);
EntityManager em = jtaHelper.getEntityManager();
int numEntities = 11;
ProcessInstanceLog[] testData = new ProcessInstanceLog[numEntities];
Calendar cal = randomCal();
for (int i = 0; i < numEntities; ++i) {
ProcessInstanceLog pil = new ProcessInstanceLog(randomLong(), randomString());
pil.setDuration(randomLong());
pil.setExternalId(randomString());
pil.setIdentity(randomString());
pil.setOutcome(randomString());
pil.setParentProcessInstanceId(randomLong());
pil.setProcessId(randomString());
pil.setProcessName(randomString());
pil.setProcessVersion(randomString());
pil.setStatus(random.nextInt());
cal.add(Calendar.MINUTE, 1);
pil.setStart(cal.getTime());
cal.add(Calendar.DAY_OF_YEAR, 1);
pil.setEnd(cal.getTime());
testData[i] = pil;
}
for (int i = 0; i < numEntities; ++i) {
switch(i) {
case 1:
testData[i - 1].setDuration(testData[i].getDuration());
break;
case 2:
testData[i - 1].setEnd(testData[i].getEnd());
break;
case 3:
testData[i - 1].setIdentity(testData[i].getIdentity());
break;
case 4:
testData[i - 1].setProcessId(testData[i].getProcessId());
break;
case 5:
testData[i - 1].setProcessInstanceId(testData[i].getProcessInstanceId());
break;
case 6:
testData[i - 1].setProcessName(testData[i].getProcessName());
break;
case 7:
testData[i - 1].setProcessVersion(testData[i].getProcessVersion());
break;
case 8:
testData[i - 1].setStart(testData[i].getStart());
break;
case 9:
testData[i - 1].setStatus(testData[i].getStatus());
break;
case 10:
testData[i - 1].setOutcome(testData[i].getOutcome());
break;
}
}
Object tx = jtaHelper.joinTransaction(em);
for (int i = 0; i < numEntities; ++i) {
em.persist(testData[i]);
}
jtaHelper.leaveTransaction(em, tx);
return testData;
}
use of org.jbpm.process.audit.strategy.StandaloneJtaStrategy in project jbpm by kiegroup.
the class AuditQueryCoverageTest method setUp.
@Before
public void setUp() throws Exception {
if (pilTestData == null) {
// this is not really necessary..
pilTestData = createTestProcessInstanceLogData(emf);
vilTestData = createTestVariableInstanceLogData(emf);
nilTestData = createTestNodeInstanceLogData(emf);
}
this.persistenceStrategy = new StandaloneJtaStrategy(emf);
}
use of org.jbpm.process.audit.strategy.StandaloneJtaStrategy in project jbpm by kiegroup.
the class AuditQueryDataUtil method createTestProcessInstanceLogData.
static ProcessInstanceLog[] createTestProcessInstanceLogData(EntityManagerFactory emf) {
StandaloneJtaStrategy jtaHelper = new StandaloneJtaStrategy(emf);
EntityManager em = jtaHelper.getEntityManager();
int numEntities = 11;
ProcessInstanceLog[] testData = new ProcessInstanceLog[numEntities];
Calendar cal = randomCal();
for (int i = 0; i < numEntities; ++i) {
ProcessInstanceLog pil = new ProcessInstanceLog(randomLong(), randomString());
pil.setDuration(randomLong());
pil.setExternalId(randomString());
pil.setIdentity(randomString());
pil.setOutcome(randomString());
pil.setParentProcessInstanceId(randomLong());
pil.setProcessId(randomString());
pil.setProcessName(randomString());
pil.setProcessVersion(randomString());
pil.setStatus(random.nextInt());
pil.setCorrelationKey(randomString());
cal.add(Calendar.MINUTE, 1);
pil.setStart(cal.getTime());
cal.add(Calendar.DAY_OF_YEAR, 1);
pil.setEnd(cal.getTime());
testData[i] = pil;
}
for (int i = 0; i < numEntities; ++i) {
switch(i) {
case 1:
testData[i - 1].setDuration(testData[i].getDuration());
break;
case 2:
testData[i - 1].setEnd(testData[i].getEnd());
break;
case 3:
testData[i - 1].setIdentity(testData[i].getIdentity());
break;
case 4:
testData[i - 1].setProcessId(testData[i].getProcessId());
break;
case 5:
testData[i - 1].setProcessInstanceId(testData[i].getProcessInstanceId());
break;
case 6:
testData[i - 1].setProcessName(testData[i].getProcessName());
break;
case 7:
testData[i - 1].setProcessVersion(testData[i].getProcessVersion());
break;
case 8:
testData[i - 1].setStart(testData[i].getStart());
break;
case 9:
testData[i - 1].setStatus(testData[i].getStatus());
break;
case 10:
testData[i - 1].setOutcome(testData[i].getOutcome());
break;
}
}
Object tx = jtaHelper.joinTransaction(em);
for (int i = 0; i < numEntities; ++i) {
em.persist(testData[i]);
}
jtaHelper.leaveTransaction(em, tx);
createdEntities.addAll(Arrays.asList(testData));
return testData;
}
Aggregations