person );
WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess( "org.drools.actions",
parameters );
assertEquals( ProcessInstance.STATE_ACTIVE,
processInstance.getState() );
WorkItem workItem = handler.getWorkItem();
assertNotNull( workItem );
assertEquals( "John Doe",
workItem.getParameter( "ActorId" ) );
assertEquals( "John Doe",
workItem.getParameter( "Content" ) );
assertEquals( "John Doe",
workItem.getParameter( "Comment" ) );
assertEquals( WorkItem.PENDING,
workItem.getState() );
String inXml = "";
inXml = "{\"complete-work-item\":{\"id\":" + workItem.getId() + "}}";
inXml = roundTripFromXml( inXml );
getPipelineStateful( ksession ).insert( inXml,
new ResultHandlerImpl() );
assertEquals( WorkItem.COMPLETED,
workItem.getState() );
assertEquals( ProcessInstance.STATE_COMPLETED,
processInstance.getState() );
parameters = new HashMap<String, Object>();
parameters.put( "UserName",
"Jane Doe" );
parameters.put( "MyObject",
"SomeString" );
person = new Person();
person.setName( "Jane Doe" );
parameters.put( "Person",
person );
processInstance = (WorkflowProcessInstance) ksession.startProcess( "org.drools.actions",
parameters );
assertEquals( ProcessInstance.STATE_ACTIVE,
processInstance.getState() );
workItem = handler.getWorkItem();
assertNotNull( workItem );
assertEquals( "Jane Doe",
workItem.getParameter( "ActorId" ) );
assertEquals( "SomeString",
workItem.getParameter( "Attachment" ) );
assertEquals( "Jane Doe",
workItem.getParameter( "Content" ) );
assertEquals( "Jane Doe",
workItem.getParameter( "Comment" ) );
assertEquals( WorkItem.PENDING,
workItem.getState() );
inXml = "{\"complete-work-item\":{\"id\":" + workItem.getId() + ",\"results\":{\"identifier\":\"Result\",\"object\":{\"@class\":\"string\",\"$\":\"SomeOtherString\"}}}}";
inXml = roundTripFromXml( inXml );
getPipelineStateful( ksession ).insert( inXml,
new ResultHandlerImpl() );
assertEquals( WorkItem.COMPLETED,
workItem.getState() );
assertEquals( ProcessInstance.STATE_COMPLETED,
processInstance.getState() );
assertEquals( "SomeOtherString",
processInstance.getVariable( "MyObject" ) );