Example #1
0
        public void TestInitialize()
        {
            /*
             * // Delete contents of table
             * using (var dbContext = new Model1Container())
             * {
             * context.Entities.DeleteAllOnSubmit(context.Entities);
             * context.SubmitChanges();
             * }
             */

            // Insert test contents

            // DateTime er i format year, month, day, hour, minute, second
            DAO.AddEntry(new DateTime(2012, 10, 9, 12, 15, 45), "Submitted", "morten", 1);
            DAO.AddEntry(new DateTime(2012, 10, 9, 12, 16, 45), "Cancelled", "morten", 1);

            DAO.AddEntry(new DateTime(2012, 5, 29, 15, 45, 9), "Submitted", "ellen", 2);
            DAO.AddEntry(new DateTime(2012, 5, 29, 15, 47, 3), "Running", "ellen", 2);
            DAO.AddEntry(new DateTime(2012, 5, 29, 15, 48, 15), "Failed", "ellen", 2);

            DAO.AddEntry(new DateTime(2012, 2, 16, 8, 38, 29), "Submitted", "christoffer", 3);
            DAO.AddEntry(new DateTime(2012, 2, 16, 8, 45, 9), "Running", "christoffer", 3);
            DAO.AddEntry(new DateTime(2012, 2, 16, 8, 50, 14), "Terminated", "christoffer", 3);
        }
Example #2
0
        public void TestFindAllJobs()
        {
            int preCount = DAO.FindAllJobs("christoffer").Count();

            DAO.AddEntry(new DateTime(2012, 2, 16, 8, 38, 29), "Submitted", "christoffer", 3);
            DAO.AddEntry(new DateTime(2012, 2, 16, 8, 45, 9), "Running", "christoffer", 3);
            DAO.AddEntry(new DateTime(2012, 2, 16, 8, 50, 14), "Terminated", "christoffer", 3);
            int postCount = DAO.FindAllJobs("christoffer").Count();

            Assert.AreEqual(preCount + 3, postCount);
            Assert.IsFalse(preCount == postCount);
        }
Example #3
0
        public void TestFindAllSubmitsWithin()
        {
            DateTime start    = new DateTime(2010, 2, 16, 8, 38, 29);
            DateTime end      = new DateTime(2013, 2, 16, 8, 45, 9);
            int      preCount = DAO.FindAllSubmitsWithin("christoffer", start, end).Count();

            DAO.AddEntry(new DateTime(2011, 2, 16, 8, 38, 29), "Submitted", "christoffer", 3);
            DAO.AddEntry(new DateTime(2012, 2, 16, 8, 45, 9), "Running", "christoffer", 3);
            DAO.AddEntry(new DateTime(2009, 2, 16, 8, 50, 14), "Terminated", "christoffer", 3);

            int postCount = DAO.FindAllSubmitsWithin("christoffer", start, end).Count();

            Assert.AreEqual(preCount + 2, postCount);
            Assert.IsFalse(preCount == postCount);
        }
Example #4
0
        public void TestInitialize()
        {
            // Delete contents of table
            DAO.DropTable();

            // Insert test contents
            // DateTime is in format year, month, day, hour, minute, second
            DAO.AddEntry(new DateTime(2012, 10, 9, 12, 15, 45), "Submitted", "morten", 1);
            DAO.AddEntry(new DateTime(2012, 10, 9, 12, 16, 45), "Cancelled", "morten", 1);

            DAO.AddEntry(new DateTime(2012, 5, 29, 15, 45, 9), "Submitted", "ellen", 2);
            DAO.AddEntry(new DateTime(2012, 5, 29, 15, 47, 3), "Running", "ellen", 2);
            DAO.AddEntry(new DateTime(2012, 5, 29, 15, 48, 15), "Failed", "ellen", 2);

            DAO.AddEntry(new DateTime(2012, 2, 16, 8, 38, 29), "Submitted", "christoffer", 3);
            DAO.AddEntry(new DateTime(2012, 2, 16, 8, 45, 9), "Running", "christoffer", 3);
            DAO.AddEntry(new DateTime(2012, 2, 16, 8, 50, 14), "Terminated", "christoffer", 3);
        }
Example #5
0
        public void TestNrOfJobsWithin()
        {
            //return the number of jobs within a given period grouped by their status (queued,running,ended, error). Here the activity log can be useful.
            var result = DAO.NrOfJobsWithin(DateTime.Today.AddDays(-2), DateTime.Today);

            //As there is only five different states
            Assert.IsFalse(result.Count() > 5);
            int submittedCount = 0;
            int cancelledCount = 0;

            foreach (Entry ent in result)
            {
                if (ent.State.Equals("Submitted"))
                {
                    submittedCount = ent.Count;
                }
                if (ent.State.Equals("Cancelled"))
                {
                    cancelledCount = ent.Count;
                }
            }
            DAO.AddEntry(DateTime.Today, "Submitted", "morten", 1);
            var result2 = DAO.NrOfJobsWithin(DateTime.Today.AddDays(-2), DateTime.Today);

            //As there is only five different states
            Assert.IsFalse(result2.Count() > 5);
            foreach (Entry ent in result2)
            {
                // assert that submitted count has increased by one
                if (ent.State.Equals("Submitted"))
                {
                    Assert.IsTrue(ent.Count - submittedCount == 1);
                }
                // assert that cancelledCount hasn't changed
                if (ent.State.Equals("Cancelled"))
                {
                    Assert.IsFalse(ent.Count - cancelledCount == 1);
                }
            }
        }
Example #6
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);
 }