protected PackageBase(string name, IList<IAsset> assets, IProcessor processor, IDebugState debugState) { this.Name = name; this.assets = assets; this.processor = processor; this.debugState = debugState; }
public void Write(IDebugState debugState) { if(debugState != null) { _write(debugState); } }
public TagRenderer(string routeRootPath, Dictionary<string, IPackage> javascripts, Dictionary<string, IPackage> stylesheets, IVersionGenerator versionGenerator, IDebugState debugState) { this.routeRootPath = routeRootPath; this.javascripts = javascripts; this.stylesheets = stylesheets; this.debugState = debugState; this.versionGenerator = versionGenerator; }
[ExcludeFromCodeCoverage] // wf debug logging public static bool ShouldLog(IDebugState iDebugState) { var debugState = iDebugState as DebugState; if (debugState == null) { return false; } return ShouldLog(debugState.OriginatingResourceID); }
protected override void OnExecutedCompleted(NativeActivityContext context, bool hasError, bool isResumable) { IDebugState state = base.GetDebugState(); if (state == null) { IsDebugStateNull = true; } base.OnExecutedCompleted(context, hasError, isResumable); }
private static void ConnectRemoteServer(IDebugState content, IServer remoteEnvironmentModel) { if (content.Server == "localhost") { content.Server = remoteEnvironmentModel.Name; } if (!remoteEnvironmentModel.IsConnected) { remoteEnvironmentModel.Connect(); } }
[ExcludeFromCodeCoverage] // wf debug logging public static bool ShouldLog(IDebugState iDebugState) { var debugState = iDebugState as DebugState; if (debugState == null) { return(false); } return(ShouldLog(debugState.OriginatingResourceID)); }
// BUG 9706 - 2013.06.22 - TWR : refactored static void QueueWrite(IDebugState debugState) { if (debugState != null) { lock (WaitHandleGuard) { WriterQueue.Enqueue(debugState); WriteWaithandle.Set(); } } }
static void AddAssertResultList(IDebugState debugState, DebugItem itemToAdd) { if (debugState.AssertResultList != null) { var addItem = debugState.AssertResultList.Select(debugItem => debugItem.ResultsList.Where(debugItemResult => debugItemResult.Value == Messages.Test_PassedResult)).All(debugItemResults => !debugItemResults.Any()); if (addItem) { debugState.AssertResultList.Add(itemToAdd); } } }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <returns> /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false. /// </returns> /// <param name="other">An object to compare with this object.</param> public bool Equals(IDebugState other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(ID.Equals(other.ID) && SessionID.Equals(other.SessionID)); }
public bool ContenIsNotValid(IDebugState content) { if (content == null || content.SessionID != _sessionId) { return(true); } if (content.Name == "EsbServiceInvoker" && content.ExecutionOrigin == ExecutionOrigin.Unknown) { return(true); } return(false); }
IDebugTreeViewItemViewModel CreateParentTreeViewItem(IDebugState content, IDebugTreeViewItemViewModel child) { if (!_contentItemMap.TryGetValue(content.ParentID.GetValueOrDefault(), out IDebugTreeViewItemViewModel parent)) { parent = new DebugStateTreeViewItemViewModel(ServerRepository) { ActivityTypeName = content.ActualType }; _contentItemMap.Add(content.ParentID.GetValueOrDefault(), parent); } child.Parent = parent; parent.Children.Add(child); return(parent); }
private void IsDebugStateLastStep(IDebugState content) { if ((DebugStatus != DebugStatus.Stopping && DebugStatus != DebugStatus.Finished) || content.StateType == StateType.Message) { return; } if (content.StateType != StateType.End && !IsTestView) { _lastStep = content; } if (content.StateType != StateType.TestAggregate && IsTestView) { _lastStep = content; } }
public virtual void AddDebugItem(Guid clientId, Guid sessionId, IDebugState ds) { lock (Lock) { var key = new Tuple <Guid, Guid>(clientId, sessionId); if (Data.TryGetValue(key, out IList <IDebugState> list)) { list.Add(ds); } else { list = new List <IDebugState> { ds }; Data[key] = list; } } }
public void DsfNativeActivity_DispatchDebugState_After_SetsEndTimeCorrectly() { var parentInstanceID = Guid.NewGuid(); const StateType StateType = StateType.After; var dataObj = new DsfDataObject(string.Empty, GlobalConstants.NullDataListID) { IsDebug = true, IsOnDemandSimulation = false, EnvironmentID = Guid.NewGuid(), WorkspaceID = Guid.NewGuid(), ServerID = Guid.NewGuid(), ResourceID = Guid.NewGuid(), OriginalInstanceID = Guid.NewGuid(), ParentInstanceID = parentInstanceID.ToString() }; IDebugState passedDebugState = null; var mockDebugDispatcher = new Mock <IDebugDispatcher>(); mockDebugDispatcher.Setup(dispatcher => dispatcher.Write(It.IsAny <IDebugState>(), It.IsAny <bool>(), It.IsAny <bool>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IList <IDebugState> >())) .Callback((IDebugState ds, bool isTestExecution, bool isDebugFromWeb, string testName, bool isRemoteInvoke, string remoteID, string parentId, IList <IDebugState> remoteItems) => { passedDebugState = ds; }); var activity = new TestActivity(mockDebugDispatcher.Object) { IsSimulationEnabled = false, SimulationMode = SimulationMode.Never, ScenarioID = Guid.NewGuid().ToString(), IsWorkflow = true, }; var cat = new Mock <IResourceCatalog>(); var res = new Mock <IResource>(); res.Setup(a => a.ResourceName).Returns("bob"); cat.Setup(a => a.GetResource(Guid.Empty, It.IsAny <Guid>())).Returns(res.Object); activity.ResourceCatalog = cat.Object; activity.TestDispatchDebugState(dataObj, StateType); Assert.IsNotNull(passedDebugState); Assert.IsNotNull(passedDebugState.EndTime); Assert.AreNotEqual(DateTime.MinValue, passedDebugState.StartTime); Assert.AreNotEqual(DateTime.MinValue, passedDebugState.EndTime); }
/// <summary> /// Appends the specified content. /// </summary> /// <param name="content">The content.</param> public virtual void Append(IDebugState content) { if (content == null || content.SessionID != SessionID) { return; } //Juries - Dont append start and end states, its not for display, just for logging puposes, unless its the first or last step if (content.StateType == StateType.Start && !content.IsFirstStep()) { return; } if (content.StateType == StateType.End && !content.IsFinalStep()) { return; } if ((DebugStatus == DebugStatus.Stopping || DebugStatus == DebugStatus.Finished) && content.StateType != StateType.Message) { if (content.StateType != StateType.End) { _lastStep = content; } //return; } _continueDebugDispatch = false; if (content.IsFinalStep()) { _allDebugReceived = true; _continueDebugDispatch = true; } if (QueuePending(content)) { return; } // BUG 9735 - 2013.06.22 - TWR : refactored AddItemToTree(content); }
public DebugOutputViewModel(IEventPublisher serverEventPublisher, IEnvironmentRepository environmentRepository, IDebugOutputFilterStrategy debugOutputFilterStrategy) { VerifyArgument.IsNotNull("serverEventPublisher", serverEventPublisher); VerifyArgument.IsNotNull("environmentRepository", environmentRepository); VerifyArgument.IsNotNull("debugOutputFilterStrategy", debugOutputFilterStrategy); _environmentRepository = environmentRepository; _debugOutputFilterStrategy = debugOutputFilterStrategy; _contentItems = new List <IDebugState>(); _contentItemMap = new Dictionary <Guid, IDebugTreeViewItemViewModel>(); _debugWriterSubscriptionService = new SubscriptionService <DebugWriterWriteMessage>(serverEventPublisher); _debugWriterSubscriptionService.Subscribe(msg => { IDebugState debugState = msg.DebugState; Append(debugState); }); SessionID = Guid.NewGuid(); }
// BUG 9706 - 2013.06.22 - TWR : extracted from DsfNativeActivity.DispatchDebugState public void Write(IDebugState debugState, bool isRemoteInvoke = false, string remoteInvokerId = null, string parentInstanceId = null, IList <IDebugState> remoteDebugItems = null) { if (debugState == null) { return; } // Serialize debugState to a local repo so calling server can manage the data if (isRemoteInvoke) { RemoteDebugMessageRepo.Instance.AddDebugItem(remoteInvokerId, debugState); return; } // local dispatch // do we have any remote objects to dispatch locally? if (remoteDebugItems != null) { Guid parentId; Guid.TryParse(parentInstanceId, out parentId); foreach (var item in remoteDebugItems) { // re-jigger it so it will dispatch and display item.WorkspaceID = debugState.WorkspaceID; item.OriginatingResourceID = debugState.OriginatingResourceID; // item.Server = remoteInvokerId; Guid remoteEnvironmentId; if (Guid.TryParse(remoteInvokerId, out remoteEnvironmentId)) { item.EnvironmentID = remoteEnvironmentId; } if (item.ParentID == Guid.Empty) { item.ParentID = parentId; } QueueWrite(item); } remoteDebugItems.Clear(); } Dev2Logger.Log.Debug(string.Format("EnvironmentID: {0} Debug:{1}", debugState.EnvironmentID, debugState.DisplayName)); QueueWrite(debugState); }
/// <summary> /// Adds the debug item. /// </summary> /// <param name="remoteInvokeID">The remote invoke ID.</param> /// <param name="ds">The ds.</param> public void AddDebugItem(string remoteInvokeID, IDebugState ds) { Guid id; Guid.TryParse(remoteInvokeID, out id); if(id != Guid.Empty) { lock(Lock) { IList<IDebugState> list; if(_data.TryGetValue(id, out list)) { if(list.Contains(ds)) return; list.Add(ds); } else { list = new List<IDebugState> { ds }; _data[id] = list; } } } }
IDebugTreeViewItemViewModel CreateChildTreeViewItem(IDebugState content) { IDebugTreeViewItemViewModel child; if (content.StateType == StateType.Message) { child = new DebugStringTreeViewItemViewModel { Content = content.Message, ActivityTypeName = content.ActualType }; } else { child = new DebugStateTreeViewItemViewModel(ServerRepository) { Content = content, ActivityTypeName = content.ActualType }; } return(child); }
public static WorkSurfaceKey CreateKey(IDebugState debugState) { var origin = debugState.WorkspaceID; if (origin != Guid.Empty) { IServer server = ServerRepository.Instance.FindSingle(model => model.Connection.WorkspaceID == origin); Guid environmentID = server.EnvironmentID; return(new WorkSurfaceKey { WorkSurfaceContext = WorkSurfaceContext.Workflow, ResourceID = debugState.OriginatingResourceID, ServerID = debugState.ServerID, EnvironmentID = environmentID }); } return(new WorkSurfaceKey { WorkSurfaceContext = WorkSurfaceContext.Workflow, ResourceID = debugState.OriginatingResourceID, ServerID = debugState.ServerID, }); }
private bool AddErrorToParent(IDebugState content, IDebugTreeViewItemViewModel child, IDebugTreeViewItemViewModel parent) { if (!child.HasError.GetValueOrDefault(false)) { return(false); } var theParent = parent as DebugStateTreeViewItemViewModel; if (theParent == null) { return(true); } theParent.AppendError(content.ErrorMessage); theParent.HasError = true; var childState = child as DebugStateTreeViewItemViewModel; if (childState?.AssertResultList != null && childState.AssertResultList.Count > 0 && IsTestView) { foreach (var listItem in childState.AssertResultList) { var lineItem = listItem as DebugLine; if (lineItem?.LineItems != null) { foreach (var lineItemLineItem in lineItem.LineItems) { var line = lineItemLineItem as DebugLineItem; if (line != null && line.TestStepHasError) { theParent.AppendError(line.Value); } } } } } return(false); }
public StyleSheetPackage(string name, IList<IAsset> assets, IStyleSheetProcessor processor, IDebugState debugState) : base(name, assets, processor, debugState) { }
public void DispatchDebugState(IDSFDataObject dataObject, StateType stateType) { Guid remoteID; Guid.TryParse(dataObject.RemoteInvokerID, out remoteID); if (stateType == StateType.Before) { if (_debugState == null) { InitializeDebugState(stateType, dataObject, remoteID, false, ""); } if (_debugState != null) { // Bug 8595 - Juries var type = GetType(); var instance = Activator.CreateInstance(type); var activity = instance as Activity; if (activity != null) { _debugState.Name = activity.DisplayName; } var act = instance as DsfActivity; //End Bug 8595 try { Copy(GetDebugInputs(dataObject.Environment), _debugState.Inputs); } catch (Exception err) { Dev2Logger.Log.Error("DispatchDebugState", err); AddErrorToDataList(err, dataObject); var errorMessage = dataObject.Environment.FetchErrors(); _debugState.ErrorMessage = errorMessage; _debugState.HasError = true; var debugError = err as DebugCopyException; if (debugError != null) { _debugState.Inputs.Add(debugError.Item); } } if (dataObject.RemoteServiceType == "Workflow" && act != null && !_debugState.HasError) { var debugItem = new DebugItem(); var debugItemResult = new DebugItemResult { Type = DebugItemResultType.Value, Label = "Execute workflow asynchronously: ", Value = dataObject.RunWorkflowAsync ? "True" : "False" }; debugItem.Add(debugItemResult); _debugState.Inputs.Add(debugItem); } } } else { bool hasError = dataObject.Environment.HasErrors(); var errorMessage = String.Empty; if (hasError) { errorMessage = string.Join(Environment.NewLine, dataObject.Environment.Errors); } if (_debugState == null) { InitializeDebugState(stateType, dataObject, remoteID, hasError, errorMessage); } if (_debugState != null) { _debugState.NumberOfSteps = IsWorkflow ? dataObject.NumberOfSteps : 0; _debugState.StateType = stateType; _debugState.EndTime = DateTime.Now; _debugState.HasError = hasError; _debugState.ErrorMessage = errorMessage; try { if (dataObject.RunWorkflowAsync && !_debugState.HasError) { var debugItem = new DebugItem(); var debugItemResult = new DebugItemResult { Type = DebugItemResultType.Value, Value = "Asynchronous execution started" }; debugItem.Add(debugItemResult); _debugState.Outputs.Add(debugItem); _debugState.NumberOfSteps = 0; } else { Copy(GetDebugOutputs(dataObject.Environment), _debugState.Outputs); } } catch (Exception e) { Dev2Logger.Log.Error("Debug Dispatch Error", e); AddErrorToDataList(e, dataObject); errorMessage = dataObject.Environment.FetchErrors(); _debugState.ErrorMessage = errorMessage; _debugState.HasError = true; } } } if (_debugState != null && (!(_debugState.ActivityType == ActivityType.Workflow || _debugState.Name == "DsfForEachActivity") && remoteID == Guid.Empty)) { _debugState.StateType = StateType.All; // Only dispatch 'before state' if it is a workflow or for each activity or a remote activity ;) if (stateType == StateType.Before) { return; } } // We know that if a if it is not a workflow it must be a service ;) if (dataObject.RemoteServiceType != "Workflow" && !String.IsNullOrWhiteSpace(dataObject.RemoteServiceType)) { if (_debugState != null) { _debugState.ActivityType = ActivityType.Service; } } if (_debugState != null) { if (remoteID == Guid.Empty) { switch (_debugState.StateType) { case StateType.Before: _debugState.Outputs.Clear(); break; case StateType.After: _debugState.Inputs.Clear(); break; } } // BUG 9706 - 2013.06.22 - TWR : refactored from here to DebugDispatcher _debugState.ClientID = dataObject.ClientID; _debugState.OriginatingResourceID = dataObject.ResourceID; _debugDispatcher.Write(_debugState, dataObject.RemoteInvoke, dataObject.RemoteInvokerID, dataObject.ParentInstanceID, dataObject.RemoteDebugItems); if (stateType == StateType.After) { // Free up debug state _debugState = null; } } }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <returns> /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false. /// </returns> /// <param name="other">An object to compare with this object.</param> public bool Equals(IDebugState other) { if(ReferenceEquals(null, other)) { return false; } if(ReferenceEquals(this, other)) { return true; } return ID.Equals(other.ID) && SessionID.Equals(other.SessionID); }
/// <summary> /// Initializes a new instance of the <see cref="T:System.Object"/> class. /// </summary> public DebugWriterWriteMessage(IDebugState debugState) { DebugState = debugState; }
// BUG 9706 - 2013.06.22 - TWR : extracted from DsfNativeActivity.DispatchDebugState public void Write(IDebugState debugState, bool isRemoteInvoke = false, string remoteInvokerId = null, string parentInstanceId = null, IList<IDebugState> remoteDebugItems = null) { if(debugState == null) { return; } // Serialize debugState to a local repo so calling server can manage the data if(isRemoteInvoke) { RemoteDebugMessageRepo.Instance.AddDebugItem(remoteInvokerId, debugState); return; } // local dispatch // do we have any remote objects to dispatch locally? if(remoteDebugItems != null) { Guid parentId; Guid.TryParse(parentInstanceId, out parentId); foreach(var item in remoteDebugItems) { // re-jigger it so it will dispatch and display item.WorkspaceID = debugState.WorkspaceID; item.OriginatingResourceID = debugState.OriginatingResourceID; // item.Server = remoteInvokerId; Guid remoteEnvironmentId; if(Guid.TryParse(remoteInvokerId, out remoteEnvironmentId)) { item.EnvironmentID = remoteEnvironmentId; } if(item.ParentID == Guid.Empty) { item.ParentID = parentId; } QueueWrite(item); } remoteDebugItems.Clear(); } Dev2Logger.Log.Debug(string.Format("EnvironmentID: {0} Debug:{1}", debugState.EnvironmentID, debugState.DisplayName)); QueueWrite(debugState); }
/// <summary> /// Writes the given state. /// <remarks> /// This must implement the one-way (fire and forget) message exchange pattern. /// </remarks> /// </summary> /// <param name="debugState">The state to be written.</param> public void Write(IDebugState debugState) { SendDebugState(debugState as DebugState); }
/// <summary> /// Initializes a new instance of the <see cref="T:System.Object"/> class. /// </summary> public DebugWriterWriteMessage(IDebugState debugState) { DebugState = debugState; }
public CachedPackage(IPackage package, IDebugState debugState) { this.package = package; this.debugState = debugState; }
private static IEnumerable <TestRunResult> GetTestRunResults(IDSFDataObject dataObject, IServiceTestOutput output, Dev2DecisionFactory factory, IDebugState debugState) { if (output == null) { var testResult = new TestRunResult { RunTestResult = RunResult.None }; return(new List <TestRunResult> { testResult }); } if (string.IsNullOrEmpty(output.Variable) && string.IsNullOrEmpty(output.Value)) { var testResult = new TestRunResult { RunTestResult = RunResult.None }; output.Result = testResult; return(new List <TestRunResult> { testResult }); } if (output.Result != null) { output.Result.RunTestResult = RunResult.TestInvalid; } if (string.IsNullOrEmpty(output.Variable)) { var testResult = new TestRunResult { RunTestResult = RunResult.TestInvalid, Message = Messages.Test_NothingToAssert }; output.Result = testResult; if (dataObject.IsDebugMode()) { var debugItemStaticDataParams = new DebugItemServiceTestStaticDataParams(testResult.Message, true); DebugItem itemToAdd = new DebugItem(); itemToAdd.AddRange(debugItemStaticDataParams.GetDebugItemResult()); debugState.AssertResultList.Add(itemToAdd); } return(new List <TestRunResult> { testResult }); } IFindRecsetOptions opt = FindRecsetOptions.FindMatch(output.AssertOp); var decisionType = DecisionDisplayHelper.GetValue(output.AssertOp); var value = new List <DataStorage.WarewolfAtom> { DataStorage.WarewolfAtom.NewDataString(output.Value) }; var from = new List <DataStorage.WarewolfAtom> { DataStorage.WarewolfAtom.NewDataString(output.From) }; var to = new List <DataStorage.WarewolfAtom> { DataStorage.WarewolfAtom.NewDataString(output.To) }; IList <TestRunResult> ret = new List <TestRunResult>(); var iter = new WarewolfListIterator(); var cols1 = dataObject.Environment.EvalAsList(DataListUtil.AddBracketsToValueIfNotExist(output.Variable), 0); var c1 = new WarewolfAtomIterator(cols1); var c2 = new WarewolfAtomIterator(value); var c3 = new WarewolfAtomIterator(@from); if (opt.ArgumentCount > 2) { c2 = new WarewolfAtomIterator(to); } iter.AddVariableToIterateOn(c1); iter.AddVariableToIterateOn(c2); iter.AddVariableToIterateOn(c3); while (iter.HasMoreData()) { var val1 = iter.FetchNextValue(c1); var val2 = iter.FetchNextValue(c2); var val3 = iter.FetchNextValue(c3); var assertResult = factory.FetchDecisionFunction(decisionType).Invoke(new[] { val1, val2, val3 }); var testResult = new TestRunResult(); if (assertResult) { testResult.RunTestResult = RunResult.TestPassed; } else { testResult.RunTestResult = RunResult.TestFailed; var msg = DecisionDisplayHelper.GetFailureMessage(decisionType); var actMsg = string.Format(msg, val2, output.Variable, val1, val3); testResult.Message = new StringBuilder(testResult.Message).AppendLine(actMsg).ToString(); } if (dataObject.IsDebugMode()) { var msg = testResult.Message; if (testResult.RunTestResult == RunResult.TestPassed) { msg = Messages.Test_PassedResult; } var hasError = testResult.RunTestResult == RunResult.TestFailed; var debugItemStaticDataParams = new DebugItemServiceTestStaticDataParams(msg, hasError); DebugItem itemToAdd = new DebugItem(); itemToAdd.AddRange(debugItemStaticDataParams.GetDebugItemResult()); if (debugState.AssertResultList != null) { bool addItem = debugState.AssertResultList.Select(debugItem => debugItem.ResultsList.Where(debugItemResult => debugItemResult.Value == Messages.Test_PassedResult)).All(debugItemResults => !debugItemResults.Any()); if (addItem) { debugState.AssertResultList.Add(itemToAdd); } } } output.Result = testResult; ret.Add(testResult); } return(ret); }
public bool Equals(IDebugState other) { if(other == null) { return false; } return ID == other.ID && SessionID == other.SessionID; }
private static void UpdateDebugStateWithAssertion(IDSFDataObject dataObject, IServiceTestStep stepToBeAsserted, IDebugState debugState) { if (debugState != null) { var factory = Dev2DecisionFactory.Instance(); var res = stepToBeAsserted.StepOutputs.SelectMany(output => GetTestRunResults(dataObject, output, factory, debugState)); var testRunResults = res as IList <TestRunResult> ?? res.ToList(); var testPassed = testRunResults.All(result => result.RunTestResult == RunResult.TestPassed || result.RunTestResult == RunResult.None); var serviceTestFailureMessage = string.Join("", testRunResults.Select(result => result.Message)); UpdateBasedOnFinalResult(dataObject, stepToBeAsserted, testPassed, testRunResults, serviceTestFailureMessage); } }
public void Write(IDebugState debugState, bool isTestExecution, bool isDebugFromWeb, string testName, bool isRemoteInvoke = false, string remoteInvokerId = null, string parentInstanceId = null, IList <IDebugState> remoteDebugItems = null) { if (debugState == null) { return; } if (isTestExecution) { TestDebugMessageRepo.Instance.AddDebugItem(debugState.SourceResourceID, testName, debugState); return; } if (isDebugFromWeb) { WebDebugMessageRepo.Instance.AddDebugItem(debugState.ClientID, debugState.SessionID, debugState); return; } if (isRemoteInvoke) { RemoteDebugMessageRepo.Instance.AddDebugItem(remoteInvokerId, debugState); return; } if (remoteDebugItems != null) { Guid parentId; Guid.TryParse(parentInstanceId, out parentId); foreach (var item in remoteDebugItems) { item.WorkspaceID = debugState.WorkspaceID; item.OriginatingResourceID = debugState.OriginatingResourceID; item.ClientID = debugState.ClientID; Guid remoteEnvironmentId; if (Guid.TryParse(remoteInvokerId, out remoteEnvironmentId)) { item.EnvironmentID = remoteEnvironmentId; } if (item.ParentID == Guid.Empty) { item.ParentID = parentId; } QueueWrite(item); } remoteDebugItems.Clear(); } Dev2Logger.Debug($"EnvironmentID: {debugState.EnvironmentID} Debug:{debugState.DisplayName}"); QueueWrite(debugState); if (debugState.IsFinalStep()) { IDebugWriter writer; if ((writer = Instance.Get(debugState.WorkspaceID)) != null) { var allDebugStates = DebugMessageRepo.Instance.FetchDebugItems(debugState.ClientID, debugState.SessionID); foreach (var state in allDebugStates) { var serializeObject = JsonConvert.SerializeObject(state, SerializerSettings); writer.Write(serializeObject); } } } }
public static WorkSurfaceKey CreateKey(IDebugState debugState) { var origin = debugState.WorkspaceID; if(origin != Guid.Empty) { IEnvironmentModel environmentModel = EnvironmentRepository.Instance.FindSingle(model => model.Connection.WorkspaceID == origin); Guid environmentID = environmentModel.ID; return new WorkSurfaceKey { WorkSurfaceContext = WorkSurfaceContext.Workflow, ResourceID = debugState.OriginatingResourceID, ServerID = debugState.ServerID, EnvironmentID = environmentID }; } return new WorkSurfaceKey { WorkSurfaceContext = WorkSurfaceContext.Workflow, ResourceID = debugState.OriginatingResourceID, ServerID = debugState.ServerID, }; }
public IServiceTestStep AddDebugItemTestStep(IDebugState debugItemContent, ObservableCollection <IServiceTestOutput> serviceTestOutputs) => AddTestStep(debugItemContent.ID.ToString(), debugItemContent.DisplayName, debugItemContent.ActualType, serviceTestOutputs, StepType.Assert);
public void AddItemToTree(IDebugState content) { if (_contentItems.Any(a => a.DisconnectedID == content.DisconnectedID)) { return; } if (content.StateType == StateType.Duration) { var item = _contentItems.FirstOrDefault(a => a.WorkSurfaceMappingId == content.WorkSurfaceMappingId); if (item != null) { item.EndTime = content.EndTime; } } else { var environmentId = content.EnvironmentID; var isRemote = environmentId != Guid.Empty; if (isRemote) { var remoteEnvironmentModel = _serverRepository.FindSingle(model => model.EnvironmentID == environmentId); if (remoteEnvironmentModel != null) { ConnectRemoteServer(content, remoteEnvironmentModel); } if (remoteEnvironmentModel != null && content.ParentID.GetValueOrDefault() != Guid.Empty && remoteEnvironmentModel.AuthorizationService != null && !remoteEnvironmentModel.AuthorizationService.GetResourcePermissions(content.OriginatingResourceID).HasFlag(Permissions.View)) { return; } } var debugState = _contentItems.FirstOrDefault(state => state.DisconnectedID == content.DisconnectedID); if (debugState == null) { _contentItems.Add(content); } else { return; } lock (_syncContext) { if (_isRebuildingTree) { return; } } var application = Application.Current; if (application != null) { var dispatcher = application.Dispatcher; var contentToDispatch = content; if (dispatcher != null && dispatcher.CheckAccess()) { dispatcher.Invoke(() => AddItemToTreeImpl(contentToDispatch)); } } else { AddItemToTreeImpl(content); } } }
// BUG 9735 - 2013.06.22 - TWR : refactored void AddItemToTree(IDebugState content) { if (content.StateType == StateType.Duration) { var item = _contentItems.FirstOrDefault(a => a.WorkSurfaceMappingId == content.WorkSurfaceMappingId); if (item != null) { item.EndTime = content.EndTime; //RebuildTree(); } } else { var environmentId = content.EnvironmentID; var isRemote = environmentId != Guid.Empty; if (isRemote) { Thread.Sleep(500); } if (isRemote) { var remoteEnvironmentModel = _environmentRepository.FindSingle(model => model.ID == environmentId); if (remoteEnvironmentModel != null) { if (content.Server == "localhost") { content.Server = remoteEnvironmentModel.Name; } if (!remoteEnvironmentModel.IsConnected) { remoteEnvironmentModel.Connect(); } if (content.ParentID != Guid.Empty) { if (remoteEnvironmentModel.AuthorizationService != null) { var remoteResourcePermissions = remoteEnvironmentModel.AuthorizationService.GetResourcePermissions(content.OriginatingResourceID); if (!remoteResourcePermissions.HasFlag(Permissions.View)) { return; } } } } } _contentItems.Add(content); lock (_syncContext) { if (_isRebuildingTree) { return; } } var application = Application.Current; if (application != null) { var dispatcher = application.Dispatcher; var contentToDispatch = content; if (dispatcher != null && dispatcher.CheckAccess()) { dispatcher.Invoke(() => AddItemToTreeImpl(contentToDispatch)); } } else { AddItemToTreeImpl(content); } } }
/// <summary> /// Writes the given state. /// <remarks> /// This must implement the one-way (fire and forget) message exchange pattern. /// </remarks> /// </summary> /// <param name="debugState">The state to be written.</param> public void Write(IDebugState debugState) { DebugStates.Add(debugState); }
public override void Append(IDebugState content) { Appended = true; }
public void AppendX(IDebugState content) { content.SessionID = SessionID; Append(content); }
/// <summary> /// Writes the given state. /// <remarks> /// This must implement the one-way (fire and forget) message exchange pattern. /// </remarks> /// </summary> /// <param name="debugState">The state to be written.</param> public void Write(IDebugState debugState) { DebugStates.Add(debugState); }
void AddItemToTreeImpl(IDebugState content) { if ((DebugStatus == DebugStatus.Stopping || DebugStatus == DebugStatus.Finished || _allDebugReceived) && string.IsNullOrEmpty(content.Message) && !_continueDebugDispatch && !_dispatchLastDebugState) { return; } Dev2Logger.Log.Debug(string.Format("Debug content to be added ID: {0}" + Environment.NewLine + "Parent ID: {1}" + Environment.NewLine + "Name: {2}", content.ID, content.ParentID, content.DisplayName)); if (_lastStep != null && DebugStatus == DebugStatus.Finished && content.StateType == StateType.Message) { var lastDebugStateProcessed = _lastStep; _lastStep = null; _dispatchLastDebugState = true; AddItemToTreeImpl(new DebugState { StateType = StateType.Message, Message = Resources.CompilerMessage_ExecutionInterrupted, ParentID = lastDebugStateProcessed.ParentID }); AddItemToTreeImpl(lastDebugStateProcessed); _dispatchLastDebugState = false; } if (!string.IsNullOrWhiteSpace(SearchText) && !_debugOutputFilterStrategy.Filter(content, SearchText)) { return; } if (content.StateType == StateType.Message && content.ParentID == Guid.Empty) { RootItems.Add(new DebugStringTreeViewItemViewModel { Content = content.Message }); } else { var isRootItem = content.ParentID == Guid.Empty || content.ID == content.ParentID; IDebugTreeViewItemViewModel child; if (content.StateType == StateType.Message) { child = new DebugStringTreeViewItemViewModel { Content = content.Message }; } else { child = new DebugStateTreeViewItemViewModel(EnvironmentRepository) { Content = content }; } if (!_contentItemMap.ContainsKey(content.ID)) { _contentItemMap.Add(content.ID, child); } if (isRootItem) { RootItems.Add(child); } else { IDebugTreeViewItemViewModel parent; if (!_contentItemMap.TryGetValue(content.ParentID, out parent)) { parent = new DebugStateTreeViewItemViewModel(EnvironmentRepository); _contentItemMap.Add(content.ParentID, parent); } child.Parent = parent; parent.Children.Add(child); if (child.HasError.GetValueOrDefault(false)) { var theParent = parent as DebugStateTreeViewItemViewModel; if (theParent == null) { return; } theParent.AppendError(content.ErrorMessage); theParent.HasError = true; } } } if (content.IsFinalStep()) { DebugStatus = DebugStatus.Finished; } }
public DotLessStyleSheetProcessor(string appPath, IDebugState debugState) { this.appPath = appPath; this.debugState = debugState; }
public JavaScriptPackage(string name, IList<IAsset> assets, IJavaScriptProcessor processor, IDebugState debugState, TemplateConfiguration configuration) : base(name, assets, processor, debugState) { this.InitializeTemplateAssets(configuration); }
// BUG 9706 - 2013.06.22 - TWR : refactored static void QueueWrite(IDebugState debugState) { if(debugState != null) { lock(WaitHandleGuard) { WriterQueue.Enqueue(debugState); WriteWaithandle.Set(); } } }
/// <summary> /// Filters the specified content. /// </summary> /// <param name="content">The content.</param> /// <param name="filterText"></param> public bool Filter(object content, string filterText) { if (filterText == null) { return(false); } filterText = filterText.ToLower(); IDebugState debugState = content as IDebugState; if (debugState != null) { string convertedActivityType = Convert.ToString(_enumToStringConverter.Convert(debugState.ActivityType, null, null, null)); if (convertedActivityType.ToLower().Contains(filterText)) { return(true); } if (debugState.ActivityType.ToString().ToLower().Contains(filterText)) { return(true); } if (debugState.DisplayName != null && debugState.DisplayName.ToLower().Contains(filterText)) { return(true); } if (debugState.ActivityType == ActivityType.Step && debugState.Name != null && debugState.Name.ToLower().Contains(filterText)) { return(true); } if (debugState.ActivityType == ActivityType.Workflow && debugState.Server != null && debugState.Server.ToLower().Contains(filterText)) { return(true); } if (debugState.Version != null && debugState.Version.ToLower().Contains(filterText)) { return(true); } if (debugState.ActivityType == ActivityType.Step) { string convertedDuration = Convert.ToString(_timeSpanToStringConverter.Convert(debugState.Duration, null, null, null)); if (convertedDuration.ToLower().Contains(filterText)) { return(true); } } if (debugState.ActivityType == ActivityType.Workflow) { string convertedStartTime = Convert.ToString(_dateTimeToStringConverter.Convert(debugState.StartTime, null, null, null)); if (debugState.StateType == StateType.Before && convertedStartTime.ToLower().Contains(filterText)) { return(true); } string convertedEndTime = Convert.ToString(_dateTimeToStringConverter.Convert(debugState.EndTime, null, null, null)); if (debugState.StateType == StateType.After && convertedEndTime.ToLower().Contains(filterText)) { return(true); } } if (debugState.Inputs != null && debugState.Inputs.Any(o => o.Contains(filterText))) { return(true); } if (debugState.Outputs != null && debugState.Outputs.Any(o => o.Contains(filterText))) { return(true); } } else if (content is string && content.ToString().ToLower().Contains(filterText)) { return(true); } return(false); }
public PageBasedHttpCacheHandler(IDebugState debugState, OutputCacheParameters cacheParams) { this.debugState = debugState; this.cacheParams = cacheParams; }
public CachedTagRenderer(ITagRenderer renderer, IDebugState debugState) { this.renderer = renderer; this.debugState = debugState; }