Ejemplo n.º 1
0
 void PerformTimerActions(object state)
 {
     GetComputerNames.GetComputerNamesList();
     if (_daysToKeepTempFiles != 0)
     {
         DeleteTempFiles();
     }
 }
Ejemplo n.º 2
0
        public void GetComputerNamesListExpectListOfComputerNames()
        {
            //------------Setup for test--------------------------

            //------------Execute Test---------------------------
            GetComputerNames.GetComputerNamesList();
            //------------Assert Results-------------------------
            Assert.IsNotNull(GetComputerNames.ComputerNames);
            Assert.IsTrue(GetComputerNames.ComputerNames.Count >= 1);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Starts up the server with relevant workers.
        /// NOTE: This must return a task as in Windows Server 2008 and Windows Server 2012 there is an issue
        /// with the WMI Performance Adapter that causes it to prevent the Warewolf Server Service to need a double restart.
        /// </summary>
        /// <param name="initWorkers">Initilization Workers</param>
        /// <returns>A Task that starts up the Warewolf Server.</returns>
        public Task Run(IEnumerable <IServerLifecycleWorker> initWorkers)
        {
            void OpenCOMStream(INamedPipeClientStreamWrapper clientStreamWrapper)
            {
                _writer.Write("Opening named pipe client stream for COM IPC... ");
                _ipcClient = _ipcClient.GetIpcExecutor(clientStreamWrapper);
                _writer.WriteLine("done.");
            }

            return(Task.Run(LoadPerformanceCounters)
                   .ContinueWith((t) =>
            {
//
//                 // ** Perform Moq Installer Actions For Development ( DEBUG config ) **
// #if DEBUG
//                 try
//                 {
//                     var miq = MoqInstallerActionFactory.CreateInstallerActions();
//                     miq.ExecuteMoqInstallerActions();
//                 }
//                 catch (Exception e)
//                 {
//                     Dev2Logger.Warn("Mocking installer actions for DEBUG config failed to create Warewolf Administrators group and/or to add current user to it [ " + e.Message + " ]", GlobalConstants.WarewolfWarn);
//                 }
// #endif

                try
                {
                    foreach (var worker in initWorkers)
                    {
                        worker.Execute();
                    }
                    _loggingProcessMonitor.Start();
                    var loggingServerCheckDelay = Task.Delay(TimeSpan.FromSeconds(300));

                    _loadResources = new LoadResources("Resources", _writer, _startUpDirectory, _startupResourceCatalogFactory);
                    LoadHostSecurityProvider();
                    _loadResources.CheckExampleResources();
                    _loadResources.MigrateOldTests();
                    var webServerConfig = _webServerConfiguration;
                    webServerConfig.Execute();
                    new LoadRuntimeConfigurations(_writer).Execute();
                    OpenCOMStream(null);
                    _loadResources.LoadResourceCatalog();
                    _timer = new Timer((state) => GetComputerNames.GetComputerNamesList(), null, 1000, GlobalConstants.NetworkComputerNameQueryFreq);
                    _loadResources.LoadServerWorkspace();
                    _loadResources.LoadActivityCache(_assemblyLoader);
                    LoadTestCatalog();
                    LoadTriggersCatalog();

                    StartTrackingUsage();

                    _startWebServer.Execute(webServerConfig, _pauseHelper);
                    _queueProcessMonitor.Start();

                    var checkLogServerConnectionTask = CheckLogServerConnection();
                    var result = Task.WaitAny(new [] { checkLogServerConnectionTask, loggingServerCheckDelay });
                    var isConnectedOkay = !checkLogServerConnectionTask.IsCanceled && !checkLogServerConnectionTask.IsFaulted && checkLogServerConnectionTask.Result == true;
                    var logServerConnectedOkayNoTimeout = result == 0 && isConnectedOkay;
                    if (!logServerConnectedOkayNoTimeout)
                    {
                        _writer.WriteLine("unable to connect to logging server");
                        if (checkLogServerConnectionTask.IsFaulted)
                        {
                            _writer.WriteLine("error: " + checkLogServerConnectionTask.Exception?.Message);
                        }
                        Stop(false, 0, true);
                    }
#if DEBUG
                    if (EnvironmentVariables.IsServerOnline)
                    {
                        SetAsStarted();
                    }
#endif
                }
                catch (Exception e)
                {
#pragma warning disable S2228 // Console logging should not be used
                    Console.WriteLine(e);
#pragma warning restore S2228 // Console logging should not be used
                    Dev2Logger.Error("Error Starting Server", e, GlobalConstants.WarewolfError);
                    Stop(true, 0, false);
                }
            }));
        }
Ejemplo n.º 4
0
 public void GetComputerNames_ComputerNames_UpdateComputerNames()
 {
     GetComputerNames.GetComputerNamesList();
     Assert.IsTrue(GetComputerNames.ComputerNames.Count >= 1);
 }