Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSentryWithOnPartReferencesSentry()
        public virtual void testSentryWithOnPartReferencesSentry()
        {
            // given
            Sentry exitSentry = createElement(casePlanModel, "anotherSentry", typeof(Sentry));
            IfPart ifPart     = createElement(exitSentry, "IfPart_1", typeof(IfPart));
            ConditionExpression conditionExpression = createElement(ifPart, "con_1", typeof(ConditionExpression));
            Body body = createElement(conditionExpression, null, typeof(Body));

            body.TextContent = "${test}";

            onPart.Sentry = exitSentry;

            CmmnActivity casePlanModelActivity = (new CasePlanModelHandler()).handleElement(casePlanModel, context);

            context.Parent = casePlanModelActivity;

            CmmnSentryDeclaration sentryDeclaration     = sentryHandler.handleElement(sentry, context);
            CmmnSentryDeclaration exitSentryDeclaration = sentryHandler.handleElement(exitSentry, context);
            CmmnActivity          source = taskItemHandler.handleElement(planItem, context);

            // when
            sentryHandler.initializeOnParts(sentry, context);

            // then
            assertNotNull(sentryDeclaration);

            IList <CmmnOnPartDeclaration> onParts = sentryDeclaration.OnParts;

            assertNotNull(onParts);
            assertFalse(onParts.Count == 0);
            assertEquals(1, onParts.Count);

            IList <CmmnOnPartDeclaration> onPartsAssociatedWithSource = sentryDeclaration.getOnParts(source.Id);

            assertNotNull(onPartsAssociatedWithSource);
            assertFalse(onPartsAssociatedWithSource.Count == 0);
            assertEquals(1, onParts.Count);

            CmmnOnPartDeclaration onPartDeclaration = onPartsAssociatedWithSource[0];

            assertNotNull(onPartDeclaration);
            // source
            assertEquals(source, onPartDeclaration.Source);
            assertEquals(onPart.Source.Id, onPartDeclaration.Source.Id);
            // standardEvent
            assertEquals(onPart.StandardEvent.name(), onPartDeclaration.StandardEvent);
            // sentry
            assertNotNull(onPartDeclaration.Sentry);
            assertEquals(exitSentryDeclaration, onPartDeclaration.Sentry);

            assertNull(sentryDeclaration.IfPart);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSentryWithOnPart()
        public virtual void testSentryWithOnPart()
        {
            // given
            CmmnActivity casePlanModelActivity = (new CasePlanModelHandler()).handleElement(casePlanModel, context);

            context.Parent = casePlanModelActivity;

            CmmnSentryDeclaration sentryDeclaration = sentryHandler.handleElement(sentry, context);
            CmmnActivity          source            = taskItemHandler.handleElement(planItem, context);

            // when
            sentryHandler.initializeOnParts(sentry, context);

            // then
            assertNotNull(sentryDeclaration);

            IList <CmmnOnPartDeclaration> onParts = sentryDeclaration.OnParts;

            assertNotNull(onParts);
            assertFalse(onParts.Count == 0);
            assertEquals(1, onParts.Count);

            IList <CmmnOnPartDeclaration> onPartsAssociatedWithSource = sentryDeclaration.getOnParts(source.Id);

            assertNotNull(onPartsAssociatedWithSource);
            assertFalse(onPartsAssociatedWithSource.Count == 0);
            assertEquals(1, onParts.Count);

            CmmnOnPartDeclaration onPartDeclaration = onPartsAssociatedWithSource[0];

            assertNotNull(onPartDeclaration);
            // source
            assertEquals(source, onPartDeclaration.Source);
            assertEquals(onPart.Source.Id, onPartDeclaration.Source.Id);
            // standardEvent
            assertEquals(onPart.StandardEvent.name(), onPartDeclaration.StandardEvent);
            // sentry
            assertNull(onPartDeclaration.Sentry);

            assertNull(sentryDeclaration.IfPart);
        }