Example #1
0
        public void CheckActiveJobsRequestObject()
        {
            moq::Mock <JobsV1Beta3.JobsV1Beta3Client> mockGrpcClient = new moq::Mock <JobsV1Beta3.JobsV1Beta3Client>(moq::MockBehavior.Strict);
            CheckActiveJobsRequest request = new CheckActiveJobsRequest
            {
                ProjectId = "project_id43ad98b0",
            };
            CheckActiveJobsResponse expectedResponse = new CheckActiveJobsResponse
            {
                ActiveJobsExist = false,
            };

            mockGrpcClient.Setup(x => x.CheckActiveJobs(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            JobsV1Beta3Client       client   = new JobsV1Beta3ClientImpl(mockGrpcClient.Object, null);
            CheckActiveJobsResponse response = client.CheckActiveJobs(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #2
0
        public async stt::Task SnapshotJobRequestObjectAsync()
        {
            moq::Mock <JobsV1Beta3.JobsV1Beta3Client> mockGrpcClient = new moq::Mock <JobsV1Beta3.JobsV1Beta3Client>(moq::MockBehavior.Strict);
            SnapshotJobRequest request = new SnapshotJobRequest
            {
                ProjectId       = "project_id43ad98b0",
                JobId           = "job_id38ea97d6",
                Ttl             = new wkt::Duration(),
                Location        = "locatione09d18d5",
                SnapshotSources = false,
                Description     = "description2cf9da67",
            };
            Snapshot expectedResponse = new Snapshot
            {
                Id             = "id74b70bb8",
                ProjectId      = "project_id43ad98b0",
                SourceJobId    = "source_job_id1406915d",
                CreationTime   = new wkt::Timestamp(),
                Ttl            = new wkt::Duration(),
                State          = SnapshotState.UnknownSnapshotState,
                PubsubMetadata =
                {
                    new PubsubSnapshotMetadata(),
                },
                Description   = "description2cf9da67",
                DiskSizeBytes = -5516951742914183668L,
                Region        = "regionedb20d96",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Example #3
0
        public async stt::Task CheckActiveJobsRequestObjectAsync()
        {
            moq::Mock <JobsV1Beta3.JobsV1Beta3Client> mockGrpcClient = new moq::Mock <JobsV1Beta3.JobsV1Beta3Client>(moq::MockBehavior.Strict);
            CheckActiveJobsRequest request = new CheckActiveJobsRequest
            {
                ProjectId = "project_id43ad98b0",
            };
            CheckActiveJobsResponse expectedResponse = new CheckActiveJobsResponse
            {
                ActiveJobsExist = false,
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Example #4
0
        public async stt::Task CreateJobRequestObjectAsync()
        {
            moq::Mock <JobsV1Beta3.JobsV1Beta3Client> mockGrpcClient = new moq::Mock <JobsV1Beta3.JobsV1Beta3Client>(moq::MockBehavior.Strict);
            CreateJobRequest request = new CreateJobRequest
            {
                ProjectId    = "project_id43ad98b0",
                Job          = new Job(),
                View         = JobView.Summary,
                ReplaceJobId = "replace_job_id4a0fad7e",
                Location     = "locatione09d18d5",
            };
            Job expectedResponse = new Job
            {
                Id                   = "id74b70bb8",
                ProjectId            = "project_id43ad98b0",
                Name                 = "name1c9368b0",
                Type                 = JobType.Unknown,
                Environment          = new Environment(),
                Steps                = { new Step(), },
                CurrentState         = JobState.Unknown,
                CurrentStateTime     = new wkt::Timestamp(),
                RequestedState       = JobState.Stopped,
                ExecutionInfo        = new JobExecutionInfo(),
                CreateTime           = new wkt::Timestamp(),
                ReplaceJobId         = "replace_job_id4a0fad7e",
                TransformNameMapping =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                ClientRequestId = "client_request_ide162ec50",
                ReplacedByJobId = "replaced_by_job_ida56afc22",
                TempFiles       =
                {
                    "temp_filescb023328",
                },
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                Location            = "locatione09d18d5",
                PipelineDescription = new PipelineDescription(),
                StageStates         =
                {
                    new ExecutionStageState(),
                },
                JobMetadata           = new JobMetadata(),
                StartTime             = new wkt::Timestamp(),
                CreatedFromSnapshotId = "created_from_snapshot_id9b426c65",
                StepsLocation         = "steps_location41e078c5",
                SatisfiesPzs          = false,
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }