Exemplo n.º 1
0
        public virtual void TestNestedSubProcessBothNoEnd()
        {
            var verifier = new ActivityInstanceVerification();

            IPvmProcessDefinition processDefinition =
                new ProcessDefinitionBuilder().CreateActivity("start")
                .Initial()
                .Behavior(new Automatic())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .Transition("embeddedsubprocess")
                .EndActivity()
                .CreateActivity("embeddedsubprocess")
                .Scope()
                .Behavior(new EmbeddedSubProcess())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .CreateActivity("startInside")
                .Behavior(new Automatic())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .Transition("nestedSubProcess")
                .EndActivity()
                .CreateActivity("nestedSubProcess")
                .Scope()
                .Behavior(new EmbeddedSubProcess())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .CreateActivity("startNestedInside")
                .Behavior(new Automatic())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .EndActivity()
                .EndActivity()
                .EndActivity()
                .BuildProcessDefinition();

            IPvmProcessInstance processInstance = processDefinition.CreateProcessInstance();

            processInstance.Start();

            Assert.True(processInstance.IsEnded);

            verifier.AssertStartInstanceCount(1, "start");
            verifier.AssertProcessInstanceParent("start", processInstance);
            verifier.AssertStartInstanceCount(1, "embeddedsubprocess");
            verifier.AssertProcessInstanceParent("embeddedsubprocess", processInstance);
            verifier.AssertStartInstanceCount(1, "startInside");
            verifier.AssertParent("startInside", "embeddedsubprocess");
            verifier.AssertStartInstanceCount(1, "nestedSubProcess");
            verifier.AssertParent("nestedSubProcess", "embeddedsubprocess");
            verifier.AssertStartInstanceCount(1, "startNestedInside");
            verifier.AssertParent("startNestedInside", "nestedSubProcess");
        }
Exemplo n.º 2
0
        public virtual void TestMultipleConcurrentEndsInsideEmbeddedSubProcessWithWaitState()
        {
            var verifier = new ActivityInstanceVerification();

            IPvmProcessDefinition processDefinition =
                new ProcessDefinitionBuilder().CreateActivity("start")
                .Initial()
                .Behavior(new Automatic())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .Transition("embeddedsubprocess")
                .EndActivity()
                .CreateActivity("embeddedsubprocess")
                .Scope()
                .Behavior(new EmbeddedSubProcess())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .CreateActivity("startInside")
                .Behavior(new Automatic())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .Transition("fork")
                .EndActivity()
                .CreateActivity("fork")
                .Behavior(new ParallelGateway())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .Transition("endInside1")
                .Transition("Wait")
                .Transition("endInside3")
                .EndActivity()
                .CreateActivity("endInside1")
                .Behavior(new End())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .EndActivity()
                .CreateActivity("Wait")
                .Behavior(new WaitState())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .Transition("endInside2")
                .EndActivity()
                .CreateActivity("endInside2")
                .Behavior(new End())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .EndActivity()
                .CreateActivity("endInside3")
                .Behavior(new End())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .EndActivity()
                .Transition("end")
                .EndActivity()
                .CreateActivity("end")
                .Behavior(new End())
                .ExecutionListener(ExecutionListenerFields.EventNameStart, verifier)
                .ExecutionListener(ExecutionListenerFields.EventNameEnd, verifier)
                .EndActivity()
                .BuildProcessDefinition();

            IPvmProcessInstance processInstance = processDefinition.CreateProcessInstance();

            processInstance.Start();

            Assert.IsFalse(processInstance.IsEnded);
            IPvmExecution execution = processInstance.FindExecution("Wait");

            execution.Signal(null, null);

            Assert.True(processInstance.IsEnded);

            verifier.AssertStartInstanceCount(1, "start");
            verifier.AssertProcessInstanceParent("start", processInstance);

            verifier.AssertStartInstanceCount(1, "embeddedsubprocess");
            verifier.AssertProcessInstanceParent("embeddedsubprocess", processInstance);

            verifier.AssertStartInstanceCount(1, "startInside");
            verifier.AssertParent("startInside", "embeddedsubprocess");

            verifier.AssertStartInstanceCount(1, "fork");
            verifier.AssertParent("fork", "embeddedsubprocess");

            verifier.AssertStartInstanceCount(1, "Wait");
            verifier.AssertParent("Wait", "embeddedsubprocess");

            verifier.AssertStartInstanceCount(1, "endInside1");
            verifier.AssertParent("endInside1", "embeddedsubprocess");

            verifier.AssertStartInstanceCount(1, "endInside2");
            verifier.AssertParent("endInside2", "embeddedsubprocess");

            verifier.AssertStartInstanceCount(1, "endInside3");
            verifier.AssertParent("endInside3", "embeddedsubprocess");

            verifier.AssertStartInstanceCount(1, "end");
            verifier.AssertProcessInstanceParent("end", processInstance);
        }