示例#1
0
        public void RemoveApplicationsByTimeCreatedSpanTestNothingToRemove()
        {
            Maintenance maintenance = new Maintenance();

            Assert.AreEqual(0, _managerStorage.GetApplications().Length);

            maintenance.RemoveApplications(_managerStorage, new TimeSpan(1000));

            Assert.AreEqual(0, _managerStorage.GetApplications().Length);
        }
示例#2
0
        public void RemoveApplicationsByApplicationStateTestNothingToRemove()
        {
            Maintenance maintenance = new Maintenance();

            Assert.AreEqual(0, _managerStorage.GetApplications().Length);

            maintenance.RemoveApplications(_managerStorage);

            Assert.AreEqual(0, _managerStorage.GetApplications().Length);
        }
示例#3
0
        public void RemoveApplicationsByTimeCreatedTestNothingToRemove()
        {
            Maintenance maintenance = new Maintenance();

            Assert.AreEqual(0, m_managerStorage.GetApplications().Length);

            maintenance.RemoveApplications(m_managerStorage, DateTime.Now);

            Assert.AreEqual(0, m_managerStorage.GetApplications().Length);
        }
示例#4
0
        public void RemoveApplicationsByApplicationStateTestRemoveNonExistingState()
        {
            Maintenance maintenance = new Maintenance();

            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, DateTime.Now, false, "username1"));

            Assert.AreEqual(1, _managerStorage.GetApplications().Length);

            maintenance.RemoveApplications(_managerStorage, ApplicationState.Stopped);

            Assert.AreEqual(1, _managerStorage.GetApplications().Length);
        }
示例#5
0
        public void RemoveApplicationsByTimeCreatedTestRemoveNonExistingDates()
        {
            Maintenance maintenance = new Maintenance();
            DateTime    timeCreated = DateTime.Now;

            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated, false, "username1"));

            Assert.AreEqual(1, _managerStorage.GetApplications().Length);

            maintenance.RemoveApplications(_managerStorage, timeCreated.AddDays(-1));

            Assert.AreEqual(1, _managerStorage.GetApplications().Length);
        }
示例#6
0
        public void RemoveApplicationsByTimeCreatedSpanTestRemoveNonExistingDates()
        {
            Maintenance maintenance = new Maintenance();
            DateTime    timeCreated = DateTime.Now;

            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated, false, "username1"));

            Assert.AreEqual(1, _managerStorage.GetApplications().Length);

            // one hour should be enough to avoid removing this one.
            maintenance.RemoveApplications(_managerStorage, new TimeSpan(1, 0, 0));

            Assert.AreEqual(1, _managerStorage.GetApplications().Length);
        }
示例#7
0
        public void RemoveApplicationsByApplicationStateTestRemoveMultipleExistingStates()
        {
            Maintenance maintenance = new Maintenance();

            m_managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, DateTime.Now, false, "username1"));
            m_managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, DateTime.Now, false, "username1"));
            m_managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Ready, DateTime.Now, false, "username1"));
            m_managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, DateTime.Now, false, "username1"));
            m_managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, DateTime.Now, false, "username1"));

            Assert.AreEqual(5, m_managerStorage.GetApplications().Length);

            maintenance.RemoveApplications(m_managerStorage, ApplicationState.Stopped, ApplicationState.Ready);

            Assert.AreEqual(2, m_managerStorage.GetApplications().Length);
        }
示例#8
0
        public void RemoveApplicationsByTimeCreatedTestRemoveMultipleOldApplications()
        {
            Maintenance maintenance = new Maintenance();

            DateTime timeCreated = DateTime.Now;

            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated.AddDays(-5), false, "username1"));
            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, timeCreated.AddDays(-4), false, "username1"));
            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Ready, timeCreated.AddDays(1), false, "username1"));
            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated.AddDays(-3), false, "username1"));
            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, timeCreated.AddDays(2), false, "username1"));

            Assert.AreEqual(5, _managerStorage.GetApplications().Length);

            maintenance.RemoveApplications(_managerStorage, timeCreated);

            Assert.AreEqual(2, _managerStorage.GetApplications().Length);
        }
示例#9
0
        public void RemoveApplicationsByTimeCreatedSpanTestRemoveMultipleOldApplications()
        {
            Maintenance maintenance = new Maintenance();

            DateTime timeCreated = DateTime.Now;

            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated.AddDays(-5), false, "username1"));
            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, timeCreated.AddDays(-4), false, "username1"));
            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Ready, timeCreated.AddDays(1), false, "username1"));
            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated.AddDays(-3), false, "username1"));
            _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, timeCreated.AddDays(2), false, "username1"));

            Assert.AreEqual(5, _managerStorage.GetApplications().Length);

            // put a 20 hour cut-off, this should remove 3 of the applications
            maintenance.RemoveApplications(_managerStorage, new TimeSpan(20, 0, 0));

            Assert.AreEqual(2, _managerStorage.GetApplications().Length);
        }