Exemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// Creates subscriptions to the BenchmarkSystem EventHandlers
        /// </summary>
        /// <param name="benchmark">The Benchmark containing this Logger</param>
        public Logger(BenchmarkSystem benchmark, ITM_DAO dao)
        {
            Contract.Requires(benchmark != null);
            Contract.Requires(dao != null);

            _tmDAO = dao;
            benchmark.JobSubmitted += OnJobSubmitted;
            benchmark.JobCancelled += OnJobCancelled;
            benchmark.JobRunning += OnJobRunning;
            benchmark.JobTerminated += OnJobTerminated;
            benchmark.JobFailed += OnJobFailed;
            benchmark.JobDone += OnJobDone;
        }
Exemplo n.º 2
0
        public void Test_GetJobsFromUserInPeriodOrdered()
        {
            BenchmarkSystem b = new BenchmarkSystem();
            DateTime startTime = new DateTime(2020, 1, 1);
            DateTime endTime = new DateTime(2020, 12, 31);
            User user = new User("Test User", "A secret password");

            _tmDAO.AddUser(user);
            int jobQuantity = 30;
            Job job = null;
            for (int index = 1; index <= jobQuantity; index++)
            {
                DateTime t1 = new DateTime(2020, 3, index);

                job = new Job(user, 100, 5, s => 38);
                _tmDAO.AddJob(job);
                _tmDAO.AddLog(job, t1);
                if (index % 2 == 0)
                {
                    job.Process(new String[] { "test" });
                    _tmDAO.AddLog(job, t1.AddHours(1));
                }
            }
            List<Job> jobsRequested = new List<Job>(_tmDAO.GetJobsFromUserInPeriodOrdered(user.UserId, startTime, endTime));

            for (int i = 0; i < jobsRequested.Count - 1; i++)
            {
                if (jobsRequested[i].CompareTo(jobsRequested[i + 1]) == 1)
                {
                    Assert.Fail("The order is no correct. JobId: " + jobsRequested[i] + " was larger than JobId: " + jobsRequested[i + 1]);
                }
            }

            Assert.AreEqual(jobQuantity, jobsRequested.Count);
        }
Exemplo n.º 3
0
 /// <summary>
 /// The constructor
 /// </summary>
 public ConsoleUI()
 {
     _benchmark = new BenchmarkSystem();
     Launch();
 }
Exemplo n.º 4
0
 public void LoadBenchmarkSystem()
 {
     _b = new BenchmarkSystem();
 }
Exemplo n.º 5
0
 public BenchmarkSystem Constructor()
 {
     BenchmarkSystem target = new BenchmarkSystem();
     return target;
     // TODO: add assertions to method BenchmarkSystemTest.Constructor()
 }