config,
env );
int sessionId = service.getSessionId();
StartProcessCommand startProcessCommand = new StartProcessCommand();
startProcessCommand.setProcessId( "org.drools.test.TestProcess" );
RuleFlowProcessInstance processInstance = (RuleFlowProcessInstance) service.execute( startProcessCommand );
System.out.println( "Started process instance " + processInstance.getId() );
long processInstanceId = processInstance.getId();
TestWorkItemHandler handler = TestWorkItemHandler.getInstance();
WorkItem workItem = handler.getWorkItem();
assertNotNull( workItem );
service.dispose();
service = new SingleSessionCommandService( sessionId,
ruleBase,
config,
env );
GetProcessInstanceCommand getProcessInstanceCommand = new GetProcessInstanceCommand();
getProcessInstanceCommand.setProcessInstanceId( processInstanceId );
processInstance = (RuleFlowProcessInstance) service.execute( getProcessInstanceCommand );
assertNotNull( processInstance );
Collection<NodeInstance> nodeInstances = processInstance.getNodeInstances();
assertEquals( 1,
nodeInstances.size() );
SubProcessNodeInstance subProcessNodeInstance = (SubProcessNodeInstance) nodeInstances.iterator().next();
long subProcessInstanceId = subProcessNodeInstance.getProcessInstanceId();
getProcessInstanceCommand = new GetProcessInstanceCommand();
getProcessInstanceCommand.setProcessInstanceId( subProcessInstanceId );
RuleFlowProcessInstance subProcessInstance = (RuleFlowProcessInstance) service.execute( getProcessInstanceCommand );
assertNotNull( subProcessInstance );
service.dispose();
service = new SingleSessionCommandService( sessionId,
ruleBase,