env.set( EnvironmentName.ENTITY_MANAGER_FACTORY,
ctx.getBean( "myEmf" ) );
env.set( EnvironmentName.TRANSACTION_MANAGER,
ctx.getBean( "txManager" ) );
*/
KieStoreServices kstore = (KieStoreServices) ctx.getBean( "kstore1" );
KieBase kbase1 = (KieBase) ctx.getBean( "kbProcessWorkItems" );
service = kstore.loadKieSession( sessionId,
kbase1,
null,
env );
processInstance = (RuleFlowProcessInstance) service.getProcessInstance( processInstanceId );
assertNotNull( processInstance );
Collection<NodeInstance> nodeInstances = processInstance.getNodeInstances();
assertEquals( 1,
nodeInstances.size() );
SubProcessNodeInstance subProcessNodeInstance = (SubProcessNodeInstance) nodeInstances.iterator().next();
long subProcessInstanceId = subProcessNodeInstance.getProcessInstanceId();
RuleFlowProcessInstance subProcessInstance = (RuleFlowProcessInstance) service.getProcessInstance( subProcessInstanceId );
assertNotNull( subProcessInstance );
service.dispose();
service = kstore.loadKieSession( sessionId,
kbase1,
null,
env );
service.getWorkItemManager().completeWorkItem( workItem.getId(),
null );
service.dispose();
service = kstore.loadKieSession( sessionId,
kbase1,
null,
env );
subProcessInstance = (RuleFlowProcessInstance) service.getProcessInstance( subProcessInstanceId );
assertNull( subProcessInstance );