예제 #1
0
        public void NrOfJobsWithinOne()
        {
            Dictionary <string, int> result1 = DAO.NrOfJobsWithinOne(new DateTime(2012, 2, 1, 0, 0, 0), new DateTime(2012, 10, 10, 0, 0, 0), "morten");

            if (result1.ContainsKey("Submitted"))
            {
                int nrOfSubmittedJobs = result1["Submitted"];
                Assert.IsTrue(nrOfSubmittedJobs == 1);
            }

            if (result1.ContainsKey("Running"))
            {
                int nrOfRunningJobs = result1["Running"];
                Assert.IsTrue(nrOfRunningJobs == 0);
            }

            if (result1.ContainsKey("Terminated"))
            {
                int nrOfTerminatedJobs = result1["Terminated"];
                Assert.IsTrue(nrOfTerminatedJobs == 0);
            }

            if (result1.ContainsKey("Failed"))
            {
                int nrOfFailedJobs = result1["Failed"];
                Assert.IsTrue(nrOfFailedJobs == 0);
            }

            if (result1.ContainsKey("Cancelled"))
            {
                int nrOfCancelledJobs = result1["Cancelled"];
                Assert.IsTrue(nrOfCancelledJobs == 1);
            }

            Dictionary <string, int> result2 = DAO.NrOfJobsWithinOne(new DateTime(2012, 2, 1, 0, 0, 0), new DateTime(2012, 10, 10, 0, 0, 0), "ellen");

            if (result2.ContainsKey("Submitted"))
            {
                int nrOfSubmittedJobs = result2["Submitted"];
                Assert.IsTrue(nrOfSubmittedJobs == 1);
            }

            if (result2.ContainsKey("Running"))
            {
                int nrOfRunningJobs = result2["Running"];
                Assert.IsTrue(nrOfRunningJobs == 1);
            }

            if (result2.ContainsKey("Terminated"))
            {
                int nrOfTerminatedJobs = result2["Terminated"];
                Assert.IsTrue(nrOfTerminatedJobs == 0);
            }

            if (result2.ContainsKey("Failed"))
            {
                int nrOfFailedJobs = result2["Failed"];
                Assert.IsTrue(nrOfFailedJobs == 1);
            }

            if (result2.ContainsKey("Cancelled"))
            {
                int nrOfCancelledJobs = result2["Cancelled"];
                Assert.IsTrue(nrOfCancelledJobs == 1);
            }

            Dictionary <string, int> result3 = DAO.NrOfJobsWithinOne(new DateTime(2012, 2, 1, 0, 0, 0), new DateTime(2012, 10, 10, 0, 0, 0), "christoffer");

            if (result3.ContainsKey("Submitted"))
            {
                int nrOfSubmittedJobs = result3["Submitted"];
                Assert.IsTrue(nrOfSubmittedJobs == 1);
            }

            if (result3.ContainsKey("Running"))
            {
                int nrOfRunningJobs = result3["Running"];
                Assert.IsTrue(nrOfRunningJobs == 1);
            }

            if (result3.ContainsKey("Terminated"))
            {
                int nrOfTerminatedJobs = result3["Terminated"];
                Assert.IsTrue(nrOfTerminatedJobs == 1);
            }

            if (result3.ContainsKey("Failed"))
            {
                int nrOfFailedJobs = result3["Failed"];
                Assert.IsTrue(nrOfFailedJobs == 0);
            }

            if (result3.ContainsKey("Cancelled"))
            {
                int nrOfCancelledJobs = result3["Cancelled"];
                Assert.IsTrue(nrOfCancelledJobs == 0);
            }
        }
예제 #2
0
 /// <summary>
 /// Method invoked by any state change in BenchMarkSystem. Publishes a running commentary
 /// when any job is submitted, cancelled, run, failed or terminated
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public static void OnStateChanged(object sender, StateChangedEventArgs e)
 {
     DAO.AddEntry(DateTime.Now, e.Job.State.ToString(), e.Job.Owner.Name, e.Job.jobId);
 }