/// <summary>
 /// Creates an instance of a queue manager.
 /// </summary>
 /// <param name="projectIntegratorListFactory">The integrator factory.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="stateManager">The state manager to use.</param>
 /// <returns>The new queue manager.</returns>
 public virtual IQueueManager Create(IProjectIntegratorListFactory projectIntegratorListFactory,
     IConfiguration configuration,
     IProjectStateManager stateManager)
 {
     IQueueManager integrationQueueManager = new IntegrationQueueManager(projectIntegratorListFactory, configuration, stateManager);
     return integrationQueueManager;
 }
 public void EmptyIntegrationQueueReportsNamesCorrectly()
 {
     queueManager = new IntegrationQueueManager(new ProjectIntegratorListFactory(),
                                                new Configuration(),
                                                (IProjectStateManager)stateManagerMock.MockInstance);
     string[] queueNames = queueManager.GetQueueNames();
     Assert.AreEqual(0, queueNames.Length);
 }
예제 #3
0
        /// <summary>
        /// Creates an instance of a queue manager.
        /// </summary>
        /// <param name="projectIntegratorListFactory">The integrator factory.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="stateManager">The state manager to use.</param>
        /// <returns>The new queue manager.</returns>
        public virtual IQueueManager Create(IProjectIntegratorListFactory projectIntegratorListFactory,
                                            IConfiguration configuration,
                                            IProjectStateManager stateManager)
        {
            IQueueManager integrationQueueManager = new IntegrationQueueManager(projectIntegratorListFactory, configuration, stateManager);

            return(integrationQueueManager);
        }
 public void QueueNamesShouldBePopulatedFromProjectList()
 {
     queueManager = new IntegrationQueueManager(new ProjectIntegratorListFactory(),
                                                configuration,
                                                (IProjectStateManager)stateManagerMock.MockInstance);
     string[] queueNames = queueManager.GetQueueNames();
     Assert.AreEqual(1, queueNames.Length);
     Assert.AreEqual(project.Name, queueNames[0]);
 }
        public void StopAllProjectsRemovesAllKnownQueueNames()
        {
            queueManager = new IntegrationQueueManager(new ProjectIntegratorListFactory(),
                                                       configuration,
                                                       (IProjectStateManager)stateManagerMock.MockInstance);
            string[] queueNames = queueManager.GetQueueNames();
            Assert.AreEqual(1, queueNames.Length);

            queueManager.StopAllProjects(false);

            queueNames = queueManager.GetQueueNames();
            Assert.AreEqual(0, queueNames.Length);
        }
        public void SetUp()
        {
            project      = new Project();
            project.Name = TestQueueName;

            configuration = new Configuration();
            configuration.AddProject(project);
            stateManagerMock = new DynamicMock(typeof(IProjectStateManager));

            queueManager = new IntegrationQueueManager(new ProjectIntegratorListFactory(),
                                                       configuration,
                                                       (IProjectStateManager)stateManagerMock.MockInstance);
        }
        public void SetUp()
        {
            project      = new Project();
            project.Name = TestQueueName;

            configuration = new Configuration();
            configuration.AddProject(project);
            stateManagerMock = new Mock <IProjectStateManager>();

            queueManager = new IntegrationQueueManager(new ProjectIntegratorListFactory(),
                                                       configuration,
                                                       (IProjectStateManager)stateManagerMock.Object);
        }
        public void GetCruiseServerSnapshotWithNoProjects()
        {
            // Remove the project added in the test setup
            configuration.DeleteProject(TestQueueName);

            queueManager = new IntegrationQueueManager(new ProjectIntegratorListFactory(),
                                                       configuration,
                                                       (IProjectStateManager)stateManagerMock.MockInstance);
            CruiseServerSnapshot cruiseServerSnapshot = queueManager.GetCruiseServerSnapshot();

            Assert.IsNotNull(cruiseServerSnapshot);
            Assert.AreEqual(0, cruiseServerSnapshot.ProjectStatuses.Length);
            Assert.IsNotNull(cruiseServerSnapshot.QueueSetSnapshot);
            Assert.AreEqual(0, cruiseServerSnapshot.QueueSetSnapshot.Queues.Count);
        }
        public void GetQueueNamesOrderedAlphabetically()
        {
            Project project2 = new Project();

            project2.Name = TestQueueName2;
            Project project3 = new Project();

            project3.Name = TestQueueName3;
            configuration.AddProject(project2);
            configuration.AddProject(project3);

            queueManager = new IntegrationQueueManager(new ProjectIntegratorListFactory(),
                                                       configuration,
                                                       (IProjectStateManager)stateManagerMock.MockInstance);
            string[] queueNames = queueManager.GetQueueNames();
            Assert.AreEqual(TestQueueName, queueNames[0]);
            Assert.AreEqual(TestQueueName3, queueNames[1]);
            Assert.AreEqual(TestQueueName2, queueNames[2]);
        }
        public void GetCruiseServerSnapshotWithProjectsAdded()
        {
            Project project2 = new Project();

            project2.Name = TestQueueName2;
            Project project3 = new Project();

            project3.Name = TestQueueName3;
            configuration.AddProject(project2);
            configuration.AddProject(project3);

            queueManager = new IntegrationQueueManager(new ProjectIntegratorListFactory(),
                                                       configuration,
                                                       (IProjectStateManager)stateManagerMock.MockInstance);
            CruiseServerSnapshot cruiseServerSnapshot = queueManager.GetCruiseServerSnapshot();

            Assert.IsNotNull(cruiseServerSnapshot);
            bool found1 = false;
            bool found2 = false;
            bool found3 = false;

            foreach (ProjectStatus status in cruiseServerSnapshot.ProjectStatuses)
            {
                found1 |= (status.Name == TestQueueName);
                found2 |= (status.Name == TestQueueName2);
                found3 |= (status.Name == TestQueueName3);
            }
            if (!found1)
            {
                Assert.Fail("Could not find " + TestQueueName);
            }
            if (!found2)
            {
                Assert.Fail("Could not find " + TestQueueName2);
            }
            if (!found3)
            {
                Assert.Fail("Could not find " + TestQueueName3);
            }
        }