Package org.camunda.bpm.engine.runtime

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


    // then
    CaseExecution caseTask = queryCaseExecutionByActivityId(CASE_TASK_KEY);
    assertNull(caseTask);

    // the case instance has been completed
    CaseInstance superCaseInstance = queryCaseInstanceByKey(DEFINITION_KEY);
    assertNotNull(superCaseInstance);
    assertTrue(superCaseInstance.isCompleted());
  }
View Full Code Here


    }
  }

  @Deployment
  public void testAnyEventListenerByClass() {
    CaseInstance caseInstance = caseService
      .withCaseDefinitionByKey("case")
      .create();

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

    // when i set a variable on a higher scope
    caseService.withCaseExecution(caseInstance.getId()).setVariable("anInstanceVariable", "anInstanceValue").execute();

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

    // when i set a variable on the human task (ie the source execution matters although the variable ends up in the same place)
View Full Code Here

  }


  @Deployment
  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
View Full Code Here

    SimpleBean.reset();
  }

  @Deployment(resources = "org/camunda/bpm/engine/test/cmmn/listener/VariableListenerTest.testListenerOnParentScope.cmmn")
  public void testListenerSourceExecution() {
    CaseInstance caseInstance = caseService
      .withCaseDefinitionByKey("case")
      .create();

    CaseExecution taskExecution =
        caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
View Full Code Here

    LogVariableListener.reset();
  }

  @Deployment
  public void testChildListenersNotInvoked() {
    CaseInstance caseInstance = caseService
      .withCaseDefinitionByKey("case")
      .create();

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

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

    LogVariableListener.reset();
View Full Code Here

    }
  }

  @Deployment
  public void testDelegateInstanceIsProcessEngineAware() {
    CaseInstance caseInstance = caseService
      .withCaseDefinitionByKey("case")
      .create();
    assertFalse(ProcessEngineAwareListener.hasFoundValidRuntimeService());

    // when i set a variable that causes the listener to be notified
    caseService.withCaseExecution(caseInstance.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute();

    // then the listener is invoked and has found process engine services
    assertTrue(ProcessEngineAwareListener.hasFoundValidRuntimeService());

    ProcessEngineAwareListener.reset();
View Full Code Here

  /**
   * TODO: add when history for case execution variables is implemented
   */
  @Deployment
  public void FAILING_testListenerDoesNotInterfereWithHistory() {
    CaseInstance caseInstance = caseService
      .withCaseDefinitionByKey("case")
      .create();

    // when i set a variable that causes the listener to be notified
    // and that listener sets the same variable to another value (here "value2")
    caseService.withCaseExecution(caseInstance.getId()).setVariableLocal("variable", "value1").execute();

    // then there should be two historic variable updates for both values
    if (processEngineConfiguration.getHistoryLevel().getId() >= HistoryLevel.HISTORY_LEVEL_FULL.getId()) {
      List<HistoricDetail> variableUpdates = historyService.createHistoricDetailQuery().variableUpdates().list();

View Full Code Here

    LogInjectedValuesListener.reset();
  }

  @Deployment
  public void testVariableListenerExecutionContext() {
    CaseInstance caseInstance = caseService
      .withCaseDefinitionByKey("case")
      .create();

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

    // when i set a variable
    caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("testVariable", "value1").execute();

    // then the listener is invoked
    assertEquals(1, LogExecutionContextListener.getCaseExecutionContexts().size());
    CaseExecutionContext executionContext = LogExecutionContextListener.getCaseExecutionContexts().get(0);

    assertNotNull(executionContext);

    // although this is not inside a command, checking for IDs should be ok
    assertEquals(caseInstance.getId(), executionContext.getCaseInstance().getId());
    assertEquals(taskExecution.getId(), executionContext.getExecution().getId());

    LogExecutionContextListener.reset();
  }
View Full Code Here

    assertNotNull(task);

    CaseExecution processTask = queryCaseExecutionByActivityId(PROCESS_TASK);
    assertNull(processTask);

    CaseInstance caseInstance = caseService
        .createCaseInstanceQuery()
        .singleResult();
    assertNotNull(caseInstance);
    assertTrue(caseInstance.isCompleted());

    // complete ////////////////////////////////////////////////////////

    close(caseInstanceId);
    assertCaseEnded(caseInstanceId);
View Full Code Here

    assertNull(processInstance);

    CaseExecution processTask = queryCaseExecutionByActivityId(PROCESS_TASK);
    assertNull(processTask);

    CaseInstance caseInstance = caseService
        .createCaseInstanceQuery()
        .singleResult();
    assertNotNull(caseInstance);
    assertTrue(caseInstance.isCompleted());

    // complete ////////////////////////////////////////////////////////

    close(caseInstanceId);
    assertCaseEnded(caseInstanceId);
View Full Code Here

TOP

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

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.