void SetPluginStatus(PluginProxy plugin, RunningStatus newOne, bool allowErrorTransition) { RunningStatus previous = plugin.Status; Debug.Assert(previous != newOne); if (newOne > previous) { // New status is greater than the previous one. // We first set the plugin (and raise the event) and then raise the service event (if any). DoSetPluginStatus(plugin, newOne, previous); if (plugin.IsCurrentServiceImplementation) { if (newOne == RunningStatus.Stopped && plugin.Service.Status == RunningStatus.Stopped) { // This is an consequence of the fact that we disable plugins after // starting the new ones. // When pA (stopping) implements sA and pB implements sA (starting), sA remains "Stopped". } else { plugin.Service.SetStatusChanged(newOne, allowErrorTransition); } } } else { // New status is lower than the previous one. // We first raise the service event (if any) and then the plugin event. if (plugin.IsCurrentServiceImplementation) { plugin.Service.SetStatusChanged(newOne, allowErrorTransition); } DoSetPluginStatus(plugin, newOne, previous); } }
internal static bool DoStart(string[] args) { lock (ServiceLock) { if (_runningStatus == RunningStatus.Started) { Logger.GetInstance(typeof(DefaultService)).Info("Service has already started. Skip"); return(true); } Logger.GetInstance(typeof(DefaultService)).Info("Service starting"); // TODO var processAsUser = ProcessManager.LaunchProcessAsUser("C:\\Windows\\system32\\notepad.exe", ""); if (processAsUser == null) { Logger.GetInstance(typeof(DefaultService)).Info("Can not launch process as user"); } else { Logger.GetInstance(typeof(DefaultService)).Info("processAsUser.Id: " + processAsUser.Id); Logger.GetInstance(typeof(DefaultService)).Info("processAsUser.Name: " + processAsUser.Name); Logger.GetInstance(typeof(DefaultService)).Info("processAsUser.Path: " + processAsUser.Path); Logger.GetInstance(typeof(DefaultService)).Info("processAsUser.User: "******"Service started"); return(true); }
protected override RunningStatus OnTick(Context context) { RunningStatus ret = RunningStatus.Success; int lastIndex = context.blackboard.GetInt(context.tree.guid, this.guid, "childIndex"); int currentChildIndex = lastIndex; for (int i = currentChildIndex; i < m_children.Count; ++i) { ret = m_children[i]._tick(context); if (ret == RunningStatus.Success) { currentChildIndex++; } else { break; } } if (currentChildIndex != lastIndex) { context.blackboard.SetInt(context.tree.guid, this.guid, "childIndex", currentChildIndex); } return(ret); }
static void CheckServicesStatus(this YodiiEngine @this, RunningStatus status, string pluginOrServiceNames, bool expectedIsPartial) { string[] expected = pluginOrServiceNames.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var withTheStatus = @this.LiveInfo.Services.Where(s => s.RunningStatus == status).Select(s => s.ServiceInfo.ServiceFullName); TestExtensions.CheckContainsWithAlternative(expected, withTheStatus, expectedIsPartial); }
protected override RunningStatus onUpdate(IAgent agent, BlackBoardMemory workingMemory) { if (m_Children.Count == 0) { return(RunningStatus.Finished); } if (m_currentNodeIndex < 0) { m_currentNodeIndex = 0; } for (int i = m_currentNodeIndex; i < m_Children.Count; ++i) { RunningStatus status = m_Children[i].update(agent, workingMemory); if (status != RunningStatus.Finished) { return(status); } m_currentNodeIndex++; } return(RunningStatus.Finished); }
protected override RunningStatus onUpdate(IAgent agent, BlackBoardMemory workingMemory) { RunningStatus runningStatus = RunningStatus.Finished; BaseNode previousNode = m_lastRunningNode; // select running node m_lastRunningNode = null; foreach (BaseNode node in m_Children) { runningStatus = node.update(agent, workingMemory); if (runningStatus != RunningStatus.Failed) { m_lastRunningNode = node; break; } } // clear last running node if (previousNode != m_lastRunningNode && previousNode != null) { previousNode.reset(agent, workingMemory); } return(runningStatus); }
protected override RunningStatus OnUpdate(WorkData data) { var context = GetContext <ActionSequenceContext>(data); var index = context.currentIndex; RunningStatus status = RunningStatus.Finished; var node = GetChild <Action>(index); status = node.Update(data); //Todo:ErrorCheck if (!m_ContinueWhenError) { context.currentIndex = -1; return(status); } if (status == RunningStatus.Finished) { context.currentIndex++; if (IsIndexVaild(context.currentIndex)) { status = RunningStatus.Running; } else { context.currentIndex = -1; } } return(status); }
protected override RunningStatus OnUpdate(WorkData data) { var context = GetContext <ActionSelectorContext>(data); int lastIndex = context.lastIndex; int currentIndex = context.currentIndex; RunningStatus status = RunningStatus.Finished; if (lastIndex != currentIndex) { if (IsIndexVaild(lastIndex)) { var node = GetChild <Action>(lastIndex); node.Transition(data); } context.lastIndex = context.currentIndex; } if (IsIndexVaild(currentIndex)) { var node = GetChild <Action>(currentIndex); status = node.Update(data); if (status == RunningStatus.Finished) { context.lastIndex = -1; } } return(status); }
public void InsertRunningResult(RunningStatus runningStatus, string msg) { lock (_result) { _result.Add(runningStatus); _resultMessages.Add(msg); } }
public void Start() { RunningStatus = RunningStatus.Starting; StartService(); RunningStatus = RunningStatus.Started; }
public void Stop() { RunningStatus = RunningStatus.Stopping; StopService(); RunningStatus = RunningStatus.Stopped; }
public BuddyViewer(HistoryOrientedPageSession session, AddInHost host) { this.session = session; this.host = host; _status = RunningStatus.Stopped; _jobslist = new ArrayListDataSet(this); MCEBuddyConf.GlobalMCEConfig = new MCEBuddyConf(); // Initialize with default parameters for now, we will get the config file from the server and then re-initialize (don't use null as it keeps accessing win.ini) - this is never written to a file (just a memory object) }
public static void execute(BaseNode root, IAgent agent, BlackBoardMemory workingMemory) { RunningStatus status = root.update(agent, workingMemory); if (status != RunningStatus.Executing) { root.reset(agent, workingMemory); } }
/// <summary> /// Stop feeder and block current thread until it's getting fully stopped /// </summary> /// <param name="ts">Maximum time to await</param> public void Stop(TimeSpan?ts = null) { if (_status == RunningStatus.Stopped) { return; } _status = RunningStatus.Stopped; _completionEvent.WaitOne(); try { _completionEvent.Reset(); lock (_stateLock) { //while(_running) //Monitor.Wait(_stateLock); _timer.Change(-1, -1); try { Disconnect(); _completeShutdownEvent.Set(); _initShutdownEvent.Set(); //if (_helperThread.IsAlive) //{ // if ( // !_helperThread.Join // (ts.HasValue // ? (int) ts.Value.TotalMilliseconds // : (int) TimeSpan.FromSeconds(3).TotalMilliseconds)) // { //#if NET451 // _helperThread.Abort(); //#endif // } _completeShutdownEvent.WaitOne(); //} } finally { _timer = null; } } UnloadNativeModule(); } finally { _completionEvent.Set(); StoppedEvent?.Invoke(this, null); } }
internal void Initialize(ServiceHost serviceHost, bool isExternalService) { _serviceHost = serviceHost; _isExternalService = isExternalService; if (isExternalService) { _status = RunningStatus.Started; } }
// Methods tested : GetCountOfRecords, GetRecordEITPresentFollowingFlag // GetRecordEITScheduleFlag, GetRecordFreeCAMode, // GetRecordRunningStatus, GetRecordServiceId, // GetRecordCountOfDescriptors, GetRecordDescriptorByIndex // GetRecordDescriptorByTag public void TestBatch2() { int hr = 0; int recordCount = 0; hr = sdt.GetCountOfRecords(out recordCount); Debug.Assert((hr == 0) && (recordCount != 0), "IDVB_SDT.GetCountOfRecords failed"); for (int i = 0; i < recordCount; i++) { // The results depend on too many things to test the returned values bool EITPresentFollowingFlag = false; hr = sdt.GetRecordEITPresentFollowingFlag(i, out EITPresentFollowingFlag); Debug.Assert((hr == 0), "IDVB_SDT.GetRecordEITPresentFollowingFlag failed"); bool EIITScheduleFlag = false; hr = sdt.GetRecordEITScheduleFlag(i, out EIITScheduleFlag); Debug.Assert((hr == 0), "IDVB_SDT.GetRecordEITScheduleFlag failed"); bool FreeCAMode = false; hr = sdt.GetRecordFreeCAMode(i, out FreeCAMode); Debug.Assert((hr == 0), "IDVB_SDT.GetRecordFreeCAMode failed"); RunningStatus runningStatus = 0; hr = sdt.GetRecordRunningStatus(i, out runningStatus); Debug.Assert((hr == 0), "IDVB_SDT.GetRecordRunningStatus failed"); short serviceId = 0; hr = sdt.GetRecordServiceId(i, out serviceId); Debug.Assert((hr == 0), "IDVB_SDT.GetRecordServiceId failed"); int descriptorCount = 0; hr = sdt.GetRecordCountOfDescriptors(i, out descriptorCount); Debug.Assert((hr == 0) && (descriptorCount != 0), "IDVB_SDT.GetRecordServiceId failed"); IGenericDescriptor descriptor = null; byte tag = 0; for (int j = 0; j < descriptorCount; j++) { hr = sdt.GetRecordDescriptorByIndex(i, j, out descriptor); Debug.Assert((hr == 0) && (descriptor != null), "IDVB_SDT.GetRecordDescriptorByIndex failed"); // save it for later hr = descriptor.GetTag(out tag); DsError.ThrowExceptionForHR(hr); Marshal.ReleaseComObject(descriptor); } hr = sdt.GetRecordDescriptorByTag(i, tag, null, out descriptor); Debug.Assert((hr == 0) && (descriptor != null), "IDVB_SDT.GetRecordDescriptorByTag failed"); Marshal.ReleaseComObject(descriptor); } }
private void DoSetPluginStatus(PluginProxy plugin, RunningStatus newOne, RunningStatus previous) { plugin.Status = newOne; var h = StatusChanged; if (h != null) { h(this, new PluginStatusChangedEventArgs(previous, plugin)); } }
// Methods tested : GetCountOfRecords, GetRecordDuration, GetRecordEventId // GetRecordFreeCAMode, GetRecordRunningStatus, // GetRecordStartTime, GetSegmentLastSectionNumber // GetRecordCountOfDescriptors, GetRecordDescriptorByIndex // GetRecordDescriptorByTag public void TestBatch2() { int hr = 0; int recordCount = 0; hr = eit.GetCountOfRecords(out recordCount); Debug.Assert((hr == 0) && (recordCount != 0), "IDVB_EIT.GetCountOfRecords failed"); for (int i = 0; i < recordCount; i++) { // the results are dependent to the multiplex MpegDuration duration = new MpegDuration(); hr = eit.GetRecordDuration(i, out duration); Debug.Assert((hr == 0) && (duration.ToTimeSpan() > TimeSpan.Zero), "IDVB_EIT.GetRecordDuration failed"); short eventId = 0; hr = eit.GetRecordEventId(i, out eventId); Debug.Assert((hr == 0) && (eventId != 0), "IDVB_EIT.GetRecordEventId failed"); bool freeCAMode = true; hr = eit.GetRecordFreeCAMode(i, out freeCAMode); Debug.Assert((hr == 0), "IDVB_EIT.GetRecordFreeCAMode failed"); RunningStatus runningStatus = 0; hr = eit.GetRecordRunningStatus(i, out runningStatus); Debug.Assert((hr == 0 && (runningStatus != 0)), "IDVB_EIT.GetRecordRunningStatus failed"); MpegDateAndTime dateAndTime = new MpegDateAndTime(); hr = eit.GetRecordStartTime(i, out dateAndTime); Debug.Assert((hr == 0) && (dateAndTime.ToDateTime() > DateTime.MinValue), "IDVB_EIT.GetRecordStartTime failed"); int descriptorCount = 0; hr = eit.GetRecordCountOfDescriptors(i, out descriptorCount); Debug.Assert((hr == 0 && (descriptorCount != 0)), "IDVB_EIT.GetRecordCountOfDescriptors failed"); IGenericDescriptor descriptor = null; byte tag = 0; for (int j = 0; j < descriptorCount; j++) { hr = eit.GetRecordDescriptorByIndex(i, j, out descriptor); Debug.Assert((hr == 0 && (descriptor != null)), "IDVB_EIT.GetRecordDescriptorByIndex failed"); hr = descriptor.GetTag(out tag); DsError.ThrowExceptionForHR(hr); Marshal.ReleaseComObject(descriptor); } hr = eit.GetRecordDescriptorByTag(i, tag, null, out descriptor); Debug.Assert((hr == 0 && (descriptor != null)), "IDVB_EIT.GetRecordDescriptorByTag failed"); Marshal.ReleaseComObject(descriptor); } }
private void DrawSelf() { string label = m_node.Title; BTGraphNodeStyle nodeStyle = BTEditorStyle.GetNodeStyle(m_node); Vector2 nodeSize = BTEditorStyle.GetNodeSize(m_node); Rect position = new Rect(NodePosition + BTEditorCanvas.Current.Position, nodeSize); RunningStatus status = BTEditorCanvas.Current.IsDebuging ? GetNodeStatus(m_node) : RunningStatus.None; GUI.Box(position, "", nodeStyle.GetStyle(status, m_isSelected)); int iconSize = 32; int iconOffsetY = 7; Rect iconPos = new Rect(position.x + (nodeSize.x - iconSize) / 2, position.y + (nodeSize.y - iconSize) / 2 - iconOffsetY, iconSize, iconSize); GUI.DrawTexture(iconPos, BTEditorStyle.GetNodeIcon(m_node)); Rect titlePos = new Rect(position); titlePos.y = titlePos.y - 5; EditorGUI.LabelField(titlePos, label, BTEditorStyle.NodeTitleLabel); // show index of composite's children. if (Parent != null && Parent.Node is Composite) { Composite compNode = Parent.Node as Composite; int index = compNode.GetIndex(m_node); Rect nodeLeftPos = new Rect(position.x + 2, position.center.y - 8, 20, 16); EditorGUI.LabelField(nodeLeftPos, index.ToString(), EditorStyles.label); } if (m_node.Breakpoint != Breakpoint.None) { Rect imgPosition; if (m_node is NodeGroup) { imgPosition = new Rect(position.x + 2, position.y + 2, 12, 12); } else { imgPosition = new Rect(position.x + 2, position.y + 2, 12, 12); } GUI.DrawTexture(imgPosition, BTEditorStyle.Breakpoint); } // show obsolete icon if (BTNodeObsoleteFactory.IsObsolete(m_node)) { int obsSize = 24; Rect obsoletePos = new Rect(position.x + nodeSize.x - obsSize - 5, position.y + 5, obsSize, obsSize); GUI.DrawTexture(obsoletePos, BTEditorStyle.WarningIcon); } }
protected override RunningStatus OnTick(Context context) { for (int i = 0; i < m_children.Count; ++i) { RunningStatus ret = m_children[i]._tick(context); if (ret == RunningStatus.Success) { return(RunningStatus.Success); } } return(RunningStatus.Failure); }
public void GetJobs_WhenAllFiltersPresent_ReturnsResultsMatchingFilter() { // Arrange string specificationId = "spec123"; string jobType = "jobType1"; string entityId = "entity1"; RunningStatus runningStatus = RunningStatus.Completed; CompletionStatus completionStatus = CompletionStatus.Succeeded; IJobRepository jobRepository = CreateJobRepository(); jobRepository .GetJobs() .Returns(testData.AsQueryable()); IJobService jobService = CreateJobService(jobRepository); // Act IActionResult results = jobService.GetJobs(specificationId, jobType, entityId, runningStatus, completionStatus, false, 1); // Assert OkObjectResult objResult = results .Should() .BeOfType <OkObjectResult>() .Subject; JobQueryResponseModel response = objResult.Value .Should() .BeOfType <JobQueryResponseModel>() .Subject; response.TotalItems.Should().Be(1); response.CurrentPage.Should().Be(1); response.TotalPages.Should().Be(1); IEnumerable <JobSummary> summaries = response.Results; summaries .Should() .OnlyContain(s => s.SpecificationId == specificationId && s.JobType == jobType && s.EntityId == entityId && s.RunningStatus == runningStatus && s.CompletionStatus == completionStatus); summaries .Should() .HaveCount(1); }
public RunningStatus _tick(Context context) { context._travelNodes[context.tree.guid].Push(this); RunningStatus ret = RunningStatus.Running; bool constraintsTrue = CheckConstraints(context); if (!constraintsTrue) { ret = RunningStatus.Failure; } else { if (!context.blackboard.GetBool(context.tree.guid, guid, "isOpen")) { _open(context); } context._openNodes[context.tree.guid].Push(this); _enter(context); ret = OnTick(context); _exit(context); if (ret != RunningStatus.Running) { context._openNodes[context.tree.guid].Pop(); _close(context); #if UNITY_EDITOR if (BTDebugHelper.BreakPointEnabled) { if ((ret == RunningStatus.Success && m_breakpoint.Has(Breakpoint.OnSuccess)) || (ret == RunningStatus.Failure && m_breakpoint.Has(Breakpoint.OnFailure))) { Debug.Break(); } } #endif } } context.blackboard.SetInt(context.tree.guid, guid, "Status", (int)ret); return(ret); }
protected LiveYodiiItemInfo(YodiiEngine engine, IYodiiItemData d, string fullName) { Debug.Assert(d != null && engine != null && !String.IsNullOrEmpty(fullName)); _engine = engine; _capability = new LiveRunCapability(d.FinalConfigSolvedStatus, d.FinalStartableStatus); _fullName = fullName; Debug.Assert(d.DynamicStatus != null); _disabledReason = d.DisabledReason; _runningStatus = d.DynamicStatus.Value; _configOriginalStatus = d.ConfigOriginalStatus; _configSolvedStatus = d.ConfigSolvedStatus; _configOriginalImpact = d.ConfigOriginalImpact; _configSolvedImpact = d.RawConfigSolvedImpact; }
protected override RunningStatus OnTick(Context context) { RunningStatus ret = m_child._tick(context); if (ret == RunningStatus.Success) { return(RunningStatus.Failure); } else if (ret == RunningStatus.Failure) { return(RunningStatus.Success); } return(RunningStatus.Running); }
protected override RunningStatus OnTick(Context context) { RunningStatus status = RunningStatus.Success; for (int i = 0; i < m_children.Count; ++i) { status = m_children[i]._tick(context); if (status != RunningStatus.Failure) { return(status); } } return(status); }
protected LiveYodiiItemInfo( YodiiEngine engine, IYodiiItemData d, string fullName ) { Debug.Assert( d != null && engine != null && !String.IsNullOrEmpty( fullName ) ); _engine = engine; _capability = new LiveRunCapability( d.FinalConfigSolvedStatus, d.FinalStartableStatus ); _fullName = fullName; Debug.Assert( d.DynamicStatus != null ); _disabledReason = d.DisabledReason; _runningStatus = d.DynamicStatus.Value; _configOriginalStatus = d.ConfigOriginalStatus; _configSolvedStatus = d.ConfigSolvedStatus; _configOriginalImpact = d.ConfigOriginalImpact; _configSolvedImpact = d.RawConfigSolvedImpact; }
internal void SetStatusChanged(RunningStatus newOne, bool allowErrorTransition) { Debug.Assert(_status.IsValidTransition(newOne, allowErrorTransition)); RunningStatus previous = _status; _status = newOne; ConfigureRawImplFromPlugin(); var h = ServiceStatusChanged; if (h != null) { ServiceStatusChangedEventArgs ev = new ServiceStatusChangedEventArgs(previous, _status, allowErrorTransition); h(this, ev); } }
private void ProconStatus(string proconPath) { if (File.Exists(proconPath) == true) { RunningStatus status = RunningStatus.Stopped; string version = "Unknown"; string directory = "Unknown"; foreach (Process pcProcon in Process.GetProcessesByName("PRoCon")) { try { if (string.Compare(proconPath, Path.GetFullPath(pcProcon.MainModule.FileName), true) == 0) { status = RunningStatus.Running; } } catch (Exception) { status = RunningStatus.Error; } } try { AssemblyName proconAssemblyName = AssemblyName.GetAssemblyName(proconPath); version = proconAssemblyName.Version.ToString(); } catch (Exception) { version = "Error"; } try { DirectoryInfo dirInfo = new DirectoryInfo(proconPath); directory = dirInfo.Parent.Name; } catch (Exception) { directory = "Error"; } this.SetStatus(status, version, directory, proconPath); } }
public GUIStyle GetStyle(RunningStatus status, bool isSelected) { switch (status) { case RunningStatus.Failure: return(!isSelected ? m_failNormalStyle : m_failSelectedStyle); case RunningStatus.Running: return(!isSelected ? m_runninfNormalStyle : m_runningSelectedStyle); case RunningStatus.Success: return(!isSelected ? m_successNormalStyle : m_successSelectedStyle); } return(!isSelected ? m_standardNormalStyle : m_standardSelectedStyle); }
public static Color GetTransitionColor(RunningStatus status) { switch (status) { case RunningStatus.Failure: return(Color.red); case RunningStatus.Running: return(new Color32(229, 202, 76, 255)); case RunningStatus.Success: return(Color.green); } return(Color.white); }
protected ServiceProxyBase(object unavailableImpl, Type typeInterface, IList <MethodInfo> mRefs, IList <EventInfo> eRefs) { Debug.Assert(mRefs.All(r => r != null) && mRefs.Distinct().SequenceEqual(mRefs)); _typeInterface = typeInterface; _status = RunningStatus.Disabled; RawImpl = _unavailableImpl = unavailableImpl; _mRefs = new MEntry[mRefs.Count]; for (int i = 0; i < mRefs.Count; i++) { _mRefs[i].Method = mRefs[i]; } _eRefs = new EEntry[eRefs.Count]; for (int i = 0; i < eRefs.Count; i++) { _eRefs[i].Event = eRefs[i]; } }
private void SetStatus(RunningStatus status, string version, string directory, string proconPath) { if (this.lsvInstalls.Items.ContainsKey(proconPath) == true) { this.lsvInstalls.Items[proconPath].Text = status.ToString(); this.lsvInstalls.Items[proconPath].Tag = status; this.lsvInstalls.Items[proconPath].SubItems["Version"].Text = version; this.lsvInstalls.Items[proconPath].SubItems["Directory"].Text = directory; this.lsvInstalls.Items[proconPath].SubItems["Path"].Text = proconPath; } else { ListViewItem newProcon = new ListViewItem(); newProcon.Name = proconPath; newProcon.Text = status.ToString(); newProcon.Tag = status; newProcon.UseItemStyleForSubItems = false; ListViewItem.ListViewSubItem newSubitem = new ListViewItem.ListViewSubItem(); newSubitem.Name = "Version"; newSubitem.Text = version; newSubitem.Font = new Font(this.Font, FontStyle.Bold); newProcon.SubItems.Add(newSubitem); newSubitem = new ListViewItem.ListViewSubItem(); newSubitem.Name = "Directory"; newSubitem.Text = directory; newProcon.SubItems.Add(newSubitem); newSubitem = new ListViewItem.ListViewSubItem(); newSubitem.Name = "Path"; newSubitem.Text = proconPath; newProcon.SubItems.Add(newSubitem); this.lsvInstalls.Items.Add(newProcon); } if (this.lsvInstalls.Items[proconPath].Tag != null && ((RunningStatus)this.lsvInstalls.Items[proconPath].Tag) == RunningStatus.Running) { this.lsvInstalls.Items[proconPath].ImageKey = "running.png"; this.lsvInstalls.Items[proconPath].ForeColor = Color.LightSeaGreen; this.lsvInstalls.Items[proconPath].Font = new Font(this.Font, FontStyle.Bold); } else { this.lsvInstalls.Items[proconPath].ImageKey = "stopped.png"; this.lsvInstalls.Items[proconPath].ForeColor = SystemColors.WindowText; this.lsvInstalls.Items[proconPath].Font = this.Font; } try { if (this.m_latestVersion != null) { if (new Version(version).CompareTo(this.m_latestVersion) >= 0) { this.lsvInstalls.Items[proconPath].SubItems["Version"].ForeColor = Color.LightSeaGreen; } else { this.lsvInstalls.Items[proconPath].SubItems["Version"].ForeColor = Color.Maroon; } } } catch (Exception) { } // }
public ErogeNode(string _title, int _time, string _addr,RunningStatus _status = RunningStatus.Resting) { title = _title; time = _time; path = _addr; }
static void CheckStatus( this YodiiEngine @this, RunningStatus status, string pluginOrServiceNames, bool expectedIsPartial ) { string[] expected = pluginOrServiceNames.Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries ); var withTheStatus = @this.LiveInfo.Plugins.Where( p => p.RunningStatus == status ).Select( p => p.PluginInfo.PluginFullName ); withTheStatus = withTheStatus.Concat( @this.LiveInfo.Services.Where( s => s.RunningStatus == status ).Select( s => s.ServiceInfo.ServiceFullName ) ); TestExtensions.CheckContainsWithAlternative( expected, withTheStatus, expectedIsPartial ); }
private void MetricUpdated(Dictionary<AggregateKey, AggregateResult> result) { var curStatus = status; if (!curStatus.IsSuspended) { if (result != null) { //统计异常数 var count = 0d; foreach (var item in result) count += item.Value.Sum; //单位时间内异常数超过指定值后将挂起,挂起期间不会对进入的请求进行验证,允许请求通过 if (count >= ConfigSettings.ValidateMaxExceptions) { var newStatus = new RunningStatus(); newStatus.SuspendTime = DateTime.Now; newStatus.IsSuspended = true; status = newStatus; } } } else { //挂起持续时间超过指定值后将恢复处理,重新对进入的请求进行验证 if (curStatus.SuspendTime.AddSeconds(ConfigSettings.SuspendingAfterMaxExceptions) <= DateTime.Now) { var newStatus = new RunningStatus(); newStatus.IsSuspended = false; status = newStatus; } } }
private void SetMetric(Exception ex) { try { RegisterMetric(); string status = null; if (typeof(WebException).IsAssignableFrom(ex.GetType())) status = (ex as WebException).Status.ToString(); var tags = new Dictionary<string, string>(); tags.Add("Type", ex.GetType().FullName); tags.Add("Status", status); exceptionMetric.Set(tags, 1); } catch { } }