Machine.builder().localhost().createMachine(),
Machine.builder().localhost().externalId("local-2").createMachine()
);
when(execution.getVariable(eq(CoreProcessVariables.MACHINES))).thenReturn(machines);
ProcessVariablesCollector collector = new ProcessVariablesCollector();
collector.install(execution);
ProcessEngine processEngine = new StandaloneInMemProcessEngineConfiguration()
.setJobExecutorActivate(true).buildProcessEngine();
processEngine.getRepositoryService().createDeployment()
.addClasspathResource("diagrams/empty.bpmn20.xml").deploy();
try {
JavaDelegate delegate = new SpawnProcessForEachMachine(processEngine, EMPTY_PROCESS_KEY, "test", RESULT);
delegate.execute(execution);
@SuppressWarnings("unchecked")
List<String> processInstanceIds = (List<String>) collector.getVariable(RESULT);
assertThat(processInstanceIds).hasSize(2);
} finally {
processEngine.close();