Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testEntryCriteria()
        public virtual void testEntryCriteria()
        {
            // given

            // create sentry containing ifPart
            Sentry sentry = createElement(casePlanModel, "Sentry_1", typeof(Sentry));
            IfPart ifPart = createElement(sentry, "abc", typeof(IfPart));
            ConditionExpression conditionExpression = createElement(ifPart, "def", typeof(ConditionExpression));

            conditionExpression.Text = "${test}";

            // set entryCriteria
            EntryCriterion criterion = createElement(planItem, typeof(EntryCriterion));

            criterion.Sentry = sentry;

            // transform casePlanModel as parent
            CmmnActivity parent = (new CasePlanModelHandler()).handleElement(casePlanModel, context);

            context.Parent = parent;

            // transform Sentry
            CmmnSentryDeclaration sentryDeclaration = (new SentryHandler()).handleElement(sentry, context);

            // when
            CmmnActivity newActivity = handler.handleElement(planItem, context);

            // then
            assertTrue(newActivity.ExitCriteria.Count == 0);

            assertFalse(newActivity.EntryCriteria.Count == 0);
            assertEquals(1, newActivity.EntryCriteria.Count);

            assertEquals(sentryDeclaration, newActivity.EntryCriteria[0]);
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMultipleExitCriteria()
        public virtual void testMultipleExitCriteria()
        {
            // given

            // create first sentry containing ifPart
            Sentry sentry1 = createElement(casePlanModel, "Sentry_1", typeof(Sentry));
            IfPart ifPart1 = createElement(sentry1, "abc", typeof(IfPart));
            ConditionExpression conditionExpression1 = createElement(ifPart1, "def", typeof(ConditionExpression));

            conditionExpression1.Text = "${test}";

            // set first exitCriteria
            ExitCriterion criterion1 = createElement(casePlanModel, typeof(ExitCriterion));

            criterion1.Sentry = sentry1;

            // create first sentry containing ifPart
            Sentry sentry2 = createElement(casePlanModel, "Sentry_2", typeof(Sentry));
            IfPart ifPart2 = createElement(sentry2, "ghi", typeof(IfPart));
            ConditionExpression conditionExpression2 = createElement(ifPart2, "jkl", typeof(ConditionExpression));

            conditionExpression2.Text = "${test}";

            // set second exitCriteria
            ExitCriterion criterion2 = createElement(casePlanModel, typeof(ExitCriterion));

            criterion2.Sentry = sentry2;

            // transform casePlanModel
            CmmnActivity newActivity = handler.handleElement(casePlanModel, context);

            context.Parent = newActivity;
            SentryHandler sentryHandler = new SentryHandler();

            // transform first Sentry
            CmmnSentryDeclaration firstSentryDeclaration = sentryHandler.handleElement(sentry1, context);

            // transform second Sentry
            CmmnSentryDeclaration secondSentryDeclaration = sentryHandler.handleElement(sentry2, context);

            // when
            handler.initializeExitCriterias(casePlanModel, newActivity, context);

            // then
            assertTrue(newActivity.EntryCriteria.Count == 0);

            assertFalse(newActivity.ExitCriteria.Count == 0);
            assertEquals(2, newActivity.ExitCriteria.Count);

            assertTrue(newActivity.ExitCriteria.Contains(firstSentryDeclaration));
            assertTrue(newActivity.ExitCriteria.Contains(secondSentryDeclaration));
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testRequiredRuleByDefaultPlanItemControl()
        public virtual void testRequiredRuleByDefaultPlanItemControl()
        {
            // given
            PlanItemControl     defaultControl = createElement(task, "ItemControl_1", typeof(DefaultControl));
            RequiredRule        requiredRule   = createElement(defaultControl, "RequiredRule_1", typeof(RequiredRule));
            ConditionExpression expression     = createElement(requiredRule, "Expression_1", typeof(ConditionExpression));

            expression.Text = "${true}";

            Cmmn.validateModel(modelInstance);

            // when
            CmmnActivity newActivity = handler.handleElement(planItem, context);

            // then
            object rule = newActivity.getProperty(PROPERTY_REQUIRED_RULE);

            assertNotNull(rule);
            assertTrue(rule is CaseControlRule);
        }
Example #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testManualActivationRule()
        public virtual void testManualActivationRule()
        {
            // given
            ItemControl          itemControl          = createElement(planItem, "ItemControl_1", typeof(ItemControl));
            ManualActivationRule manualActivationRule = createElement(itemControl, "ManualActivationRule_1", typeof(ManualActivationRule));
            ConditionExpression  expression           = createElement(manualActivationRule, "Expression_1", typeof(ConditionExpression));

            expression.Text = "${true}";

            Cmmn.validateModel(modelInstance);

            // when
            CmmnActivity newActivity = handler.handleElement(planItem, context);

            // then
            object rule = newActivity.getProperty(PROPERTY_MANUAL_ACTIVATION_RULE);

            assertNotNull(rule);
            assertTrue(rule is CaseControlRule);
        }
Example #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testExitCriteria()
        public virtual void testExitCriteria()
        {
            // given

            // create sentry containing ifPart
            Sentry sentry = createElement(casePlanModel, "Sentry_1", typeof(Sentry));
            IfPart ifPart = createElement(sentry, "abc", typeof(IfPart));
            ConditionExpression conditionExpression = createElement(ifPart, "def", typeof(ConditionExpression));
            Body body = createElement(conditionExpression, null, typeof(Body));

            body.TextContent = "${test}";

            // set exitCriteria
            ExitCriterion criterion = createElement(casePlanModel, typeof(ExitCriterion));

            criterion.Sentry = sentry;

            // transform casePlanModel
            CmmnActivity newActivity = handler.handleElement(casePlanModel, context);

            // transform Sentry
            context.Parent = newActivity;
            SentryHandler         sentryHandler     = new SentryHandler();
            CmmnSentryDeclaration sentryDeclaration = sentryHandler.handleElement(sentry, context);

            // when
            handler.initializeExitCriterias(casePlanModel, newActivity, context);

            // then
            assertTrue(newActivity.EntryCriteria.Count == 0);

            assertFalse(newActivity.ExitCriteria.Count == 0);
            assertEquals(1, newActivity.ExitCriteria.Count);

            assertEquals(sentryDeclaration, newActivity.ExitCriteria[0]);
        }