protected void ensureCaseDefinitionInitialized() { if ((caseDefinition == null) && (caseDefinitionId != null)) { CaseDefinitionEntity deployedCaseDefinition = Context .getProcessEngineConfiguration() .getDeploymentCache() .getCaseDefinitionById(caseDefinitionId); setCaseDefinition(deployedCaseDefinition); } }
protected void ensureCaseDefinitionInitialized() { if ((caseDefinition == null) && (caseDefinitionId != null)) { CaseDefinitionEntity deployedCaseDefinition = Context .getProcessEngineConfiguration() .getDeploymentCache() .getCaseDefinitionById(caseDefinitionId); setCaseDefinition(deployedCaseDefinition); } }
@Deployment public void testInvokeBuiltinListenersOnly() { // disable custom variable listener invocation processEngineConfiguration.setInvokeCustomVariableListeners(false); // add a builtin variable listener the hard way CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().singleResult(); processEngineConfiguration .getDeploymentCache() .getCaseDefinitionById(caseDefinition.getId()) .findActivity("PI_HumanTask_1") .addBuiltInVariableListener(CaseVariableListener.CREATE, new LogVariableListener()); 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 builtin listener is invoked assertEquals(1, LogVariableListener.getInvocations().size()); // but the custom listener is not invoked assertEquals(0, LogExecutionContextListener.getCaseExecutionContexts().size()); LogVariableListener.reset(); LogExecutionContextListener.reset(); // restore configuration processEngineConfiguration.setInvokeCustomVariableListeners(true); }
protected void ensureCaseDefinitionInitialized() { if ((caseDefinition == null) && (caseDefinitionId != null)) { CaseDefinitionEntity deployedCaseDefinition = Context .getProcessEngineConfiguration() .getDeploymentCache() .getCaseDefinitionById(caseDefinitionId); setCaseDefinition(deployedCaseDefinition); } }
@Deployment public void testInvokeBuiltinListenersOnly() { // disable custom variable listener invocation processEngineConfiguration.setInvokeCustomVariableListeners(false); // add a builtin variable listener the hard way CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().singleResult(); processEngineConfiguration .getDeploymentCache() .getCaseDefinitionById(caseDefinition.getId()) .findActivity("PI_HumanTask_1") .addBuiltInVariableListener(CaseVariableListener.CREATE, new LogVariableListener()); 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 builtin listener is invoked assertEquals(1, LogVariableListener.getInvocations().size()); // but the custom listener is not invoked assertEquals(0, LogExecutionContextListener.getCaseExecutionContexts().size()); LogVariableListener.reset(); LogExecutionContextListener.reset(); // restore configuration processEngineConfiguration.setInvokeCustomVariableListeners(true); }