/// <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;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CruiseServer" /> class.	
        /// </summary>
        /// <param name="configurationService">The configuration service.</param>
        /// <param name="projectIntegratorListFactory">The project integrator list factory.</param>
        /// <param name="projectSerializer">The project serializer.</param>
        /// <param name="stateManager">The state manager.</param>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="executionEnvironment">The execution environment.</param>
        /// <param name="extensionList">The extension list.</param>
        /// <remarks></remarks>
        public CruiseServer(IConfigurationService configurationService,
                            IProjectIntegratorListFactory projectIntegratorListFactory,
                            IProjectSerializer projectSerializer,
                            IProjectStateManager stateManager,
                            IFileSystem fileSystem,
                            IExecutionEnvironment executionEnvironment,
                            List<ExtensionConfiguration> extensionList)
        {
            this.configurationService = configurationService;
            this.projectSerializer = projectSerializer;
            this.fileSystem = fileSystem;
            this.executionEnvironment = executionEnvironment;

            // Leave the manager for backwards compatability - it is marked as obsolete
#pragma warning disable 0618
            manager = new CruiseManager(this);
#pragma warning restore 0618
            serverClient = new CruiseServerClient(this);
            InitializeServerThread();

            // Initialise the configuration
            configuration = configurationService.Load();

            // Initialise the queue manager
            integrationQueueManager = IntegrationQueueManagerFactory.CreateManager(projectIntegratorListFactory, configuration, stateManager);
            integrationQueueManager.AssociateIntegrationEvents(OnIntegrationStarted, OnIntegrationCompleted);
            securityManager = configuration.SecurityManager;

            // Load the extensions
            if (extensionList != null)
            {
                InitialiseExtensions(extensionList);
            }

            this.configurationService.AddConfigurationUpdateHandler(Restart);
            programmDataFolder = this.executionEnvironment.GetDefaultProgramDataFolder(ApplicationType.Server);

            // Initialise the cache time
            var cacheTimeInConfig = ConfigurationManager.AppSettings["cacheTime"];
            if (string.IsNullOrEmpty(cacheTimeInConfig))
            {
                // Set the default cache time to five minutes
                this.cacheTime = new TimeSpan(0, 5, 0);
                Log.Info("Log cache time set to 5 minutes");
            }
            else
            {
                this.cacheTime = TimeSpan.FromSeconds(Convert.ToDouble(cacheTimeInConfig, CultureInfo.CurrentCulture));
                if (this.cacheTime.TotalSeconds < 5)
                {
                    // If the cache time is less then 5s then turn off caching
                    this.cacheTime = TimeSpan.MinValue;
                    Log.Info("Log cache has been turned off");
                }
                else
                {
                    Log.Info("Log cache time set to " + this.cacheTime.TotalSeconds.ToString(CultureInfo.CurrentCulture) + " seconds");
                }
            }
        }
Beispiel #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);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IntegrationQueueManager" /> class.	
        /// </summary>
        /// <param name="projectIntegratorListFactory">The project integrator list factory.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="stateManager">The state manager.</param>
        /// <remarks></remarks>
		public IntegrationQueueManager(IProjectIntegratorListFactory projectIntegratorListFactory,
		                               IConfiguration configuration,
                                       IProjectStateManager stateManager)
		{
			this.projectIntegratorListFactory = projectIntegratorListFactory;
			Initialize(configuration);
            this.stateManager = stateManager;
		}
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IntegrationQueueManager" /> class.
 /// </summary>
 /// <param name="projectIntegratorListFactory">The project integrator list factory.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="stateManager">The state manager.</param>
 /// <remarks></remarks>
 public IntegrationQueueManager(IProjectIntegratorListFactory projectIntegratorListFactory,
                                IConfiguration configuration,
                                IProjectStateManager stateManager)
 {
     this.projectIntegratorListFactory = projectIntegratorListFactory;
     Initialize(configuration);
     this.stateManager = stateManager;
 }
Beispiel #6
0
        public CruiseServer(IConfigurationService configurationService, IProjectIntegratorListFactory projectIntegratorListFactory, IProjectSerializer projectSerializer)
        {
            this.configurationService = configurationService;
            this.configurationService.AddConfigurationUpdateHandler(new ConfigurationUpdateHandler(Restart));
            this.projectIntegratorListFactory = projectIntegratorListFactory;

            // ToDo - get rid of manager, maybe
            manager = new CruiseManager(this);

            // By default, no integrators are running
            this.projectSerializer = projectSerializer;

            CreateIntegrators();
        }
Beispiel #7
0
        public CruiseServer(IConfigurationService configurationService, IProjectIntegratorListFactory projectIntegratorListFactory, IProjectSerializer projectSerializer)
        {
            this.configurationService = configurationService;
            this.configurationService.AddConfigurationUpdateHandler(new ConfigurationUpdateHandler(Restart));
            this.projectIntegratorListFactory = projectIntegratorListFactory;

            // ToDo - get rid of manager, maybe
            manager = new CruiseManager(this);

            // By default, no integrators are running
            this.projectSerializer = projectSerializer;

            CreateIntegrators();
        }
Beispiel #8
0
        public void CreateManagerGeneratesDefault()
        {
            IConfiguration configuration = mocks.Create <IConfiguration>().Object;
            IProjectList   projectList   = mocks.Create <IProjectList>().Object;
            IEnumerator    enumerator    = mocks.Create <IEnumerator>().Object;

            Mock.Get(enumerator).Setup(_enumerator => _enumerator.MoveNext()).Returns(false);
            Mock.Get(projectList).Setup(_projectList => _projectList.GetEnumerator()).Returns(enumerator);
            Mock.Get(configuration).Setup(_configuration => _configuration.Projects).Returns(projectList);
            IProjectIntegratorListFactory listFactory = mocks.Create <IProjectIntegratorListFactory>().Object;
            IProjectIntegratorList        list        = mocks.Create <IProjectIntegratorList>().Object;

            Mock.Get(list).SetupGet(_list => _list.Count).Returns(0);
            Mock.Get(listFactory).Setup(_listFactory => _listFactory.CreateProjectIntegrators(It.IsAny <IProjectList>(), It.IsAny <IntegrationQueueSet>())).Returns(list);

            object instance = IntegrationQueueManagerFactory.CreateManager(listFactory, configuration, null);

            Assert.That(instance, Is.InstanceOf <IntegrationQueueManager>());
        }
Beispiel #9
0
        public void CreateManagerGeneratesDefault()
        {
            IConfiguration configuration = mocks.DynamicMock <IConfiguration>();
            IProjectList   projectList   = mocks.DynamicMock <IProjectList>();
            IEnumerator    enumerator    = mocks.DynamicMock <IEnumerator>();

            SetupResult.For(enumerator.MoveNext()).Return(false);
            SetupResult.For(projectList.GetEnumerator()).Return(enumerator);
            SetupResult.For(configuration.Projects).Return(projectList);
            IProjectIntegratorListFactory listFactory = mocks.DynamicMock <IProjectIntegratorListFactory>();
            IProjectIntegratorList        list        = mocks.DynamicMock <IProjectIntegratorList>();

            SetupResult.For(list.Count).Return(0);
            SetupResult.For(listFactory.CreateProjectIntegrators(null, null)).IgnoreArguments().Return(list);
            mocks.ReplayAll();

            object instance = IntegrationQueueManagerFactory.CreateManager(listFactory, configuration, null);

            Assert.That(instance, Is.InstanceOf <IntegrationQueueManager>());
        }
 /// <summary>
 /// Generates a queue manager using the default factory.
 /// </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 static IQueueManager CreateManager(IProjectIntegratorListFactory projectIntegratorListFactory,
     IConfiguration configuration,
     IProjectStateManager stateManager)
 {
     return managerFactory.Create(projectIntegratorListFactory, configuration, stateManager);
 }
Beispiel #11
0
 /// <summary>
 /// Generates a queue manager using the default factory.
 /// </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 static IQueueManager CreateManager(IProjectIntegratorListFactory projectIntegratorListFactory,
                                           IConfiguration configuration,
                                           IProjectStateManager stateManager)
 {
     return(managerFactory.Create(projectIntegratorListFactory, configuration, stateManager));
 }