public void PerformMaintenanceTestNothingToRemove()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = new StorageMaintenanceParameters();

            PrepareComplexStorageForMaintenanceTests();

            maintenance.PerformMaintenance(m_managerStorage, maintenanceParameters);

            Assert.AreEqual(4, m_managerStorage.GetExecutors().Length);
            Assert.AreEqual(5, m_managerStorage.GetApplications().Length);
        }
        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(m_managerStorage, maintenanceParameters);

            Assert.AreEqual(2, m_managerStorage.GetExecutors().Length);
            Assert.AreEqual(3, m_managerStorage.GetApplications().Length);
        }
        public void PerformMaintenanceTestNullStorageMaintenanceParameters()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = null;

            PrepareComplexStorageForMaintenanceTests();

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

            Assert.Fail("This should have thrown a NullReferenceException");
        }
        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);
        }
        public void PerformMaintenanceTestRemoveApplicationsByTimeCompleted()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = new StorageMaintenanceParameters();

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

            PrepareComplexStorageForMaintenanceTests();

            maintenance.PerformMaintenance(m_managerStorage, maintenanceParameters);

            Assert.AreEqual(4, m_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, m_managerStorage.GetApplications().Length);
        }
        public void PerformMaintenanceTestRemoveApplicationByState()
        {
            Maintenance maintenance = new Maintenance();
            StorageMaintenanceParameters maintenanceParameters = new StorageMaintenanceParameters();

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

            PrepareComplexStorageForMaintenanceTests();

            maintenance.PerformMaintenance(m_managerStorage, maintenanceParameters);

            Assert.AreEqual(4, m_managerStorage.GetExecutors().Length);
            Assert.AreEqual(2, m_managerStorage.GetApplications().Length);
        }
Exemple #7
0
        public void Admon_PerformStorageMaintenance(SecurityCredentials sc, StorageMaintenanceParameters maintenanceParameters)
        {
            AuthenticateUser(sc);
            EnsurePermission(sc, Permission.ManageAllApps);

            logger.Debug(String.Format("Performing maintenance with parameters {0}.", maintenanceParameters));

            Maintenance maintenance = new Maintenance();

            maintenance.PerformMaintenance(ManagerStorageFactory.ManagerStorage(), maintenanceParameters);
        }