public void CleanupAndRescheduleJobs_NothingToDo(ProcessingState.SendReceiveStates srState) { // Setup var state = new ProcessingState(TestContext.CurrentContext.Test.Name, _env.Settings) { SRState = srState }; state.Serialize(); // Execute var janitor = new Janitor(_env.Settings, _env.Logger); janitor.CleanupAndRescheduleJobs(); // Verify var queue = Queue.GetQueue(QueueNames.Synchronize); Assert.That(queue.IsEmpty, Is.True); var newState = ProcessingState.Deserialize(TestContext.CurrentContext.Test.Name); Assert.That(newState.SRState, Is.EqualTo(srState)); Assert.That(_exceptionLoggingDouble.Exceptions.Count, Is.EqualTo(0)); }
public void CleanupAndRescheduleJobs_UnknownState(ProcessingState.SendReceiveStates srState) { // Setup var testName = TestContext.CurrentContext.Test.Name; var state = new ProcessingState(testName, _env.Settings) { SRState = srState }; state.Serialize(); // Execute var janitor = new Janitor(_env.Settings, _env.Logger); janitor.CleanupAndRescheduleJobs(); // Verify var queue = Queue.GetQueue(QueueNames.Synchronize); Assert.That(queue.QueuedProjects, Is.EqualTo(new[] { testName })); var newState = ProcessingState.Deserialize(testName); Assert.That(newState.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.IDLE)); Assert.That(_exceptionLoggingDouble.Exceptions.Count, Is.EqualTo(1)); var report = _exceptionLoggingDouble.Exceptions[0]; Assert.That(report.OriginalException, Is.TypeOf <ProjectInUncleanStateException>()); Assert.That(report.OriginalException.Message, Is.EqualTo("QueueManager detected unknown state '42' for project 'CleanupAndRescheduleJobs_UnknownState(42)'; rescheduled")); }
private void RescheduleProject(string projectCode, ProcessingState state, string message) { Logger.Error(message); ExceptionLogging.Client.Notify(new ProjectInUncleanStateException(message)); state.SRState = ProcessingState.SendReceiveStates.IDLE; state.Serialize(); Queue.GetQueue(QueueNames.Synchronize).EnqueueProject(projectCode); }
public void Serialization_Roundtrip() { var expectedState = new ProcessingState("ProjA", _env.Settings) { SRState = ProcessingState.SendReceiveStates.SYNCING, LastStateChangeTicks = DateTime.Now.Ticks, PercentComplete = 50, ElapsedTimeSeconds = 10, TimeRemainingSeconds = 20, TotalSteps = 5, CurrentStep = 1, RetryCounter = 2, UncommittedEditCounter = 0 }; expectedState.Serialize(); var state = ProcessingState.Deserialize("ProjA"); Assert.That(state, Is.EqualTo(expectedState)); }