Package org.camunda.bpm.engine.runtime

Examples of org.camunda.bpm.engine.runtime.CaseExecution


  public void testCreateEventListenerByClass() {
    caseService
      .withCaseDefinitionByKey("case")
      .create();

    CaseExecution taskExecution =
        caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
    assertNotNull(taskExecution);

    // when i create a variable on the human task
    caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute();

    // then the listener is invoked
    assertEquals(1, LogVariableListener.getInvocations().size());

    DelegateVariableInstanceSpec
      .fromCaseExecution(taskExecution)
      .event(VariableListener.CREATE)
      .name("aTaskVariable")
      .value("aTaskValue")
      .matches(LogVariableListener.getInvocations().get(0));

    LogVariableListener.reset();

    // when i update the variable on the human task
    caseService.withCaseExecution(taskExecution.getId()).setVariable("aTaskVariable", "aNewTaskValue").execute();

    // then the listener is not invoked
    assertTrue(LogVariableListener.getInvocations().isEmpty());

    // when i remove the variable from the human task
    caseService.withCaseExecution(taskExecution.getId()).removeVariable("aTaskVariable").execute();

    // then the listener is not invoked
    assertTrue(LogVariableListener.getInvocations().isEmpty());
  }
View Full Code Here


  public void testUpdateEventListenerByClass() {
    caseService
      .withCaseDefinitionByKey("case")
      .create();

    CaseExecution taskExecution =
        caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
    assertNotNull(taskExecution);

    // when i create a variable on the human task
    caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute();

    // then the listener is not invoked
    assertTrue(LogVariableListener.getInvocations().isEmpty());

    // when i update the variable on the human task
    caseService.withCaseExecution(taskExecution.getId()).setVariable("aTaskVariable", "aNewTaskValue").execute();

    // then the listener is invoked
    assertEquals(1, LogVariableListener.getInvocations().size());

    DelegateVariableInstanceSpec
      .fromCaseExecution(taskExecution)
      .event(VariableListener.UPDATE)
      .name("aTaskVariable")
      .value("aNewTaskValue")
      .matches(LogVariableListener.getInvocations().get(0));

    LogVariableListener.reset();


    // when i remove the variable from the human task
    caseService.withCaseExecution(taskExecution.getId()).removeVariable("aTaskVariable").execute();

    // then the listener is not invoked
    assertTrue(LogVariableListener.getInvocations().isEmpty());
  }
View Full Code Here

  public void testVariableListenerInvokedFromSourceScope() {
    CaseInstance caseInstance = caseService
      .withCaseDefinitionByKey("case")
      .create();

    CaseExecution taskExecution =
        caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
    assertNotNull(taskExecution);

    // when i create a variable on the case instance
    caseService.withCaseExecution(caseInstance.getId()).setVariable("aTaskVariable", "aTaskValue").execute();

    // then the listener is not invoked
    assertEquals(0, LogVariableListener.getInvocations().size());

    // when i update the variable from the task execution
    caseService.withCaseExecution(taskExecution.getId()).setVariable("aTaskVariable", "aTaskValue").execute();

    // then the listener is invoked
    assertEquals(1, LogVariableListener.getInvocations().size());

    DelegateVariableInstanceSpec
View Full Code Here

  public void testDeleteEventListenerByClass() {
    caseService
      .withCaseDefinitionByKey("case")
      .create();

    CaseExecution taskExecution =
        caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
    assertNotNull(taskExecution);

    // when i create a variable on the human task
    caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute();

    // then the listener is not invoked
    assertTrue(LogVariableListener.getInvocations().isEmpty());

    // when i update the variable on the human task
    caseService.withCaseExecution(taskExecution.getId()).setVariable("aTaskVariable", "aNewTaskValue").execute();

    // then the listener is not invoked
    assertTrue(LogVariableListener.getInvocations().isEmpty());

    // when i remove the variable from the human task
    caseService.withCaseExecution(taskExecution.getId()).removeVariable("aTaskVariable").execute();

    // then the listener is invoked
    assertEquals(1, LogVariableListener.getInvocations().size());

    DelegateVariableInstanceSpec
View Full Code Here

    caseService
      .withCaseDefinitionByKey("case")
      .create();

    CaseExecution taskExecution =
        caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
    assertNotNull(taskExecution);

    // when i create a variable on the human task
    caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute();

    // then the listener is invoked
    assertEquals(1, LogVariableListener.getInvocations().size());

    DelegateVariableInstanceSpec
View Full Code Here

    caseService
      .withCaseDefinitionByKey("case")
      .create();

    CaseExecution taskExecution =
        caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
    assertNotNull(taskExecution);

    // when i create a variable on the human task
    caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute();

    // then the listener is invoked
    assertTrue(simpleBean.wasInvoked());
  }
View Full Code Here

  public void testVariableListenerByScript() {
    caseService
      .withCaseDefinitionByKey("case")
      .create();

    CaseExecution taskExecution =
        caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
    assertNotNull(taskExecution);

    // when i create a variable on the human task
    caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute();

    // then the listener is invoked
    assertTrue(SimpleBean.wasStaticallyInvoked());

    SimpleBean.reset();
View Full Code Here

  public void testListenerSourceExecution() {
    CaseInstance caseInstance = caseService
      .withCaseDefinitionByKey("case")
      .create();

    CaseExecution taskExecution =
        caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
    assertNotNull(taskExecution);

    // when i set a variable on a deeper scope execution but actually on the parent
    caseService.withCaseExecution(taskExecution.getId()).setVariable("aTaskVariable", "aTaskValue").execute();

    // then the listener is invoked
    assertEquals(1, LogVariableListener.getInvocations().size());

    // and the source execution is the execution the variable was set on
View Full Code Here

  public void testListenerOnParentScope() {
    caseService
      .withCaseDefinitionByKey("case")
      .create();

    CaseExecution taskExecution =
        caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
    assertNotNull(taskExecution);

    // when i set a variable on a deeper scope
    caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute();

    // then the listener is invoked
    assertEquals(1, LogVariableListener.getInvocations().size());

    DelegateVariableInstanceSpec
View Full Code Here

  public void testListenerOnAncestorScope() {
    caseService
      .withCaseDefinitionByKey("case")
      .create();

    CaseExecution stageExecution =
        caseService.createCaseExecutionQuery().activityId("PI_Stage_1").singleResult();
    assertNotNull(stageExecution);

    caseService.withCaseExecution(stageExecution.getId()).manualStart();

    CaseExecution taskExecution =
        caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
    assertNotNull(taskExecution);

    // when i set a variable on a deeper scope
    caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute();

    // then the listener is invoked
    assertEquals(1, LogVariableListener.getInvocations().size());

    DelegateVariableInstanceSpec
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.runtime.CaseExecution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.