Ejemplo n.º 1
0
        public virtual void testMultipleSentries()
        {
            // given
            string caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().Id;

            // when
            string caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).setVariable("myVar", 0).create().Id;

            // then
            CaseSentryPartQueryImpl query = createCaseSentryPartQuery();

            assertEquals(2, query.count());

            CaseSentryPartEntity part = query.sentryId("Sentry_1").singleResult();

            assertEquals(caseInstanceId, part.CaseExecutionId);
            assertEquals(caseInstanceId, part.CaseInstanceId);
            assertEquals("Sentry_1", part.SentryId);
            assertEquals(CmmnSentryDeclaration.IF_PART, part.Type);
            assertNull(part.Source);
            assertNull(part.StandardEvent);
            assertFalse(part.Satisfied);

            part = query.sentryId("Sentry_2").singleResult();

            assertEquals(caseInstanceId, part.CaseExecutionId);
            assertEquals(caseInstanceId, part.CaseInstanceId);
            assertEquals("Sentry_2", part.SentryId);
            assertEquals(CmmnSentryDeclaration.PLAN_ITEM_ON_PART, part.Type);
            assertEquals("PI_HumanTask_1", part.Source);
            assertEquals("complete", part.StandardEvent);
            assertFalse(part.Satisfied);
        }
Ejemplo n.º 2
0
        public virtual void testOnPartIfPartAndVariableOnPart()
        {
            // given
            string caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().Id;

            // when
            string caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().Id;

            // then
            CaseSentryPartQueryImpl query = createCaseSentryPartQuery();

            assertEquals(3, query.count());

            CaseSentryPartEntity part = query.type(CmmnSentryDeclaration.IF_PART).singleResult();

            assertEquals(caseInstanceId, part.CaseExecutionId);
            assertEquals(caseInstanceId, part.CaseInstanceId);
            assertEquals("Sentry_1", part.SentryId);
            assertEquals(CmmnSentryDeclaration.IF_PART, part.Type);
            assertNull(part.Source);
            assertNull(part.StandardEvent);
            assertFalse(part.Satisfied);

            part = query.type(CmmnSentryDeclaration.PLAN_ITEM_ON_PART).singleResult();

            assertEquals(caseInstanceId, part.CaseExecutionId);
            assertEquals(caseInstanceId, part.CaseInstanceId);
            assertEquals("Sentry_1", part.SentryId);
            assertEquals(CmmnSentryDeclaration.PLAN_ITEM_ON_PART, part.Type);
            assertEquals("PI_HumanTask_1", part.Source);
            assertEquals("complete", part.StandardEvent);
            assertFalse(part.Satisfied);

            part = query.type(CmmnSentryDeclaration.VARIABLE_ON_PART).singleResult();

            assertEquals(caseInstanceId, part.CaseExecutionId);
            assertEquals(caseInstanceId, part.CaseInstanceId);
            assertEquals("Sentry_1", part.SentryId);
            assertEquals(CmmnSentryDeclaration.VARIABLE_ON_PART, part.Type);
            assertEquals(VariableTransition.delete.name(), part.VariableEvent);
            assertEquals("variable_1", part.VariableName);
            assertFalse(part.Satisfied);
        }
Ejemplo n.º 3
0
        public virtual void testIfPart()
        {
            // given
            string caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().Id;

            // when
            string caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).setVariable("myVar", 0).create().Id;

            // then
            IList <CaseSentryPartEntity> parts = createCaseSentryPartQuery().list();

            assertEquals(1, parts.Count);

            CaseSentryPartEntity part = parts[0];

            assertEquals(caseInstanceId, part.CaseExecutionId);
            assertEquals(caseInstanceId, part.CaseInstanceId);
            assertEquals("Sentry_1", part.SentryId);
            assertEquals(CmmnSentryDeclaration.IF_PART, part.Type);
            assertNull(part.Source);
            assertNull(part.StandardEvent);
            assertFalse(part.Satisfied);
        }
Ejemplo n.º 4
0
        public virtual void testVariableOnPart()
        {
            // given
            string caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().Id;

            // when
            string caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().Id;

            // then
            IList <CaseSentryPartEntity> parts = createCaseSentryPartQuery().list();

            assertEquals(1, parts.Count);

            CaseSentryPartEntity part = parts[0];

            assertEquals(caseInstanceId, part.CaseExecutionId);
            assertEquals(caseInstanceId, part.CaseInstanceId);
            assertEquals("Sentry_1", part.SentryId);
            assertEquals(CmmnSentryDeclaration.VARIABLE_ON_PART, part.Type);
            assertEquals(VariableTransition.create.name(), part.VariableEvent);
            assertEquals("variable_1", part.VariableName);
            assertFalse(part.Satisfied);
        }
Ejemplo n.º 5
0
        public virtual void testOnPart()
        {
            // given
            string caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().Id;

            // when
            string caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().Id;

            // then
            IList <CaseSentryPartEntity> parts = createCaseSentryPartQuery().list();

            assertEquals(1, parts.Count);

            CaseSentryPartEntity part = parts[0];

            assertEquals(caseInstanceId, part.CaseExecutionId);
            assertEquals(caseInstanceId, part.CaseInstanceId);
            assertEquals("Sentry_1", part.SentryId);
            assertEquals(CmmnSentryDeclaration.PLAN_ITEM_ON_PART, part.Type);
            assertEquals("PI_HumanTask_1", part.Source);
            assertEquals("complete", part.StandardEvent);
            assertFalse(part.Satisfied);
        }