예제 #1
0
        public void PerformMaintenanceTestNothingToRemove()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = new StorageMaintenanceParameters();

            PrepareComplexStorageForMaintenanceTests();

            maintenance.PerformMaintenance(_managerStorage, maintenanceParameters);

            Assert.AreEqual(4, _managerStorage.GetExecutors().Length);
            Assert.AreEqual(5, _managerStorage.GetApplications().Length);
        }
예제 #2
0
        public void PerformMaintenanceTestRemoveApplicationsByTimeCreated()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = new StorageMaintenanceParameters();

            maintenanceParameters.ApplicationTimeCreatedCutOff = new TimeSpan(20, 0, 0);

            PrepareComplexStorageForMaintenanceTests();

            maintenance.PerformMaintenance(_managerStorage, maintenanceParameters);

            Assert.AreEqual(4, _managerStorage.GetExecutors().Length);
            Assert.AreEqual(2, _managerStorage.GetApplications().Length);
        }
예제 #3
0
        public void PerformMaintenanceTestRemoveAllApplications()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = new StorageMaintenanceParameters();

            maintenanceParameters.RemoveAllApplications = true;

            PrepareComplexStorageForMaintenanceTests();

            maintenance.PerformMaintenance(m_managerStorage, maintenanceParameters);

            Assert.AreEqual(4, m_managerStorage.GetExecutors().Length);
            Assert.AreEqual(0, m_managerStorage.GetApplications().Length);
        }
예제 #4
0
        public void PerformMaintenanceTestRemoveExecutorsByPingTime()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = new StorageMaintenanceParameters();

            maintenanceParameters.ExecutorPingTimeCutOff = new TimeSpan(20, 0, 0);

            PrepareComplexStorageForMaintenanceTests();

            maintenance.PerformMaintenance(m_managerStorage, maintenanceParameters);

            Assert.AreEqual(2, m_managerStorage.GetExecutors().Length);
            Assert.AreEqual(5, m_managerStorage.GetApplications().Length);
        }
예제 #5
0
        public void PerformMaintenanceTestMultipleParameters()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = new StorageMaintenanceParameters();

            maintenanceParameters.AddApplicationStateToRemove(ApplicationState.AwaitingManifest);
            maintenanceParameters.ExecutorPingTimeCutOff = new TimeSpan(20, 0, 0);

            PrepareComplexStorageForMaintenanceTests();

            maintenance.PerformMaintenance(_managerStorage, maintenanceParameters);

            Assert.AreEqual(2, _managerStorage.GetExecutors().Length);
            Assert.AreEqual(3, _managerStorage.GetApplications().Length);
        }
예제 #6
0
        public void PerformMaintenanceTestRemoveApplicationByState()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = new StorageMaintenanceParameters();

            maintenanceParameters.AddApplicationStateToRemove(ApplicationState.AwaitingManifest);
            maintenanceParameters.AddApplicationStateToRemove(ApplicationState.Ready);

            PrepareComplexStorageForMaintenanceTests();

            maintenance.PerformMaintenance(_managerStorage, maintenanceParameters);

            Assert.AreEqual(4, _managerStorage.GetExecutors().Length);
            Assert.AreEqual(2, _managerStorage.GetApplications().Length);
        }
예제 #7
0
        public void PerformMaintenanceTestRemoveApplicationsByTimeCompleted()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = new StorageMaintenanceParameters();

            maintenanceParameters.ApplicationTimeCompletedCutOff = new TimeSpan(20, 0, 0);

            PrepareComplexStorageForMaintenanceTests();

            maintenance.PerformMaintenance(_managerStorage, maintenanceParameters);

            Assert.AreEqual(4, _managerStorage.GetExecutors().Length);
            // we should have left the one that didn't have the time completed set
            // and 2 more that were not in the cut-off range
            Assert.AreEqual(3, _managerStorage.GetApplications().Length);
        }
예제 #8
0
        public void PerformMaintenanceTestNullStorageMaintenanceParameters()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = null;

            PrepareComplexStorageForMaintenanceTests();

            try
            {
                maintenance.PerformMaintenance(_managerStorage, maintenanceParameters);
            }
            catch (NullReferenceException)
            {
                // expecting to get this
                return;
            }

            Assert.Fail("This should have thrown a NullReferenceException");
        }