use of org.jbpm.process.instance.event.listeners.TriggerRulesEventListener in project jbpm by kiegroup.
the class TimerCycleOnBinaryPackageTest method testStartTimerCycleFromClasspathDRL.
@Test
@Ignore("beta4 phreak")
public void testStartTimerCycleFromClasspathDRL() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("rules-timer.drl");
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
long sessionId = ksession.getIdentifier();
Environment env = ksession.getEnvironment();
final List<String> list = new ArrayList<String>();
ksession.setGlobal("list", list);
((SingleSessionCommandService) ((CommandBasedStatefulKnowledgeSession) ksession).getRunner()).getKieSession().addEventListener(new TriggerRulesEventListener(ksession));
ksession.fireAllRules();
Thread.sleep(5000);
assertEquals(2, list.size());
logger.info("dispose");
ksession.dispose();
ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, null, env);
AuditLoggerFactory.newInstance(Type.JPA, ksession, null);
final List<String> list2 = new ArrayList<String>();
ksession.setGlobal("list", list2);
((SingleSessionCommandService) ((CommandBasedStatefulKnowledgeSession) ksession).getRunner()).getKieSession().addEventListener(new TriggerRulesEventListener(ksession));
ksession.fireAllRules();
Thread.sleep(5000);
assertEquals(3, list2.size());
}
Aggregations