Пример #1
0
 public void Should_be_possible_to_schedule_a_request_collect_in_specific_date()
 {
     var collectRequest = new CollectRequestFactory().CreateCollectRequest(DataProvider.GetSession()).Item2;
     var scheduleInformation = new ScheduleInformation() { ScheduleDate = DateTime.Now.AddSeconds(1) };
     var scheduler = new StdSchedulerFactory().GetScheduler();
     var scheduleController = new ScheduleController(scheduler) { TypeOfExecutionJob = typeof(TestJob) };
     
     scheduleController.ScheduleCollection(collectRequest.Oid.ToString(), "", scheduleInformation.ScheduleDate);
     
     Assert.AreEqual(1, scheduleController.GetNumberOfCollectRequestScheduled());
     scheduler.Shutdown();
 }
Пример #2
0
        public void Should_be_possible_get_the_collectRequestIds_that_are_executing_in_the_scheduler()
        {
            var collectRequest = new CollectRequestFactory().CreateCollectRequest(DataProvider.GetSession()).Item2;
            var scheduleInformation = new ScheduleInformation() { ScheduleDate = DateTime.Now.AddSeconds(1) };
            this.SaveCollectRequest(collectRequest);
            var scheduler = new StdSchedulerFactory().GetScheduler();
            var scheduleController = new ScheduleController(scheduler) { TypeOfExecutionJob = typeof(TestJob) };

            scheduleController.ScheduleCollection(collectRequest.Oid.ToString(), "", scheduleInformation.ScheduleDate);
            Thread.Sleep(1000);

            var collectRequestIds = scheduleController.GetCollectRequestIdRunning();
            Assert.IsTrue(collectRequestIds.Count() > 0);
            scheduler.Shutdown();
        }
Пример #3
0
        public void Should_not_possible_schedule_the_collectRequest_if_already_exists_a_job_defined()
        {
            var scheduleInformation = new ScheduleInformation() { ScheduleDate = DateTime.Now.AddSeconds(1) };
            var collectRequest = new CollectRequestFactory().CreateCollectRequest(DataProvider.GetSession()).Item2;
            this.SaveCollectRequest(collectRequest);
            var scheduler = new StdSchedulerFactory().GetScheduler();
            var scheduleController = new ScheduleController(scheduler) { TypeOfExecutionJob = typeof(TestJob) };
            var collectRequestId = collectRequest.Oid.ToString();

            scheduleController.ScheduleCollection(collectRequestId, "", scheduleInformation.ScheduleDate);
            scheduleController.ScheduleCollection(collectRequestId, "", scheduleInformation.ScheduleDate);

            Assert.AreEqual(1, scheduleController.GetNumberOfCollectRequestScheduled());
            scheduler.Shutdown();
        }