Ejemplo n.º 1
0
        public void BuildProcessDefinitionTest()
        {
            ProcessDefinitionBuildService service = new ProcessDefinitionBuildService(helloWorld1());
            ProcessDefinitionImpl processDefinition = service.BuildProcessDefinition();

            Assert.AreEqual("Hello world 1", processDefinition.Name);
            Assert.AreEqual("This is the simples process.", processDefinition.Description);
            Assert.AreEqual(3, processDefinition.Nodes.Count);

            Assert.IsNotNull(processDefinition.StartState);
            Assert.AreEqual("start", processDefinition.StartState.Name);
            Assert.AreEqual(1, processDefinition.StartState.LeavingTransitions.Count);

            foreach (var node in processDefinition.Nodes)
            {
                INode no = node as INode;
                if (no != null && no.Name == "first activity state")
                {
                    Assert.AreEqual("this is the first state", no.Description);
                    Assert.AreEqual(1, no.LeavingTransitions.Count);

                    ActivityStateImpl activityState = no as ActivityStateImpl;
                    if (activityState != null)
                    {
                        Assert.IsNotNull(activityState.AssignmentDelegation);
                        Assert.AreEqual("NetBpm.Workflow.Delegation.Impl.Assignment.AssignmentExpressionResolver, NetBpm", activityState.AssignmentDelegation.ClassName);
                        Assert.AreEqual("<cfg><parameter name=\"expression\">processInitiator</parameter></cfg>", activityState.AssignmentDelegation.Configuration);
                    }
                }
            }
        }
        public void DeployProcessArchive(byte[] processArchiveBytes)
        {
            ParFile parFile = new ParFile(processArchiveBytes);

            ProcessDefinitionBuildService buildService = new ProcessDefinitionBuildService(parFile.ProcessDefinition);
            ProcessDefinitionImpl processDefinition = buildService.BuildProcessDefinition();

            using (ISession session = NHibernateHelper.OpenSession())
            {
                DbSession nhSession = new DbSession(session);
                repository.Save(processDefinition, nhSession);
            }
        }