ServerLifecycleManager(string[] arguments) { _pulseLogger = new PulseLogger(60000); _pulseLogger.Start(); _pulseTracker = new PulseTracker(TimeSpan.FromDays(1).TotalMilliseconds); _pulseTracker.Start(); SetWorkingDirectory(); MoveSettingsFiles(); var settingsConfigFile = EnvironmentVariables.ServerLogSettingsFile; if (!File.Exists(settingsConfigFile)) { File.WriteAllText(settingsConfigFile, GlobalConstants.DefaultServerLogFileConfig); } try { Dev2Logger.AddEventLogging(settingsConfigFile, "Warewolf Server"); Dev2Logger.UpdateFileLoggerToProgramData(settingsConfigFile); XmlConfigurator.ConfigureAndWatch(new FileInfo(settingsConfigFile)); } catch (Exception e) { Dev2Logger.Error("Error in startup.", e, GlobalConstants.WarewolfError); } Common.Utilities.ServerUser = new WindowsPrincipal(WindowsIdentity.GetCurrent()); SetupTempCleanupSetting(); }
public void PulseTracker_Ctor_TimeoutElapse_ExpectResetExecutionWatcher() { //------------Setup for test-------------------------- var pulseTracker = new PulseTracker(2000); WorkflowExecutionWatcher.HasAWorkflowBeenExecuted = true; //------------Execute Test--------------------------- pulseTracker.Start(); Thread.Sleep(6000); //------------Assert Results------------------------- Assert.IsFalse(WorkflowExecutionWatcher.HasAWorkflowBeenExecuted, "Execution Watcher not reset after pulse tracker execute."); }
public void PulseTracker_Should() { var elapsed = false; var pulseTracker = new PulseTracker(2000); Assert.AreEqual(2000, pulseTracker.Interval); var pvt = new PrivateObject(pulseTracker); var timer = (System.Timers.Timer)pvt.GetField("_timer"); timer.Elapsed += (sender, e) => { elapsed = true; }; Assert.AreEqual(false, timer.Enabled); pulseTracker.Start(); Thread.Sleep(6000); Assert.IsTrue(elapsed); }
void StartPulseLogger() { _pulseLogger.Start(); _pulseTracker.Start(); }