Exemple #1
0
        public void GetAllJobsForAdjudicationTest()
        {
            JobStatusLogic    target   = new JobStatusLogic();
            List <JobsStatus> expected = new List <JobsStatus>
            {
                new JobsStatus {
                    RequestName = "RName1", TaskId = "101", Status = "Pass1"
                },
                new JobsStatus {
                    RequestName = "RName2", TaskId = "102", Status = "Pass2"
                },
                new JobsStatus {
                    RequestName = "RName3", TaskId = "103", Status = "Pass3"
                },
                new JobsStatus {
                    RequestName = "RName4", TaskId = "104", Status = "Pass4"
                },
                new JobsStatus {
                    RequestName = "RName5", TaskId = "105", Status = "Pass5"
                },
                new JobsStatus {
                    RequestName = "RName6", TaskId = "106", Status = "Pass6"
                },
                new JobsStatus {
                    RequestName = "RName7", TaskId = "107", Status = "Pass7"
                }
            };
            List <JobsStatus> actual = target.GetAllJobsForAdjudication();

            Assert.AreEqual(expected.Count, actual.Count);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
        /// <summary>
        /// Called when [demand adjudication].
        /// </summary>
        private void OnDemandAdjudication()
        {
            try
            {
                //FIXED-MAR16 No need create object _jobManager with CMMembershipConnectionString. Create class called FacilityBubble and call CMMembershipConnectionString from there.
                _facilityLogic = new FacilityLogic();
                IEnumerable <FacilityBubble> facilityBubbles = _facilityLogic.GetBubbles();
                foreach (FacilityBubble facilityBubble in facilityBubbles)
                {
                    _jobManager = new JobStatusLogic(facilityBubble.ConnectionString);

                    //Get all jobs for adjudication which are not cancelled or completed
                    List <TrackTask> allJobs = _jobManager.GetAllJobsForAdjudication();

                    StartNewRequests(allJobs.FindAll(jobs => jobs.Status == Enums.JobStatus.Requested.ToString()),
                                     facilityBubble.ConnectionString);
                    ResumePausedRequests(allJobs.FindAll(jobs => jobs.Status == Enums.JobStatus.Resumed.ToString()),
                                         facilityBubble.ConnectionString);
                }
            }
            catch (Exception ex)
            {
                Log.LogError("Exception" + ex, string.Empty);
            }
        }