protected override async Task <IEnumerable <GetJobsResponse> > OnHandleAsync(GetJobsRequest request, CancellationToken cancellationToken)
        {
            IQueryable <Job> jobs = _workshopDbContext.Jobs;

            return(await jobs.ProjectTo <GetJobsResponse>(_mapper.ConfigurationProvider)
                   .ToArrayAsync(cancellationToken));
        }
Exemple #2
0
        public void GetJobsMultiParamsTest()
        {
            var getJobsRequest = new GetJobsRequest(jobTypes: new List <JobTypeEnum> {
                JobTypeEnum.ARCHIVE, JobTypeEnum.RESTORE
            });

            var mockNetwork = new Mock <INetwork>(MockBehavior.Strict);

            mockNetwork
            .Setup(n => n.Invoke(getJobsRequest))
            .Returns(new MockHttpWebResponse(
                         "SpectraLogic.SpectraRioBrokerClient.Test.TestFiles.GetJobsResponse",
                         HttpStatusCode.OK, null));

            var mockBuilder = new Mock <ISpectraRioBrokerClientBuilder>(MockBehavior.Strict);

            mockBuilder
            .Setup(b => b.Build())
            .Returns(new SpectraRioBrokerClient(mockNetwork.Object));

            var builder = mockBuilder.Object;
            var client  = builder.Build();

            var jobs = client.GetJobs(getJobsRequest);

            Assert.AreEqual(2, jobs.JobsList.Count);
            Assert.AreEqual(0, jobs.Page.Number);
            Assert.AreEqual(100, jobs.Page.PageSize);
            Assert.AreEqual(1, jobs.Page.TotalPages);

            mockBuilder.VerifyAll();
            mockNetwork.VerifyAll();
        }
Exemple #3
0
        public GetJobsResponse GetJobs()
        {
            _CurrentOperationName = "getJobs";
            GetJobsRequest req = new GetJobsRequest();

            return(base.getJobs(req));
        }
Exemple #4
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonGlueConfig config = new AmazonGlueConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonGlueClient client = new AmazonGlueClient(creds, config);

            GetJobsResponse resp = new GetJobsResponse();

            do
            {
                GetJobsRequest req = new GetJobsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.GetJobs(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.Jobs)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Exemple #5
0
        public async Task GetJobsAsync_Default()
        {
            var request = new GetJobsRequest {
                PrinterUri = Options.Value.PrinterUrl, WhichJobs = WhichJobs.Completed
            };

            await TestRequestAsync(request, (client, r) => client.GetJobsAsync(r));
        }
Exemple #6
0
        public void GetJobsAsync_Default()
        {
            var request = new GetJobsRequest {
                PrinterUri = PrinterUrl, WhichJobs = WhichJobs.Completed
            };
            var result = _protocol.Construct(request);

            CheckResult(result);
        }
Exemple #7
0
        public void GetJobsAsync_Full()
        {
            var request = new GetJobsRequest
            {
                PrinterUri          = PrinterUrl,
                WhichJobs           = WhichJobs.Completed,
                RequestedAttributes = new[]
                {
                    JobAttribute.Compression,
                    JobAttribute.Copies,
                    JobAttribute.DateTimeAtCompleted,
                    JobAttribute.DateTimeAtCreation,
                    JobAttribute.DateTimeAtProcessing,
                    JobAttribute.DocumentFormat,
                    JobAttribute.DocumentName,
                    JobAttribute.Finishings,
                    JobAttribute.IppAttributeFidelity,
                    JobAttribute.JobId,
                    JobAttribute.JobImpressions,
                    JobAttribute.JobImpressionsCompleted,
                    JobAttribute.JobKOctetsProcessed,
                    JobAttribute.JobMediaSheets,
                    JobAttribute.JobMediaSheetsCompleted,
                    JobAttribute.JobName,
                    JobAttribute.JobOriginatingUserName,
                    JobAttribute.JobOriginatingUserName,
                    JobAttribute.JobPrinterUpTime,
                    JobAttribute.JobPrinterUri,
                    JobAttribute.JobSheets,
                    JobAttribute.JobState,
                    JobAttribute.JobStateMessage,
                    JobAttribute.JobStateReasons,
                    JobAttribute.Media,
                    JobAttribute.MultipleDocumentHandling,
                    JobAttribute.NumberUp,
                    JobAttribute.OrientationRequested,
                    JobAttribute.PrinterResolution,
                    JobAttribute.PrintQuality,
                    JobAttribute.Sides,
                    JobAttribute.TimeAtCompleted,
                    JobAttribute.TimeAtCreation,
                    JobAttribute.TimeAtProcessing
                }
            };

            var result = _protocol.Construct(request);

            CheckResult(result);
        }
Exemple #8
0
 public GetJobsResponse GetJobs(GetJobsRequest request)
 {
     return(new GetJobsResponse
     {
         Jobs = jobManager.JobStore.GetJobs(
             request.Skip,
             request.Take,
             request.JobIds != null ? request.JobIds.ToArray() : null,
             request.JobStatuses != null ? request.JobStatuses.Select(s => (Logic.DataModel.Jobs.JobStatus)(int) s).ToArray() : null,
             request.QueueIds != null ? request.QueueIds.ToArray() : null,
             request.TypeNames != null ? request.TypeNames.ToArray() : null,
             request.Applications != null ? request.Applications.ToArray() : null,
             request.Groups != null ? request.Groups.ToArray() : null).Select(j => new JobData(j)).ToList(),
     });
 }
Exemple #9
0
        public async Task GetJobsAsync_Full()
        {
            var request = new GetJobsRequest
            {
                PrinterUri          = Options.Value.PrinterUrl,
                WhichJobs           = WhichJobs.Completed,
                RequestedAttributes = new[]
                {
                    JobAttribute.Compression,
                    JobAttribute.Copies,
                    JobAttribute.DateTimeAtCompleted,
                    JobAttribute.DateTimeAtCreation,
                    JobAttribute.DateTimeAtProcessing,
                    JobAttribute.DocumentFormat,
                    JobAttribute.DocumentName,
                    JobAttribute.Finishings,
                    JobAttribute.IppAttributeFidelity,
                    JobAttribute.JobId,
                    JobAttribute.JobImpressions,
                    JobAttribute.JobImpressionsCompleted,
                    JobAttribute.JobKOctetsProcessed,
                    JobAttribute.JobMediaSheets,
                    JobAttribute.JobMediaSheetsCompleted,
                    JobAttribute.JobName,
                    JobAttribute.JobOriginatingUserName,
                    JobAttribute.JobOriginatingUserName,
                    JobAttribute.JobPrinterUpTime,
                    JobAttribute.JobPrinterUri,
                    JobAttribute.JobSheets,
                    JobAttribute.JobState,
                    JobAttribute.JobStateMessage,
                    JobAttribute.JobStateReasons,
                    JobAttribute.Media,
                    JobAttribute.MultipleDocumentHandling,
                    JobAttribute.NumberUp,
                    JobAttribute.OrientationRequested,
                    JobAttribute.PrinterResolution,
                    JobAttribute.PrintQuality,
                    JobAttribute.Sides,
                    JobAttribute.TimeAtCompleted,
                    JobAttribute.TimeAtCreation,
                    JobAttribute.TimeAtProcessing
                }
            };

            await TestRequestAsync(request, (client, r) => client.GetJobsAsync(r));
        }
        public async Task GivenOneExecution_WhenHandling_ShouldReturn()
        {
            // Given
            var request = new GetJobsRequest("subject", 10, 0);

            Mock.Get(_repository)
            .Setup(x => x.GetManyAsync(It.IsAny <Func <IQueryable <Job>, IQueryable <Job> > >(), CancellationToken.None))
            .ReturnsAsync(new List <Job>
            {
                Job.New("subject", "payload", true, DateTime.UtcNow, DateTime.UtcNow, null)
            }.AsReadOnly());

            // When
            var result = await _handler.Handle(request, CancellationToken.None);

            // Then
            result.Jobs.ShouldHaveSingleItem();
        }
Exemple #11
0
 /// <summary>
 ///  查询获取编译任务列表,并显示最后一次编译的一些信息
 /// /v2/regions/cn-south-1/jobs/?sorts.1.name&#x3D;status&amp;sorts.1.direction&#x3D;asc&amp;pageNumber&#x3D;1&amp;pageSize&#x3D;10&amp;filters.1.name&#x3D;name&amp;filters.1.values.1&#x3D;我的job
 ///
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public async Task <GetJobsResponse> GetJobs(GetJobsRequest request)
 {
     return(await new GetJobsExecutor().Client(this).Execute <GetJobsResponse, GetJobsResult, GetJobsRequest>(request).ConfigureAwait(false));
 }
Exemple #12
0
 /// <summary>
 ///  查询获取编译任务列表,并显示最后一次编译的一些信息
 /// /v2/regions/cn-south-1/jobs/?sorts.1.name&#x3D;status&amp;sorts.1.direction&#x3D;asc&amp;pageNumber&#x3D;1&amp;pageSize&#x3D;10&amp;filters.1.name&#x3D;name&amp;filters.1.values.1&#x3D;我的job
 ///
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public GetJobsResponse GetJobs(GetJobsRequest request)
 {
     return(new GetJobsExecutor().Client(this).Execute <GetJobsResponse, GetJobsResult, GetJobsRequest>(request));
 }
Exemple #13
0
        public async Task <List <GetJobReponse> > GetJobs(GetJobsRequest request)
        {
            var jobFilter = Builders <Job> .Filter.Empty;

            if (request.IsActive)
            {
                var currentTime = DateTime.Now;
                jobFilter = jobFilter & Builders <Job> .Filter.Where(x => x.Status == JobStatus.Published && x.StartDay <= currentTime && x.ExpirationDate > currentTime);
            }
            if (!string.IsNullOrEmpty(request.SearchText))
            {
                jobFilter = jobFilter & Builders <Job> .Filter.Where(x => x.Name.ToLower().Contains(request.SearchText.ToLower()));
            }
            if (request.JobType != null)
            {
                jobFilter = jobFilter & Builders <Job> .Filter.Where(x => x.JobType == request.JobType);
            }
            if (request.LocationId != null)
            {
                jobFilter = jobFilter & Builders <Job> .Filter.Where(x => x.LocationId == request.LocationId);
            }
            if (request.CategoryId != null)
            {
                jobFilter = jobFilter & Builders <Job> .Filter.Where(x => x.CategoryId == request.CategoryId);
            }

            var listJob = (await _mongoDbRepository.Find(jobFilter))
                          .OrderByDescending(s => s.StartDay)
                          .Skip((request.PageIndex - 1) * request.PageSize)
                          .Take(request.PageSize);

            var locationIds    = listJob.Select(s => s.LocationId);
            var locationFilter = Builders <City> .Filter.Where(x => locationIds.Contains(x.Id));

            var locations = await _mongoDbRepository.Find(locationFilter);

            var companyIds    = listJob.Select(s => s.CompanyId);
            var companyFilter = Builders <Company> .Filter.Where(x => companyIds.Contains(x.Id));

            var companies = await _mongoDbRepository.Find(companyFilter);

            var categoryIds    = listJob.Select(s => s.CategoryId);
            var categoryFilter = Builders <Category> .Filter.Where(x => categoryIds.Contains(x.Id));

            var categories = await _mongoDbRepository.Find(categoryFilter);

            return(listJob.Select(s =>
                                  new GetJobReponse
            {
                Id = s.Id,
                CategoryId = s.CategoryId,
                CategoryName = categories.FirstOrDefault(f => f.Id == s.CategoryId)?.Name,
                CompanyId = s.CompanyId,
                CompanyName = companies.FirstOrDefault(f => f.Id == s.CompanyId)?.Name,
                Description = s.Description,
                ExpirationDate = s.ExpirationDate,
                JobType = s.JobType,
                LocationId = s.LocationId,
                Location = locations.FirstOrDefault(f => f.Id == s.LocationId)?.Name,
                Name = s.Name,
                Salary = s.Salary,
                Status = s.Status,
                Summary = s.Summary,
                Vacancies = s.Vacancies
            }).ToList());
        }
Exemple #14
0
        public async Task <IActionResult> GetAllJob(GetJobsRequest request)
        {
            var result = await _jobBusinessLogic.GetJobs(request);

            return(Ok(result));
        }
Exemple #15
0
        static GetJobsResponse GetJob(HttpRequestMessageProperty httpRequest)
        {
            try
            {

                BulkDataExchangeServicePortClient client = new BulkDataExchangeServicePortClient(BDXconfigName);
                using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                {

                    OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest);

                    //Create the request
                    GetJobsRequest req = new GetJobsRequest();

                    //Supply additional parameters
                    //The UUID must be unique.  Once used, you can't use it again
                    req.jobType = new string[] { "ReviseInventoryStatus" };

                    //Get the response
                    GetJobsResponse resp = client.getJobs(req);

                    if (resp.ack == BDX.AckValue.Success)
                    {

                    }
                    else
                    {
                        throw new Exception(resp.errorMessage[0].message);
                    }

                    return resp;

                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                GetJobsResponse errResp = null;
                return errResp;
            }
        }
Exemple #16
0
 /// <inheritdoc/>
 public IJobs GetJobs(GetJobsRequest request)
 {
     return(ExceptionDecorator.Run(() => new GetJobsResponseParser().Parse(_network.Invoke(request))));
 }
Exemple #17
0
 public Task <IActionResult> GetJobs([FromQuery] GetJobsRequest request)
 {
     return(HandleRequestAsync(request));
 }
Exemple #18
0
 /// <summary>
 ///     Get-Jobs Operation
 ///     https://tools.ietf.org/html/rfc2911#section-3.2.6
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public async Task <GetJobsResponse> GetJobsAsync(GetJobsRequest request)
 {
     return(await SendAsync(request.PrinterUri, () => _ippProtocol.Construct(request),
                            ippResponse => _ippProtocol.ConstructGetJobsResponse(ippResponse)));
 }
 /// <summary>
 ///     Get-Job-Attributes Request
 ///     https://tools.ietf.org/html/rfc2911#section-3.3.4.1
 /// </summary>
 /// <param name="request"></param>
 public IppRequestMessage Construct(GetJobsRequest request) => ConstructIppRequest(request);