예제 #1
0
        public void CreateJobTest()
        {
            JobStatusLogic target = new JobStatusLogic(Constants.ConnectionString);
            const long     idJob  = 0;
            Job            actual = target.CreateJob(idJob);

            Assert.AreEqual(actual.TaskId, idJob);
        }
예제 #2
0
        public void CreateJobTest()
        {
            JobStatusLogic target   = new JobStatusLogic();
            long           idJob    = 0;
            int            idUser   = 0;
            Job            expected = new Job(idJob, idUser);
            Job            actual   = target.CreateJob(idJob, idUser);

            Assert.AreEqual(expected.GetType(), actual.GetType());
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
        /// <summary>
        /// Starts the new requests.
        /// </summary>
        /// <param name="allJobs">All jobs.</param>
        /// <param name="connectionString">The connection string.</param>
        private void StartNewRequests(IEnumerable <TrackTask> allJobs, string connectionString)
        {
            if (GlobalConfigVariable.IsLogEvent)
            {
                Log.LogInfo("New Job request", string.Empty);
            }

            if (allJobs != null)
            {
                foreach (
                    TrackTask newJob in
                    allJobs.Where(
                        newJob => newJob.Status != null && newJob.Status == Enums.JobStatus.Requested.ToString()))
                {
                    if (GlobalConfigVariable.IsLogEvent)
                    {
                        Log.LogInfo("New Job status - " + newJob.Status + "........" + Enums.JobStatus.Requested,
                                    string.Empty);
                        Log.LogInfo(
                            "Create Job - TaskId - JobStatus.Running.ToString()" + newJob.TaskId + ".. " +
                            Convert.ToInt16(Enums.JobStatus.Running), string.Empty);
                    }

                    _job = _jobManager.CreateJob(Convert.ToInt64(newJob.TaskId));
                    _job.RunJob(Convert.ToInt64(newJob.TaskId), newJob.FacilityId, connectionString);
                    TrackTask updatejob = new TrackTask
                    {
                        TaskId = newJob.TaskId,
                        Status =
                            Convert.ToString(
                                Convert.ToInt16(Enums.JobStatus.Running)),
                        UserName = "******"
                    };

                    if (GlobalConfigVariable.IsLogEvent)
                    {
                        Log.LogInfo(
                            "Update Job request - TaskId - JobStatus.Running.ToString()" + newJob.TaskId + ".. " +
                            Convert.ToInt16(Enums.JobStatus.Running), string.Empty);
                    }

                    _jobManager.UpdateJobStatus(updatejob);
                }
            }
        }