@Deployment(resources = NESTED_ASYNC_BEFORE_IO_LISTENER_PROCESS)
  public void testCancelTransitionInstanceShouldNotInvokeIoMappingAndListenersOfTargetActivity() {
    RecorderExecutionListener.clear();

    // given a process instance with an async task in a subprocess
    ProcessInstance processInstance =
        runtimeService.startProcessInstanceByKey(
            "nestedOneTaskProcess",
            Variables.createVariables().putValue("listener", new RecorderExecutionListener()));

    ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());

    assertEquals(1, managementService.createJobQuery().count());

    // when the async task is cancelled via cancelTransitionInstance
    runtimeService
        .createProcessInstanceModification(processInstance.getId())
        .cancelTransitionInstance(
            getChildTransitionInstanceForTargetActivity(tree, "innerTask").getId())
        .execute();

    // then no io mapping is executed and no end listener is executed
    assertTrue(RecorderExecutionListener.getRecordedEvents().isEmpty());
    assertEquals(
        0,
        runtimeService.createVariableInstanceQuery().variableName("outputMappingExecuted").count());

    // and the process can be completed successfully
    completeTasksInOrder("outerTask");
    assertProcessEnded(processInstance.getId());
  }
 protected String createCaseInstance(String tenantId) {
   VariableMap variables = Variables.putValue(VARIABLE_NAME, VARIABLE_VALUE);
   CaseInstanceBuilder builder =
       caseService.withCaseDefinitionByKey("twoTaskCase").setVariables(variables);
   if (tenantId == null) {
     return builder.create().getId();
   } else {
     return builder.caseDefinitionTenantId(tenantId).create().getId();
   }
 }
コード例 #3
0
  @Test
  @DecisionResource(resource = RESULT_TEST_WITH_TYPES_DMN)
  public void testSingleOutputTypedValue() {
    DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
    assertThat(decisionResult).hasSize(1);

    DmnDecisionRuleResult ruleResult = decisionResult.getFirstResult();

    TypedValue typedValue = ruleResult.getEntryTyped("firstOutput");
    assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));

    typedValue = ruleResult.getEntryTyped("secondOutput");
    assertThat(typedValue).isNull();

    typedValue = ruleResult.getFirstEntryTyped();
    assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));

    typedValue = ruleResult.getSingleEntryTyped();
    assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));
  }
  @Before
  public void setUp() {
    decisionService = engineRule.getDecisionService();
    repositoryService = engineRule.getRepositoryService();
    historyService = engineRule.getHistoryService();
    identityService = engineRule.getIdentityService();

    testRule.deployForTenant(TENANT_ONE, DISH_DRG_DMN);

    decisionService
        .evaluateDecisionByKey(DISH_DECISION)
        .decisionDefinitionTenantId(TENANT_ONE)
        .variables(
            Variables.createVariables().putValue(TEMPERATURE, 21).putValue(DAY_TYPE, WEEKEND))
        .evaluate();
  }
コード例 #5
0
  /** CAM-3707 */
  @Deployment
  public void FAILING_testDeleteShouldNotInvokeListeners() {
    RecorderExecutionListener.clear();

    // given
    ProcessInstance instance =
        runtimeService.startProcessInstanceByKey(
            "asyncListener",
            Variables.createVariables().putValue("listener", new RecorderExecutionListener()));
    assertEquals(1, managementService.createJobQuery().count());

    // when deleting the process instance
    runtimeService.deleteProcessInstance(instance.getId(), "");

    // then no listeners for the async activity should have been invoked because
    // it was not active yet
    assertEquals(0, RecorderExecutionListener.getRecordedEvents().size());

    RecorderExecutionListener.clear();
  }
  @Deployment
  public void testCancelAsyncAfterTransitionInstanceInvokesParentListeners() {
    RecorderExecutionListener.clear();

    ProcessInstance processInstance =
        runtimeService.startProcessInstanceByKey(
            "nestedOneTaskProcess",
            Variables.createVariables().putValue("listener", new RecorderExecutionListener()));
    String processInstanceId = processInstance.getId();

    ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());

    runtimeService
        .createProcessInstanceModification(processInstanceId)
        .cancelTransitionInstance(
            getChildTransitionInstanceForTargetActivity(tree, "subProcessEnd").getId())
        .execute();

    assertEquals(1, RecorderExecutionListener.getRecordedEvents().size());
    RecordedEvent event = RecorderExecutionListener.getRecordedEvents().get(0);
    assertEquals("subProcess", event.getActivityId());

    RecorderExecutionListener.clear();
  }
コード例 #7
0
 public EvaluateDecisionByIdCmd(String decisionDefinitionId, Map<String, Object> variables) {
   this.decisionDefinitionId = decisionDefinitionId;
   this.variables = Variables.fromMap(variables);
 }