use of io.automatiko.engine.codegen.data.PersonWithAddress in project automatiko-engine by automatiko-io.
the class CallActivityTaskTest method testCallActivityTaskWithExpressionsForIONested.
@Test
public void testCallActivityTaskWithExpressionsForIONested() throws Exception {
Application app = generateCodeProcessesOnly("subprocess/CallActivityWithIOexpressionNested.bpmn2", "subprocess/CallActivitySubProcess.bpmn2");
assertThat(app).isNotNull();
Process<? extends Model> p = app.processes().processById("ParentProcess");
Model m = p.createModel();
Map<String, Object> parameters = new HashMap<>();
PersonWithAddress pa = new PersonWithAddress("john", 0);
pa.setAddress(new Address("test", null, null, null));
parameters.put("person", pa);
m.fromMap(parameters);
ProcessInstance<?> processInstance = p.createInstance(m);
processInstance.start();
assertThat(processInstance.status()).isEqualTo(ProcessInstance.STATE_ACTIVE);
Model result = (Model) processInstance.variables();
assertThat(result.toMap()).hasSize(1).containsKeys("person");
PersonWithAddress person = (PersonWithAddress) result.toMap().get("person");
assertEquals("john", person.getName());
assertEquals("test", person.getAddress().getStreet());
assertEquals("new value", person.getAddress().getCity());
List<WorkItem> workItems = processInstance.workItems(securityPolicy);
assertEquals(1, workItems.size());
WorkItem wi = workItems.get(0);
assertEquals("MyTask", wi.getName());
assertEquals(Active.ID, wi.getPhase());
assertEquals(Active.STATUS, wi.getPhaseStatus());
processInstance.transitionWorkItem(workItems.get(0).getId(), new HumanTaskTransition(Complete.ID, null, securityPolicy));
assertThat(processInstance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}
Aggregations