public void DeployTest() { FileInfo parFile = new FileInfo("ExamplePar/helloworld1.par"); FileStream fstream = parFile.OpenRead(); byte[] b = new byte[parFile.Length]; fstream.Read(b, 0, (int)parFile.Length); MyProcessDefinitionService service = new MyProcessDefinitionService(); service.DeployProcessArchive(b); }
public ProcessExecutionService() { myProcessDefinitionService = new MyProcessDefinitionService(); delegateService = new DelegationService(); organisationService = (IOrganisationService)ServiceLocator.Instance.GetService(typeof(IOrganisationService)); taskRepository = TaskRepository.Instance; transitionRepository = TransitionRepository.Instance; processInstanceRepository = ProcessInstanceRepository.Instance; flowRepository = FlowRepository.Instance; }
public void DeployTest() { FileInfo parFile = new FileInfo("ExamplePar/holiday.par"); FileStream fstream = parFile.OpenRead(); byte[] b = new byte[parFile.Length]; fstream.Read(b, 0, (int)parFile.Length); MyProcessDefinitionService service = new MyProcessDefinitionService(); service.DeployProcessArchive(b); /* select * from [dbo].[NBPM_PROCESSBLOCK]; --2 select * from [dbo].[NBPM_NODE]; --9 select * from [dbo].[NBPM_TRANSITION]; --10 select * from [dbo].[NBPM_ACTION] --0 select * from [dbo].[NBPM_ATTRIBUTE]; --7 select * from [dbo].[NBPM_DELEGATION]; --11 select * from [dbo].[NBPM_FIELD]; --0 */ }
public void StartProcessTest() { IProcessInstance processInstance = null; Thread.CurrentPrincipal = new PrincipalUserAdapter("af"); MyProcessDefinitionService myProcessDefinitionService = new MyProcessDefinitionService(); ProcessExecutionService processExecutionService = new ProcessExecutionService(); try { IDictionary attributeValues = new Hashtable(); attributeValues.Add("start date", new DateTime(2016, 3, 1)); attributeValues.Add("end date", new DateTime(2016, 3, 2)); processInstance = processExecutionService.StartProcessInstance(1L, attributeValues); Assert.IsNotNull(processInstance); Assert.IsNotNull(processInstance.RootFlow); /* select *from [dbo].[NBPM_PROCESSINSTANCE] --1 select *from [dbo].[NBPM_FLOW] --1 select *from [dbo].[NBPM_LOG] --3 select *from [dbo].[NBPM_LOGDETAIL] --6 select * from [dbo].[NBPM_ATTRIBUTEINSTANCE] --7 */ } catch (ExecutionException e) { Assert.Fail("ExcecutionException while starting a new holiday request: " + e.Message); } finally { // loginUtil.logout(); } }
public void StartProcessTest() { IProcessInstance processInstance = null; Thread.CurrentPrincipal = new PrincipalUserAdapter("ae"); MyProcessDefinitionService myProcessDefinitionService = new MyProcessDefinitionService(); ProcessExecutionService processExecutionService = new ProcessExecutionService(); try { IDictionary attributeValues = new Hashtable(); processInstance = processExecutionService.StartProcessInstance(1L, attributeValues); //這時已經在First State Assert.IsNotNull(processInstance); //會產生基本的Root Flow Assert.IsNotNull(processInstance.RootFlow); //root flow進入了ActivityState,Id=3 Assert.AreEqual(3, processInstance.RootFlow.Node.Id); //root flow的actor是ae Assert.AreEqual("ae", processInstance.RootFlow.GetActor().Id); /* select *from [dbo].[NBPM_PROCESSINSTANCE] select *from [dbo].[NBPM_FLOW] select *from [dbo].[NBPM_LOG] select *from [dbo].[NBPM_LOGDETAIL] */ } catch (ExecutionException e) { Assert.Fail("ExcecutionException while starting a new holiday request: " + e.Message); } finally { // loginUtil.logout(); } }