コード例 #1
0
        public void QueueVacancySummaries(VacancySummaryPage vacancySummaryPage)
        {
            _logger.Info("Retrieving vacancy search page number: {0}/{1}", vacancySummaryPage.PageNumber, vacancySummaryPage.TotalPages);

            var vacancies = _vacancyIndexDataProvider.GetVacancySummaries(vacancySummaryPage.PageNumber);
            var apprenticeshipsExtended = _mapper.Map <IEnumerable <ApprenticeshipSummary>, IEnumerable <ApprenticeshipSummaryUpdate> >(vacancies.ApprenticeshipSummaries).ToList();
            var traineeshipsExtended    = _mapper.Map <IEnumerable <TraineeshipSummary>, IEnumerable <TraineeshipSummaryUpdate> >(vacancies.TraineeshipSummaries).ToList();

            _logger.Info("Retrieved vacancy search page number: {0}/{1} with {2} apprenticeships and {3} traineeships", vacancySummaryPage.PageNumber, vacancySummaryPage.TotalPages, apprenticeshipsExtended.Count(), traineeshipsExtended.Count());

            Parallel.ForEach(
                apprenticeshipsExtended,
                new ParallelOptions {
                MaxDegreeOfParallelism = 5
            },
                apprenticeshipExtended =>
            {
                apprenticeshipExtended.ScheduledRefreshDateTime = vacancySummaryPage.ScheduledRefreshDateTime;
                _messageBus.PublishMessage(apprenticeshipExtended);
            });

            Parallel.ForEach(
                traineeshipsExtended,
                new ParallelOptions {
                MaxDegreeOfParallelism = 5
            },
                traineeshipExtended =>
            {
                traineeshipExtended.ScheduledRefreshDateTime = vacancySummaryPage.ScheduledRefreshDateTime;
                _messageBus.PublishMessage(traineeshipExtended);
            });
        }
コード例 #2
0
ファイル: CheckNasGateway.cs プロジェクト: Valtech-NAS/Beta
        public void Run()
        {
            try
            {
                var summaries = _vacancyIndexDataProvider.GetVacancySummaries(1);

                var apprenticeshipSummaries = summaries as IList <ApprenticeshipSummary> ?? summaries.ApprenticeshipSummaries;
                var traineeshipSummaries    = summaries as IList <TraineeshipSummary> ?? summaries.TraineeshipSummaries;

                var summary = apprenticeshipSummaries.ToList().FirstOrDefault();

                if (summary != null)
                {
                    var apprenticeshipDetail = _vacancyDataProvider.GetVacancyDetails(summary.Id);
                }
                else
                {
                    _logger.Error("Monitor get vacancy summary returned {0} records", apprenticeshipSummaries.Count() + traineeshipSummaries.Count());
                }
            }
            catch (Exception exception)
            {
                _logger.Error("Error connecting to NAS Gateway vacancy index", exception);
            }
        }
コード例 #3
0
        public void ShouldReturnVacancyDetailsForValidVacancyId()
        {
            var response = _vacancyIndexDataProvider.GetVacancySummaries(1);

            var firstOrDefault = response.ApprenticeshipSummaries.FirstOrDefault();

            if (firstOrDefault == null)
            {
                return;
            }

            var firstVacancyId = firstOrDefault.Id;
            var result         = _vacancyDataProvider.GetVacancyDetails(firstVacancyId);

            result.Should().NotBeNull();
        }
        public void ShouldReturnTheFirstPageResultForVacancies()
        {
            var response = _vacancyIndexDataProvider.GetVacancySummaries(1);

            response.Should().NotBeNull();
        }