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); }
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); }
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); }
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 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); }
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); }
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); }
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"); }