use of org.jbpm.persistence.api.integration.InstanceView in project jbpm by kiegroup.
the class PersistentStatefulSessionTest method testIntegrationWithEventManager3.
@Test
public void testIntegrationWithEventManager3() {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(new ClassPathResource("WorkItemsProcess.rf"), ResourceType.DRF);
InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addPackages(kbuilder.getKnowledgePackages());
StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
ksession.getWorkItemManager().registerWorkItemHandler("MyWork", new SystemOutWorkItemHandler());
ProcessInstance processInstance = ksession.startProcess("org.drools.test.TestProcess");
ksession.insert("TestString");
assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
List<InstanceView<?>> events = TestEventEmitter.getEvents();
assertNotNull(events);
assertEquals(1, events.size());
}
Aggregations