}
Collection<KnowledgePackage> kpkgs = kbuilder.getKnowledgePackages();
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kpkgs );
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
List<Long> list = new ArrayList<Long>();
ksession.setGlobal("list", list);
Person john = new Person("John Doe", 20);
Person jane = new Person("Jane Doe", 20);
Person julie = new Person("Julie Doe", 20);
ksession.insert(john);
ksession.insert(jane);
Map<String, Object> params = new HashMap<String, Object>();
params.put("name", john.getName());
ProcessInstance processInstance1 =
ksession.startProcess("org.jbpm.process-split", params);
params = new HashMap<String, Object>();
params.put("name", jane.getName());
ProcessInstance processInstance2 =
ksession.startProcess("org.jbpm.process-split", params);
params = new HashMap<String, Object>();
params.put("name", julie.getName());
ProcessInstance processInstance3 =
ksession.startProcess("org.jbpm.process-split", params);
assertEquals(ProcessInstance.STATE_COMPLETED, processInstance1.getState());
assertEquals(ProcessInstance.STATE_COMPLETED, processInstance2.getState());
assertEquals(ProcessInstance.STATE_COMPLETED, processInstance3.getState());
assertEquals(2, list.size());