Beispiel #1
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"));
        }
Beispiel #2
0
        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));
        }