@Test
public void testProcess() throws Exception {
BatchExecutionCommandImpl cmd = new BatchExecutionCommandImpl();
cmd.setLookup( "ksession1" );
StartProcessCommand start = new StartProcessCommand( "org.drools.actions" , "process-instance-id" );
start.putParameter( "person",
new Person( "lucaz",
25 ) );
start.putParameter( "person2",
new Person( "hadrian",
25 ) );
start.putParameter( "person3",
new Person( "baunax",
21 ) );
cmd.getCommands().add( start );
StringWriter xmlReq = new StringWriter();
Marshaller marshaller = getJaxbContext().createMarshaller();
marshaller.setProperty( "jaxb.formatted.output",
true );
marshaller.marshal( cmd,
xmlReq );
System.out.println( xmlReq.toString() );
byte[] xmlResp = (byte[]) template.requestBody( "direct:test-with-session",
xmlReq.toString() );
assertNotNull( xmlResp );
System.out.println( new String( xmlResp ) );
ExecutionResults resp = (ExecutionResults) getJaxbContext().createUnmarshaller().unmarshal( new ByteArrayInputStream( xmlResp ) );
assertNotNull( resp );
assertNotNull( resp.getValue( "process-instance-id" ) );
}