Exemple #1
0
        /// <summary>
        /// Regist the jobs.
        /// </summary>
        /// <param name="job">job object.</param>
        /// <param name="script">Script file name.</param>
        /// <param name="arg">Argument of script file.</param>
        /// <param name="extFile">Extra file list of script file.</param>
        /// <returns>the status of job.</returns>
        public int RegisterJob(Job job, string script, string arg, List<string> extFile)
        {
            if (m_proxy == null)
                return -1;
            if (job == null)
                job = m_proxy.CreateJob();

            job.ScriptFile = script;
            job.Argument = arg;
            job.Manager = this;
            job.ExtraFileList = extFile;
            // search dmpath
            job.JobDirectory = TmpDir + "/" + job.JobID;
            m_groupDic[job.GroupName].Jobs.Add(job);
            OnJobUpdate(JobUpdateType.AddJob);

            return job.JobID;
        }
Exemple #2
0
 /// <summary>
 /// Constructor with the initial parameters.
 /// </summary>
 /// <param name="manager">CommandManager</param>
 /// <param name="groupName">the group name.</param>
 /// <param name="id">the job id.</param>
 public JobStub(CommandManager manager, string groupName, int id)
 {
     this.m_cManager = manager;
     m_id = id;
     m_groupName = groupName;
     if (m_cManager.JobManager.GroupDic.ContainsKey(groupName))
         m_job = m_cManager.JobManager.GroupDic[groupName].GetJob(id);
 }
Exemple #3
0
            /// <summary>
            /// Delete the job stub.
            /// </summary>
            public void Delete()
            {
                if (!m_cManager.JobManager.GroupDic.ContainsKey(m_groupName))
                    return;

                m_cManager.JobManager.GroupDic[m_groupName].DeleteJob(m_id);
                this.m_id = 0;
                this.m_job = null;
                this.m_cManager = null;
            }
Exemple #4
0
 public void TearDown()
 {
     _unitUnderTest = null;
 }
Exemple #5
0
 public void SetUp()
 {
     _unitUnderTest = new Job();
 }
Exemple #6
0
 public void TestConstructorJobExeFileArgExtFileTmpDir()
 {
     string exeFile = null;
     string arg = null;
     System.Collections.Generic.List<System.String> extFile = null;
     string tmpDir = null;
     Job testJob = new Job(exeFile, arg, extFile, tmpDir);
     Assert.IsNotNull(testJob, "Constructor of type, Job failed to create instance.");
 }
Exemple #7
0
        public void TestConstructorJob()
        {
            Job.ClearJobID();

            Job testJob = new Job();
            Assert.IsNotNull(testJob, "Constructor of type, Job failed to create instance.");
            Assert.AreEqual(1, testJob.JobID, "JobID is unexpected value.");
            Assert.AreEqual(-1, testJob.ProcessID, "ProcessID is unexpected value.");
            Assert.AreEqual(-1, testJob.ProcessID, "ProcessID is unexpected value.");
            Assert.AreEqual(JobStatus.NONE, testJob.Status, "Status is unexpected value.");
            Assert.IsNotNull(testJob.Machine, "Machine is unexpected value.");
            Assert.IsEmpty(testJob.Argument, "Argument is unexpected value.");
            Assert.IsEmpty(testJob.ScriptFile, "ScriptFile is unexpected value.");
            Assert.IsEmpty(testJob.JobDirectory, "JobDirectory is unexpected value.");
            Assert.IsNull(testJob.StdErr, "StdErr is unexpected value.");
            Assert.IsEmpty(testJob.ExtraFileList, "ExtraFileList is unexpected value.");

            testJob.Argument = "Error";
            Assert.AreEqual("Error", testJob.Argument, "Argument is unexpected value.");

            testJob.StdErr = "Error";
            Assert.AreEqual("Error", testJob.StdErr, "StdErr is unexpected value.");

            testJob.Machine = "Local";
            Assert.AreEqual("Local", testJob.Machine, "Machine is unexpected value.");

            Assert.AreEqual(0, Job.MaxCount, "MaxCount is unexpected value.");
            Job.MaxCount = 100;
            Assert.AreEqual(100, Job.MaxCount, "MaxCount is unexpected value.");

            Assert.AreEqual(null, Job.DMPATH, "DMPATH is unexpected value.");
            Job.DMPATH = Util.GetDMDirs()[0];
            Assert.AreEqual(Util.GetDMDirs()[0], Job.DMPATH, "DMPATH is unexpected value.");

            testJob.JobDirectory = Util.GetTmpDir();
            Assert.AreEqual(Util.GetTmpDir(), testJob.JobDirectory, "JobDirectory is unexpected value.");

            testJob.ScriptFile = TestConstant.TestDirectory + "0.ess";
            Assert.AreEqual(TestConstant.TestDirectory + "0.ess", testJob.ScriptFile, "ScriptFile is unexpected value.");

            testJob.Param = new Dictionary<string, object>();
            Assert.AreEqual(0, testJob.Param.Count, "Param is unexpected value.");

            testJob.Param.Add("test", "test");
            Assert.AreEqual(1, testJob.Param.Count, "Param is unexpected value.");
        }
Exemple #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 public JobParameterFile(Job job, string path)
 {
     m_job = job;
     m_path = path;
 }