示例#1
0
        public async Task CreateAssignAndDeleteGoodWorkflow(XUnitWorkflow xWorkflow)
        {
            WorkflowNew workflow       = xWorkflow.Workflow;
            var         createRequest  = new CreateWorkflowRequest(workflow);
            var         createResponse = await SkyManager.ApiClient.ExecuteRequestAsync(createRequest);

            var workflowId         = createResponse.Content.WorkflowId;
            var assignWorkflowBody = new AssignWorkflowBody().SetDefaults();

            assignWorkflowBody.Name = "Assigned Workflow";
            Assert.NotNull(assignWorkflowBody.ToJson());
            Assert.NotNull(assignWorkflowBody.ToString());

            var assignRequest  = new AssignWorkflowRequest(assignWorkflowBody, workflowId, TestUserId);
            var assignResponse = await SkyManager.ApiClient.ExecuteRequestAsync(assignRequest);

            var assignmentId = assignResponse.Content.Id;

            await SkyManager.ApiClient.ExecuteRequestAsync(new Skylight.Api.Assignments.V1.AssignmentRequests.DeleteAssignmentRequest(assignmentId));

            var getWorkflowRequest  = new GetWorkflowRequest(workflowId);
            var getWorkflowResponse = await SkyManager.ApiClient.ExecuteRequestAsync(getWorkflowRequest);

            var workflowResponse = getWorkflowResponse.Content;

            await SkyManager.ApiClient.ExecuteRequestAsync(new DeleteWorkflowRequest(workflowId));
        }
 /// <summary>Snippet for GetWorkflow</summary>
 public void GetWorkflowRequestObject()
 {
     // Snippet: GetWorkflow(GetWorkflowRequest, CallSettings)
     // Create client
     WorkflowsClient workflowsClient = WorkflowsClient.Create();
     // Initialize request argument(s)
     GetWorkflowRequest request = new GetWorkflowRequest
     {
         WorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
     };
     // Make the request
     Workflow response = workflowsClient.GetWorkflow(request);
     // End snippet
 }
        /// <summary>Snippet for GetWorkflowAsync</summary>
        public async Task GetWorkflowRequestObjectAsync()
        {
            // Snippet: GetWorkflowAsync(GetWorkflowRequest, CallSettings)
            // Additional: GetWorkflowAsync(GetWorkflowRequest, CancellationToken)
            // Create client
            WorkflowsClient workflowsClient = await WorkflowsClient.CreateAsync();

            // Initialize request argument(s)
            GetWorkflowRequest request = new GetWorkflowRequest
            {
                WorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
            };
            // Make the request
            Workflow response = await workflowsClient.GetWorkflowAsync(request);

            // End snippet
        }
示例#4
0
        /// <summary>
        /// Get Workflow Type
        /// </summary>
        /// <param name="request">Request</param>
        /// <returns>GetWorkflowResponse</returns>
        public GetWorkflowResponse GetWorkflows(GetWorkflowRequest request)
        {
            int tot;
            IEnumerable <string> workflowCodes;
            var workflows = _workflow.GetWorkflows(
                string.IsNullOrWhiteSpace(request.WorkflowId) ? Guid.Empty : Guid.Parse(request.WorkflowId),
                request.WorkflowCode, request.Domain, request.IsActive, request.StartedFrom, request.StartedTo,
                request.User, request.Role, request.PageIndex, request.PageSize, out tot, out workflowCodes);

            return(new GetWorkflowResponse
            {
                PageIndex = request.PageIndex,
                PageSize = request.PageSize,
                TotalWorkflows = tot,
                WorkflowCodes = workflowCodes,
                WorkflowInfos = new WorkflowInfos(workflows)
            });
        }
        public async Task shouldSendRequestWithWorkflowKeyAsExpected()
        {
            // given
            var expectedRequest = new GetWorkflowRequest
            {
                WorkflowKey = 1
            };

            // when
            await ZeebeClient.NewWorkflowResourceRequest()
            .WorkflowKey(1)
            .Send();

            // then
            var request = TestService.Requests[0];

            Assert.AreEqual(expectedRequest, request);
        }
        public async Task shouldSendRequestWithVersionAsExpected()
        {
            // given
            var expectedRequest = new GetWorkflowRequest
            {
                BpmnProcessId = "process",
                Version       = 1
            };

            // when
            await ZeebeClient.NewWorkflowResourceRequest()
            .BpmnProcessId("process")
            .Version(1)
            .Send();

            // then
            var request = TestService.Requests[0];

            Assert.AreEqual(expectedRequest, request);
        }
        public async stt::Task GetWorkflowRequestObjectAsync()
        {
            moq::Mock <Workflows.WorkflowsClient> mockGrpcClient = new moq::Mock <Workflows.WorkflowsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetWorkflowRequest request = new GetWorkflowRequest
            {
                WorkflowName = gcwcv::WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
            };
            Workflow expectedResponse = new Workflow
            {
                WorkflowName       = gcwcv::WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
                Description        = "description2cf9da67",
                State              = Workflow.Types.State.Unspecified,
                RevisionId         = "revision_id8d9ae05d",
                CreateTime         = new wkt::Timestamp(),
                UpdateTime         = new wkt::Timestamp(),
                RevisionCreateTime = new wkt::Timestamp(),
                Labels             =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                ServiceAccount = "service_accounta3c1b923",
                SourceContents = "source_contentscf4464d3",
            };

            mockGrpcClient.Setup(x => x.GetWorkflowAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Workflow>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            WorkflowsClient client = new WorkflowsClientImpl(mockGrpcClient.Object, null);
            Workflow        responseCallSettings = await client.GetWorkflowAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Workflow responseCancellationToken = await client.GetWorkflowAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
示例#8
0
 /// <summary>
 /// Get Workflow Type
 /// </summary>
 /// <param name="request">Request</param>
 /// <returns>GetWorkflowTypeResponse</returns>
 public GetWorkflowResponse GetWorkflows(GetWorkflowRequest request)
 {
     return(Channel.GetWorkflows(request));
 }
 public WorkflowResourceRequest(Gateway.GatewayClient client)
 {
     this.client = client;
     request     = new GetWorkflowRequest();
 }
示例#10
0
 public override Task <GetWorkflowResponse> GetWorkflow(GetWorkflowRequest request, ServerCallContext context)
 {
     return(Task.FromResult((GetWorkflowResponse)HandleRequest(request, context)));
 }