use of org.drools.persistence.PersistableRunner in project jbpm by kiegroup.
the class SingleSessionCommandServiceTest method testPersistenceTimer2.
@Test
public void testPersistenceTimer2() throws Exception {
setUp();
Properties properties = new Properties();
properties.setProperty("drools.commandService", PersistableRunner.class.getName());
properties.setProperty("drools.processInstanceManagerFactory", JPAProcessInstanceManagerFactory.class.getName());
properties.setProperty("drools.workItemManagerFactory", JPAWorkItemManagerFactory.class.getName());
properties.setProperty("drools.processSignalManagerFactory", JPASignalManagerFactory.class.getName());
SessionConfiguration config = SessionConfiguration.newInstance(properties);
config.setOption(TimerJobFactoryOption.get(TimerJobFactoryType.JPA.getId()));
InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
Collection<KiePackage> kpkgs = getProcessTimer2();
kbase.addPackages(kpkgs);
PersistableRunner service = new PersistableRunner(kbase, config, env);
Long sessionId = service.getSessionId();
StartProcessCommand startProcessCommand = new StartProcessCommand();
startProcessCommand.setProcessId("org.drools.test.TestProcess");
ProcessInstance processInstance = service.execute(startProcessCommand);
logger.info("Started process instance {}", processInstance.getId());
Thread.sleep(2000);
service = new PersistableRunner(sessionId, kbase, config, env);
GetProcessInstanceCommand getProcessInstanceCommand = new GetProcessInstanceCommand();
getProcessInstanceCommand.setProcessInstanceId(processInstance.getId());
processInstance = service.execute(getProcessInstanceCommand);
assertNull(processInstance);
}
Aggregations