/// <summary> /// Waits for the engine status requested. If a status is not changed within a certain amout of time then fail. /// </summary> public void WaitForEngineStatus(BuildRequestEngineStatus status) { while (this.LastEngineStatus != status) { if (this.engineStatusChangedEvent.WaitOne(QAMockHost.globalTimeOut, false) == false) { Assert.Fail("Requested engine status was not received within - " + QAMockHost.globalTimeOut.ToString() + " seconds."); } } }
/// <summary> /// Constructor /// </summary> internal QAMockHost(GetComponentDelegate getComponentCallback) { this.buildParameters = new BuildParameters(); this.getComponentCallback = getComponentCallback; this.engineStatusChangedEvent = new AutoResetEvent(false); this.lastEngineStatus = BuildRequestEngineStatus.Shutdown; this.loggingService = this; this.requestEngine = null; this.testDataProvider = null; this.buildComponents = new Queue <IBuildComponent>(); this.legacyThreadingData = new LegacyThreadingData(); }
private void VerifyEngineStatus(BuildRequestEngineStatus expectedStatus) { IBuildRequestEngine engine = (IBuildRequestEngine)_host.GetComponent(BuildComponentType.RequestEngine); if (engine.Status == expectedStatus) { return; } WaitForEvent(_engineStatusChangedEvent, "EngineStatusChanged"); BuildRequestEngineStatus engineStatus = engine.Status; Assert.Equal(expectedStatus, engineStatus); }
private void WaitForEngineStatus(BuildRequestEngineStatus expectedStatus) { DateTime time = DateTime.Now; while (DateTime.Now - time > new TimeSpan(0, 0, 5)) { WaitForEvent(_engineStatusChangedEvent, "EngineStatusChanged"); if (expectedStatus == _engineStatusChanged_Status) { return; } } Assert.Fail("Engine failed to change to status " + expectedStatus); }
/// <summary> /// Callback for event raised when the build request engine's status changes. /// </summary> /// <param name="newStatus">The new status for the engine</param> private void Engine_EngineStatusChanged(BuildRequestEngineStatus newStatus) { _engineStatusChanged_Status = newStatus; _engineStatusChangedEvent.Set(); }
/// <summary> /// Gets called by the build request engine when the build request engine state changes. /// Special handeling when a shutdown has been sent so that only shutdown status set the event /// </summary> private void RequestEngine_OnStatusChanged(BuildRequestEngineStatus newStatus) { this.LastEngineStatus = newStatus; this.engineStatusChangedEvent.Set(); }
/// <summary> /// Raises the OnStatusChanged event. /// </summary> /// <param name="newStatus">The new engine status.</param> private void RaiseEngineStatusChanged(BuildRequestEngineStatus newStatus) { EngineStatusChangedDelegate statusChanged = OnStatusChanged; if (null != statusChanged) { statusChanged(newStatus); } }
/// <summary> /// Changes the engine's status and raises the OnStatsChanged event. /// </summary> /// <param name="newStatus">The new engine status.</param> private void ChangeStatus(BuildRequestEngineStatus newStatus) { if (_status != newStatus) { _status = newStatus; RaiseEngineStatusChanged(newStatus); } }
/// <summary> /// Constructor /// </summary> internal BuildRequestEngine() { _debugDumpState = Environment.GetEnvironmentVariable("MSBUILDDEBUGSCHEDULER") == "1"; _debugDumpPath = Environment.GetEnvironmentVariable("MSBUILDDEBUGPATH"); _debugForceCaching = Environment.GetEnvironmentVariable("MSBUILDDEBUGFORCECACHING") == "1"; if (String.IsNullOrEmpty(_debugDumpPath)) { _debugDumpPath = Path.GetTempPath(); } _status = BuildRequestEngineStatus.Uninitialized; _nextUnresolvedConfigurationId = -1; _nextBuildRequestId = 0; _requests = new List<BuildRequestEntry>(); _unsubmittedRequests = new Queue<PendingUnsubmittedBuildRequests>(); _requestsByGlobalRequestId = new Dictionary<int, BuildRequestEntry>(); }
/// <summary> /// Constructor /// </summary> internal QAMockHost(GetComponentDelegate getComponentCallback) { this.buildParameters = new BuildParameters(); this.getComponentCallback = getComponentCallback; this.engineStatusChangedEvent = new AutoResetEvent(false); this.lastEngineStatus = BuildRequestEngineStatus.Shutdown; this.loggingService = this; this.requestEngine = null; this.testDataProvider = null; this.buildComponents = new Queue<IBuildComponent>(); this.legacyThreadingData = new LegacyThreadingData(); }
private void WaitForEngineStatus(BuildRequestEngineStatus expectedStatus) { DateTime time = DateTime.Now; while (DateTime.Now - time > new TimeSpan(0, 0, 5)) { WaitForEvent(_engineStatusChangedEvent, "EngineStatusChanged"); if (expectedStatus == _engineStatusChanged_Status) { return; } } Assert.True(false, "Engine failed to change to status " + expectedStatus); }