Example #1
0
        public void TestClearJob()
        {
            JobManager manager = new JobManager(_env);
            LocalJob.ClearJobID();

            JobGroup g = manager.CreateJobGroup("AAAAA", new List<EcellObject>(), new List<Ecell.Objects.EcellObject>());
            manager.CreateJobEntry(g.GroupName, new ExecuteParameter());
            int jobID = 0;
            manager.ClearJob(g.GroupName, jobID);

            jobID = manager.CreateJobEntry(g.GroupName, new ExecuteParameter());
            manager.ClearJob(g.GroupName, jobID);
        }
Example #2
0
 public void TearDown()
 {
     _unitUnderTest = null;
 }
Example #3
0
 public void SetUp()
 {
     _env = new ApplicationEnvironment();
     _unitUnderTest = new JobManager(_env);
 }
Example #4
0
        public void TestConstructorJobManager()
        {
            Ecell.ApplicationEnvironment env = null;
            JobManager testJobManager = new JobManager(env);
            Assert.IsNotNull(testJobManager, "Constructor of type, JobManager failed to create instance.");

            Assert.AreEqual(1, testJobManager.Concurrency, "Concurrency is unexpected value.");
            Assert.AreEqual(env, testJobManager.Environment, "Environment is unexpected value.");
            Assert.AreEqual(0, testJobManager.GlobalTimeOut, "GlobalTimeOut is unexpected value.");
            Assert.AreEqual(false, testJobManager.IsTmpDirRemovable, "IsTmpDirRemovable is unexpected value.");
            Assert.IsNotNull(testJobManager.Proxy, "Proxy is unexpected value.");
            Assert.IsNotNull(testJobManager.TmpDir, "TmpDir is unexpected value.");
            Assert.IsNotNull(testJobManager.TmpRootDir, "TmpRootDir is unexpected value.");
            Assert.AreEqual(5000, testJobManager.UpdateInterval, "UpdateInterval is unexpected value.");

            testJobManager.LimitRetry = 1;

            testJobManager.Concurrency = 2;
            Assert.AreEqual(2, testJobManager.Concurrency, "Concurrency is unexpected value.");

            testJobManager.GlobalTimeOut = 10;
            Assert.AreEqual(10, testJobManager.GlobalTimeOut, "GlobalTimeOut is unexpected value.");

            testJobManager.IsTmpDirRemovable = true;
            Assert.AreEqual(true, testJobManager.IsTmpDirRemovable, "IsTmpDirRemovable is unexpected value.");

            testJobManager.Proxy = new LocalJobProxy();
            Assert.IsNotNull(testJobManager.Proxy, "Proxy is unexpected value.");

            testJobManager.UpdateInterval = 10;
            Assert.AreEqual(10, testJobManager.UpdateInterval, "UpdateInterval is unexpected value.");
        }
Example #5
0
 public void TestUpdate()
 {
     JobManager manager = new JobManager(_env);
     JobGroup g = manager.CreateJobGroup("AAAAA", new List<EcellObject>(), new List<Ecell.Objects.EcellObject>());
     manager.CreateJobEntry(g.GroupName, new ExecuteParameter());
     foreach (Job job in manager.GetFinishedJobList())
         job.Status = JobStatus.RUNNING;
     manager.Update();
 }
Example #6
0
 public void TestRun()
 {
     JobManager manager = new JobManager(_env);
     JobGroup g = manager.CreateJobGroup("AAAAA", new List<EcellObject>(), new List<Ecell.Objects.EcellObject>());
     manager.CreateJobEntry(g.GroupName, new ExecuteParameter());
     manager.Run(g.GroupName, true);
     manager.GroupDic[g.GroupName].Stop();
 }
Example #7
0
        public void TestSetEnvironmentProperty()
        {
            JobManager manager = new JobManager(_env);
            Dictionary<string, object> list = new Dictionary<string, object>();
            manager.SetEnvironmentProperty(list);

            manager.Proxy = null;
            manager.SetEnvironmentProperty(list);
        }
Example #8
0
        public void TestRegisterEcellSession()
        {
            JobManager manager = new JobManager(_env);
            LocalJob.ClearJobID();

            JobGroup g = manager.CreateJobGroup("AAAAA", new List<EcellObject>(), new List<Ecell.Objects.EcellObject>());
            string script = null;
            string arg = null;
            List<string> extFile = null;
            int expectedInt32 = 1;
            int resultInt32 = 0;
            resultInt32 = manager.RegisterEcellSession(g.GroupName, script, arg, extFile);
            Assert.AreEqual(expectedInt32, resultInt32, "RegisterEcellSession method returned unexpected result.");

            manager.Proxy = null;
            expectedInt32 = -1;
            resultInt32 = manager.RegisterEcellSession(g.GroupName, script, arg, extFile);
            Assert.AreEqual(expectedInt32, resultInt32, "RegisterEcellSession method returned unexpected result.");
        }
Example #9
0
        public void TestRegisterJob()
        {
            JobManager manager = new JobManager(_env);
            JobGroup g = manager.CreateJobGroup("AAAAA", new List<EcellObject>(), new List<Ecell.Objects.EcellObject>());

            string script = null;
            string arg = null;
            List<string> extFile = null;
            int expectedInt32 = 1;
            int resultInt32 = 0;

            LocalJob.ClearJobID();
            int jobid = manager.CreateJobEntry(g.GroupName, new ExecuteParameter());
            resultInt32 = manager.RegisterJob(manager.GroupDic[g.GroupName].GetJob(jobid), script, arg, extFile);
            Assert.AreEqual(expectedInt32, resultInt32, "RegisterJob method returned unexpected result.");

            manager.Proxy = null;
            resultInt32 = manager.RegisterJob(null, script, arg, extFile);
            expectedInt32 = -1;
            Assert.AreEqual(expectedInt32, resultInt32, "RegisterJob method returned unexpected result.");
        }
Example #10
0
        public void TestGetFinishedJobList()
        {
            JobManager manager = new JobManager(_env);

            List<Job> expectedList = new List<Job>();
            List<Job> resultList = null;
            resultList = manager.GetFinishedJobList();
            Assert.AreEqual(expectedList, resultList, "GetFinishedJobList method returned unexpected result.");
            JobGroup g = manager.CreateJobGroup("AAAAA", new List<EcellObject>(), new List<Ecell.Objects.EcellObject>());

            manager.CreateJobEntry(g.GroupName, new ExecuteParameter());
            resultList = manager.GetFinishedJobList();
            Assert.IsNotEmpty(resultList, "GetFinishedJobList method returned unexpected result.");
        }
Example #11
0
        public void TestIsFinished()
        {
            JobManager manager = new JobManager(_env);

            bool expectedBoolean = true;
            bool resultBoolean = false;
            resultBoolean = manager.IsFinished(null);
            Assert.AreEqual(expectedBoolean, resultBoolean, "IsFinished method returned unexpected result.");
            JobGroup g = manager.CreateJobGroup("AAAAA", new List<EcellObject>(), new List<Ecell.Objects.EcellObject>());

            manager.CreateJobEntry(g.GroupName, new ExecuteParameter());
            foreach (Job job in manager.GetFinishedJobList())
                job.Status = JobStatus.RUNNING;

            expectedBoolean = false;
            resultBoolean = manager.IsFinished(g.GroupName);
            Assert.AreEqual(expectedBoolean, resultBoolean, "IsFinished method returned unexpected result.");
        }
Example #12
0
        public void TestGetEnvironmentProperty()
        {
            JobManager manager = new JobManager(_env);

            Dictionary<string, object> expectedDictionary = new Dictionary<string,object>();
            Dictionary<string, object> resultDictionary = null;
            resultDictionary = manager.GetEnvironmentProperty();
            Assert.AreEqual(expectedDictionary, resultDictionary, "GetEnvironmentProperty method returned unexpected result.");

            manager.Proxy = null;
            expectedDictionary = null;
            resultDictionary = manager.GetEnvironmentProperty();
            Assert.AreEqual(expectedDictionary, resultDictionary, "GetEnvironmentProperty method returned unexpected result.");
        }
Example #13
0
        public void TestGetEnvironmentList()
        {
            JobManager manager = new JobManager(_env);
            List<string> expectedList = new List<string>();
            expectedList.Add("Local");

            List<string> resultList = manager.GetEnvironmentList();
            Assert.AreEqual(expectedList, resultList, "GetEnvironmentList method returned unexpected result.");
        }
Example #14
0
        public void TestGetDefaultConcurrency()
        {
            JobManager manager = new JobManager(_env);
            int expectedInt32 = 1;
            int resultInt32 = 0;
            resultInt32 = manager.GetDefaultConcurrency();
            Assert.AreEqual(expectedInt32, resultInt32, "GetDefaultConcurrency method returned unexpected result.");

            manager.Proxy = null;
            resultInt32 = manager.GetDefaultConcurrency();
            Assert.AreEqual(expectedInt32, resultInt32, "GetDefaultConcurrency method returned unexpected result.");
        }
Example #15
0
        public void TestGetCurrentEnvironment()
        {
            JobManager manager = new JobManager(_env);

            string expectedString = "Local";
            string resultString = null;
            resultString = manager.GetCurrentEnvironment();
            Assert.AreEqual(expectedString, resultString, "GetCurrentEnvironment method returned unexpected result.");

            manager.Proxy = null;
            expectedString = null;
            resultString = manager.GetCurrentEnvironment();
            Assert.AreEqual(expectedString, resultString, "GetEnvironmentList method returned unexpected result.");
        }
Example #16
0
        public void TestCreateJobEntry()
        {
            JobManager manager = new JobManager(_env);
            LocalJob.ClearJobID();

            ExecuteParameter param = new ExecuteParameter();
            int expectedInt32 = 1;
            int resultInt32 = 0;

            JobGroup g = manager.CreateJobGroup("AAAA", new List<EcellObject>(), new List<Ecell.Objects.EcellObject>());
            resultInt32 = manager.CreateJobEntry(g.GroupName, param);
            Assert.AreEqual(expectedInt32, resultInt32, "CreateJobEntry method returned unexpected result.");

            manager.Proxy = null;
            expectedInt32 = -1;
            resultInt32 = manager.CreateJobEntry(g.GroupName, param);
            Assert.AreEqual(expectedInt32, resultInt32, "CreateJobEntry method returned unexpected result.");
        }