public async void LatestProcessDefinitions_最终流程定义列表()
        {
            Exception ex = await Record.ExceptionAsync(async() =>
            {
                IProcessDefinitionController client = ctx.CreateWorkflowHttpProxy().GetProcessDefinitionClient();

                ProcessDefinitionQuery query = new ProcessDefinitionQuery();
                query.TenantId = ctx.TenantId;
                query.Pageable = new Pageable
                {
                    PageNo   = 1,
                    PageSize = int.MaxValue,
                    Sort     = new Sort(new Sort.Order[]
                    {
                        new Sort.Order
                        {
                            Property  = "name",
                            Direction = Sort.Direction.ASC
                        }
                    })
                };

                Resources <ProcessDefinition> list = await client.LatestProcessDefinitions(query).ConfigureAwait(false);

                Assert.True(list.TotalCount == list.List.Count());
                Assert.True(list.TotalCount == list.RecordCount);
            }).ConfigureAwait(false);

            Assert.Null(ex);
        }
        public async void GetBpmnModel_返回流程定义对象模型(string bpmnFile)
        {
            var ex = await Record.ExceptionAsync(async() =>
            {
                string bpmnName = string.Join("", ctx.Guid2IntString(Guid.NewGuid()));
                Deployment dep  = await ctx.DeployAsync(bpmnFile, bpmnName).ConfigureAwait(false);

                IProcessDefinitionController client = ctx.CreateWorkflowHttpProxy().GetProcessDefinitionClient();

                Resources <ProcessDefinition> defs = await client.LatestProcessDefinitions(new ProcessDefinitionQuery
                {
                    DeploymentId = dep.Id
                }).ConfigureAwait(false);

                ActionResult <BpmnModel> model = await client.GetBpmnModel(defs.List.First().Id).ConfigureAwait(false);

                Assert.NotNull(model.Result);
                Assert.IsType <ObjectResult>(model.Result);
                Assert.IsType <BpmnModel>(((ObjectResult)model.Result).Value);

                await ctx.CreateWorkflowHttpProxy().GetDefinitionDeployerClient().Remove(dep.Id).ConfigureAwait(false);
            });

            Assert.NotNull(ex);
        }
        public async void GetProcessModel_根据名称_租户id_查询流程定义BPMN_XML结构字符串(string bpmnFile)
        {
            var ex = await Record.ExceptionAsync(async() =>
            {
                string bpmnName = string.Join("", ctx.Guid2IntString(Guid.NewGuid()));
                Deployment dep  = await ctx.DeployAsync(bpmnFile, bpmnName).ConfigureAwait(false);

                IProcessDefinitionController client = ctx.CreateWorkflowHttpProxy().GetProcessDefinitionClient();

                Resources <ProcessDefinition> defs = await client.LatestProcessDefinitions(new ProcessDefinitionQuery
                {
                    DeploymentId = dep.Id
                }).ConfigureAwait(false);

                var p = defs.List.First();

                string xml = await client.GetProcessModel(new ProcessDefinitionQuery
                {
                    Name     = p.Name,
                    TenantId = p.TenantId
                }).ConfigureAwait(false);

                Assert.False(string.IsNullOrWhiteSpace(xml));
            }).ConfigureAwait(false);

            Assert.Null(ex);
        }
Ejemplo n.º 4
0
 public WorkflowClientController(WorkflowHttpClientProxyProvider workflowHttpClientProxy, IAccessTokenProvider accessToken, IHttpContextAccessor httpContextAccessor)
 {
     httpContext               = httpContextAccessor.HttpContext;
     this.accessToken          = accessToken;
     processInstanceClient     = workflowHttpClientProxy.GetProcessInstanceClient();
     taskClient                = workflowHttpClientProxy.GetTaskClient();
     taskAdminClient           = workflowHttpClientProxy.GetTaskAdminClient();
     deployerClient            = workflowHttpClientProxy.GetDefinitionDeployerClient();
     processDefinitionClient   = workflowHttpClientProxy.GetProcessDefinitionClient();
     processInstanceTaskClient = workflowHttpClientProxy.GetProcessInstanceTasksClient();
 }
        public async void ProcessDefinitions_分页获取所有部署流程()
        {
            var ex = await Record.ExceptionAsync(async() =>
            {
                IProcessDefinitionController client = ctx.CreateWorkflowHttpProxy().GetProcessDefinitionClient();

                int offset = 1;
                Resources <ProcessDefinition> list = null;
                while (true)
                {
                    ProcessDefinitionQuery query = new ProcessDefinitionQuery();
                    query.TenantId = ctx.TenantId;
                    query.Pageable = new Pageable
                    {
                        PageNo   = offset,
                        PageSize = 10,
                        Sort     = new Sort(new Sort.Order[]
                        {
                            new Sort.Order
                            {
                                Property  = "name",
                                Direction = Sort.Direction.ASC
                            }
                        })
                    };

                    list = await client.LatestProcessDefinitions(query).ConfigureAwait(false);
                    if (list.List.Count() < 10)
                    {
                        break;
                    }

                    offset = offset + 1;
                }

                Assert.True(offset == 1 && list.TotalCount <= 0 ? true : list.TotalCount / 10 + 1 == offset);
            }).ConfigureAwait(false);

            Assert.Null(ex);
        }
Ejemplo n.º 6
0
        private async Task <ProcessDefinition> DeploySampleBpmn(string bpmnFile)
        {
            string root = AppDomain.CurrentDomain.BaseDirectory;
            string file = Path.Combine(new string[] { root, "resources", "samples", bpmnFile });

            IProcessDefinitionController client = CreateWorkflowHttpProxy().GetProcessDefinitionClient();

            //foreach (var file in files)
            //{
            Deployment dep = Deploy(file, Path.GetFileNameWithoutExtension(file));

            var defines = await client.LatestProcessDefinitions(new ProcessDefinitionQuery
            {
                DeploymentId = dep.Id,
                TenantId     = TenantId
            }).ConfigureAwait(false);

            return(defines.List.First());

            //procDefines.Add(Path.GetFileName(file), defines.List.First());
            //}
        }
        public async void GetProcessDefinition_查找流程定义(string bpmnFile)
        {
            var ex = await Record.ExceptionAsync(async() =>
            {
                string bpmnName = string.Join("", ctx.Guid2IntString(Guid.NewGuid()));
                Deployment dep  = await ctx.DeployAsync(bpmnFile, bpmnName).ConfigureAwait(false);

                IProcessDefinitionController client = ctx.CreateWorkflowHttpProxy().GetProcessDefinitionClient();

                Resources <ProcessDefinition> defs = await client.LatestProcessDefinitions(new ProcessDefinitionQuery
                {
                    DeploymentId = dep.Id
                }).ConfigureAwait(false);

                ProcessDefinition def = await client.GetProcessDefinition(defs.List.First().Id).ConfigureAwait(false);

                Assert.NotNull(def);
                Assert.True(def.Id == defs.List.First().Id);

                await ctx.CreateWorkflowHttpProxy().GetDefinitionDeployerClient().Remove(dep.Id);
            }).ConfigureAwait(false);

            Assert.Null(ex);
        }