Ejemplo n.º 1
0
        /// <summary>
        ///           +------------------------------+
        ///           | embedded subprocess          |
        /// +-----+   |  +-----------+   +---------+ |   +---+
        /// |start|-->|  |startInside|-->|endInside| |-->|end|
        /// +-----+   |  +-----------+   +---------+ |   +---+
        ///           +------------------------------+
        /// </summary>
        public virtual void testStartInScope()
        {
            PvmProcessDefinition processDefinition = (new ProcessDefinitionBuilder()).createActivity("start").initial().behavior(new Automatic()).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EmbeddedSubProcess()).createActivity("startInside").behavior(new Automatic()).transition("endInside").endActivity().createActivity("endInside").behavior(new End()).endActivity().transition("end").endActivity().createActivity("end").behavior(new WaitState()).endActivity().buildProcessDefinition();

            PvmProcessInstance processInstance = ((ProcessDefinitionImpl)processDefinition).createProcessInstanceForInitial((ActivityImpl)processDefinition.findActivity("startInside"));

            processInstance.start();

            IList <string> expectedActiveActivityIds = new List <string>();

            expectedActiveActivityIds.Add("end");

            assertEquals(expectedActiveActivityIds, processInstance.findActiveActivityIds());
        }
Ejemplo n.º 2
0
        public virtual void testStartInSubProcess()
        {
            ActivityInstanceVerification verifier = new ActivityInstanceVerification();

            PvmProcessDefinition processDefinition = (new ProcessDefinitionBuilder()).createActivity("start").initial().behavior(new Automatic()).executionListener([email protected]_Fields.EVENTNAME_START, verifier).executionListener([email protected]_Fields.EVENTNAME_END, verifier).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EmbeddedSubProcess()).executionListener([email protected]_Fields.EVENTNAME_START, verifier).executionListener([email protected]_Fields.EVENTNAME_END, verifier).createActivity("startInside").behavior(new Automatic()).executionListener([email protected]_Fields.EVENTNAME_START, verifier).executionListener([email protected]_Fields.EVENTNAME_END, verifier).transition("endInside").endActivity().createActivity("endInside").behavior(new End()).executionListener([email protected]_Fields.EVENTNAME_START, verifier).executionListener([email protected]_Fields.EVENTNAME_END, verifier).endActivity().transition("end").endActivity().executionListener([email protected]_Fields.EVENTNAME_START, verifier).executionListener([email protected]_Fields.EVENTNAME_END, verifier).createActivity("end").behavior(new End()).executionListener([email protected]_Fields.EVENTNAME_START, verifier).executionListener([email protected]_Fields.EVENTNAME_END, verifier).endActivity().buildProcessDefinition();

            PvmProcessInstance processInstance = ((ProcessDefinitionImpl)processDefinition).createProcessInstanceForInitial((ActivityImpl)processDefinition.findActivity("endInside"));

            processInstance.start();

            assertTrue(processInstance.Ended);

            verifier.assertStartInstanceCount(0, "start");
            verifier.assertStartInstanceCount(1, "embeddedsubprocess");
            verifier.assertProcessInstanceParent("embeddedsubprocess", processInstance);
            verifier.assertStartInstanceCount(0, "startInside");
            verifier.assertIsCompletingActivityInstance("endInside", 1);
            verifier.assertStartInstanceCount(1, "end");
        }