Search in sources :

Example 1 with Account

use of org.jbpm.bpmn2.objects.Account in project kogito-runtimes by kiegroup.

the class ActivityTest method testBusinessRuleTaskWithExpressionsForIO.

@Test
@RequirePersistence(false)
public void testBusinessRuleTaskWithExpressionsForIO() throws Exception {
    kruntime = createKogitoProcessRuntime("BPMN2-BusinessRuleTaskWithDataInputIOExpression.bpmn2", "BPMN2-BusinessRuleTaskWithDataInput.drl");
    kruntime.getProcessEventManager().addEventListener(new RuleAwareProcessEventListener());
    Map<String, Object> params = new HashMap<>();
    params.put("person", new Person(null));
    params.put("account", new Account());
    KogitoProcessInstance processInstance = kruntime.startProcess("BPMN2-BusinessRuleTask", params);
    assertProcessInstanceFinished(processInstance, kruntime);
    Person person = (Person) processInstance.getVariables().get("person");
    assertEquals("john", person.getName());
    Account account = (Account) processInstance.getVariables().get("account");
    assertNotNull(account.getPerson());
}
Also used : Account(org.jbpm.bpmn2.objects.Account) HashMap(java.util.HashMap) RuleAwareProcessEventListener(org.jbpm.process.instance.event.listeners.RuleAwareProcessEventListener) KogitoProcessInstance(org.kie.kogito.internal.process.runtime.KogitoProcessInstance) Person(org.jbpm.bpmn2.objects.Person) Test(org.junit.jupiter.api.Test) RequirePersistence(org.jbpm.bpmn2.test.RequirePersistence)

Aggregations

HashMap (java.util.HashMap)1 Account (org.jbpm.bpmn2.objects.Account)1 Person (org.jbpm.bpmn2.objects.Person)1 RequirePersistence (org.jbpm.bpmn2.test.RequirePersistence)1 RuleAwareProcessEventListener (org.jbpm.process.instance.event.listeners.RuleAwareProcessEventListener)1 Test (org.junit.jupiter.api.Test)1 KogitoProcessInstance (org.kie.kogito.internal.process.runtime.KogitoProcessInstance)1