@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());
  }
Exemple #2
0
  protected void createItemDefinitions() {
    for (org.activiti.bpmn.model.ItemDefinition itemDefinitionElement :
        bpmnModel.getItemDefinitions().values()) {
      StructureDefinition structure = null;

      try {
        // it is a class
        Class<?> classStructure = ReflectUtil.loadClass(itemDefinitionElement.getStructureRef());
        structure = new ClassStructureDefinition(classStructure);
      } catch (ActivitiException e) {
        // it is a reference to a different structure
        structure = this.structures.get(itemDefinitionElement.getStructureRef());
      }

      ItemDefinition itemDefinition = new ItemDefinition(itemDefinitionElement.getId(), structure);
      if (StringUtils.isNotEmpty(itemDefinitionElement.getItemKind())) {
        itemDefinition.setItemKind(ItemKind.valueOf(itemDefinitionElement.getItemKind()));
      }
      itemDefinitions.put(itemDefinition.getId(), itemDefinition);
    }
  }