public virtual void testCloseListenerByExpression() { CloseCaseExecutionListener.clear(); assertNull(CloseCaseExecutionListener.EVENT); assertEquals(0, CloseCaseExecutionListener.COUNTER); assertNull(CloseCaseExecutionListener.ON_CASE_EXECUTION_ID); // given string caseInstanceId = caseService.withCaseDefinitionByKey("case").setVariable("myListener", new CloseCaseExecutionListener()).create().Id; suspend(caseInstanceId); // when caseService.withCaseExecution(caseInstanceId).close(); // then assertEquals("close", CloseCaseExecutionListener.EVENT); assertEquals(1, CloseCaseExecutionListener.COUNTER); assertEquals(caseInstanceId, CloseCaseExecutionListener.ON_CASE_EXECUTION_ID); }
public virtual void testCloseListenerByClass() { CloseCaseExecutionListener.clear(); assertNull(CloseCaseExecutionListener.EVENT); assertEquals(0, CloseCaseExecutionListener.COUNTER); assertNull(CloseCaseExecutionListener.ON_CASE_EXECUTION_ID); // given string caseInstanceId = caseService.withCaseDefinitionByKey("case").create().Id; caseService.withCaseExecution(caseInstanceId).complete(); // when caseService.withCaseExecution(caseInstanceId).close(); // then assertEquals("close", CloseCaseExecutionListener.EVENT); assertEquals(1, CloseCaseExecutionListener.COUNTER); assertEquals(caseInstanceId, CloseCaseExecutionListener.ON_CASE_EXECUTION_ID); }