Example #1
0
        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);
        }
Example #2
0
        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);
        }