while (matcher.find()) { String paramName = matcher.group(1); variableValue = processInstance.getVariable(paramName); if (variableValue == null) { try {
parameters ); Object numberVariable = ((WorkflowProcessInstance)processInstance).getVariable("MyObject"); Assert.assertNotNull(numberVariable); Assert.assertEquals("one", numberVariable); parameters ); numberVariable = ((WorkflowProcessInstance)processInstance).getVariable("MyObject"); Assert.assertNotNull(numberVariable); Assert.assertEquals("two", numberVariable);
@Test public void testMockDataWorkItemHandler() { String processId = "org.drools.actions"; String workName = "Unnexistent Task"; RuleFlowProcess process = getWorkItemProcess( processId, workName ); KieSession ksession = createKieSession(process); Map<String, Object> output = new HashMap<String, Object>(); output.put("Result", "test"); ksession.getWorkItemManager().registerWorkItemHandler( workName, new MockDataWorkItemHandler(output) ); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put( "UserName", "John Doe" ); parameters.put( "Person", new Person( "John Doe" ) ); ProcessInstance processInstance = ksession.startProcess( "org.drools.actions", parameters ); Object numberVariable = ((WorkflowProcessInstance)processInstance).getVariable("MyObject"); Assert.assertNotNull(numberVariable); Assert.assertEquals("test", numberVariable); Assert.assertEquals( ProcessInstance.STATE_COMPLETED, processInstance.getState() ); }
private void exceptionHandlingCompleted(ProcessInstance processInstance, ProcessWorkItemHandlerException handlerException) { handlerException = (ProcessWorkItemHandlerException) ((WorkflowProcessInstance)processInstance).getVariable("Error");
String [] procVar = (String []) ((WorkflowProcessInstance) processInstance).getVariable("fireball"); assertEquals( "Rule task did NOT fire or complete.", "boom!", procVar[0] );
Object processClient = ((WorkflowProcessInstance)processInstance).getVariable("processClient"); assertNotNull(processClient); assertEquals("pv207.finepayment.Client", processClient.getClass().getName());
assertNotNull(pi); String varX = (String) ((WorkflowProcessInstance)pi).getVariable("x"); assertEquals(TestMarshallingStrategy.ALWAYS_RESPOND_WITH, varX);
while (matcher.find()) { String paramName = matcher.group(1); variableValue = processInstance.getVariable(paramName); if (variableValue == null) { try {
private void exceptionHandlingCompleted(ProcessInstance processInstance, ProcessWorkItemHandlerException handlerException) { handlerException = (ProcessWorkItemHandlerException) ((WorkflowProcessInstance)processInstance).getVariable("Error");
String [] procVar = (String []) ((WorkflowProcessInstance) processInstance).getVariable("fireball"); assertEquals( "Rule task did NOT fire or complete.", "boom!", procVar[0] );