/** {@inheritDoc} */ public void execute(ActivityExecution execution) throws Exception { MessageInstance message; if (ioSpecification != null) { this.ioSpecification.initialize(execution); ItemInstance inputItem = (ItemInstance) execution.getVariable(this.ioSpecification.getFirstDataInputName()); message = new MessageInstance(this.operation.getInMessage(), inputItem); } else { message = this.operation.getInMessage().createInstance(); } execution.setVariable(CURRENT_MESSAGE, message); this.fillMessage(message, execution); MessageInstance receivedMessage = this.operation.sendMessage(message); execution.setVariable(CURRENT_MESSAGE, receivedMessage); if (ioSpecification != null) { String firstDataOutputName = this.ioSpecification.getFirstDataOutputName(); if (firstDataOutputName != null) { ItemInstance outputItem = (ItemInstance) execution.getVariable(firstDataOutputName); outputItem .getStructureInstance() .loadFrom(receivedMessage.getStructureInstance().toArray()); } } this.returnMessage(receivedMessage, execution); execution.setVariable(CURRENT_MESSAGE, null); leave(execution); }
@Deployment public void testAsyncInvocationWithDataFlowUEL() throws Exception { assertEquals(-1, webServiceMock.getCount()); ProcessDefinitionEntity processDefinition = processEngineConfiguration .getCommandExecutor() .execute( new Command<ProcessDefinitionEntity>() { public ProcessDefinitionEntity execute(CommandContext commandContext) { return Context.getProcessEngineConfiguration() .getDeploymentManager() .findDeployedLatestProcessDefinitionByKey( "asyncWebServiceInvocationWithDataFlowUEL"); } }); ItemDefinition itemDefinition = processDefinition.getIoSpecification().getDataInputs().get(0).getDefinition(); ItemInstance itemInstance = itemDefinition.createInstance(); FieldBaseStructureInstance structureInstance = (FieldBaseStructureInstance) itemInstance.getStructureInstance(); structureInstance.setFieldValue("newCounterValue", 23); Map<String, Object> variables = new HashMap<String, Object>(); variables.put("dataInputOfProcess", itemInstance); processEngine .getRuntimeService() .startProcessInstanceByKey("asyncWebServiceInvocationWithDataFlowUEL", variables); waitForJobExecutorToProcessAllJobs(10000L, 250L); assertEquals(23, webServiceMock.getCount()); }