public RunnerPage(GingerRunner runner, bool Viewmode = false) { InitializeComponent(); mRunner = runner; ViewMode1 = Viewmode; GingerWPF.BindingLib.ControlsBinding.ObjFieldBinding(xBusinessflowsTotalCount, Label.ContentProperty, mRunner, nameof(GingerRunner.TotalBusinessflow)); GingerWPF.BindingLib.ControlsBinding.ObjFieldBinding(xStatus, StatusItem.StatusProperty, mRunner, nameof(GingerRunner.Status), BindingMode.OneWay); GingerWPF.BindingLib.ControlsBinding.ObjFieldBinding(xStatusLabel, ImageMakerControl.ImageTypeProperty, mRunner, nameof(GingerRunner.Status), BindingMode.OneWay, bindingConvertor: new StatusIconConverter()); GingerWPF.BindingLib.ControlsBinding.ObjFieldBinding(xRunnerActive, ucButton.ButtonImageTypeProperty, mRunner, nameof(GingerRunner.Active), BindingMode.TwoWay, bindingConvertor: new ActiveIconConverter()); UpdateRunnerInfo(); if (Viewmode) { pageGrid.IsEnabled = false; } // FIXME !!!!!!!!!!!!!!!!!!!!!!! // mRunner.RunnerExecutionWatch.dispatcherTimerElapsed.Tick += dispatcherTimerElapsedTick; UpdateExecutionStats(); mRunner.GingerRunnerEvent += MRunner_GingerRunnerEvent; }
// remove to GinngerRunner.SetBFOfflineData public bool OfflineBusinessFlowExecutionLog(BusinessFlow businessFlow, string logFolderPath) { try { //handle root directory if (Directory.Exists(logFolderPath)) { executionLoggerHelper.CleanDirectory(logFolderPath); } else { Directory.CreateDirectory(logFolderPath); } GingerRunner Gr = new GingerRunner(); mCurrentBusinessFlow = businessFlow; businessFlow.OffilinePropertiesPrep(logFolderPath); System.IO.Directory.CreateDirectory(businessFlow.ExecutionLogFolder); foreach (Activity activity in businessFlow.Activities) { ActivitiesGroup currentActivityGroup = businessFlow.ActivitiesGroups.Where(x => x.ActivitiesIdentifiers.Select(z => z.ActivityGuid).ToList().Contains(activity.Guid)).FirstOrDefault(); if (currentActivityGroup != null) { currentActivityGroup.ExecutionLogFolder = logFolderPath; switch (currentActivityGroup.ExecutionLoggerStatus) { case executionLoggerStatus.NotStartedYet: ActivityGroupStart(meventtime, currentActivityGroup); break; } } Gr.CalculateActivityFinalStatus(activity); if (activity.GetType() == typeof(IErrorHandler)) { continue; } if (activity.Status != Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed && activity.Status != Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed && activity.Status != Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped) { continue; } mCurrentActivity = activity; activity.OfflinePropertiesPrep(businessFlow.ExecutionLogFolder, businessFlow.ExecutionLogActivityCounter, ExtensionMethods.folderNameNormalazing(activity.ActivityName)); System.IO.Directory.CreateDirectory(activity.ExecutionLogFolder); foreach (Act action in activity.Acts) { if (action.Status != Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed && action.Status != Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed && action.Status != Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped && action.Status != Amdocs.Ginger.CoreNET.Execution.eRunStatus.FailIgnored) { continue; } activity.ExecutionLogActionCounter++; action.ExecutionLogFolder = Path.Combine(activity.ExecutionLogFolder, activity.ExecutionLogActionCounter + " " + ExtensionMethods.folderNameNormalazing(action.Description)); System.IO.Directory.CreateDirectory(action.ExecutionLogFolder); ActionEnd(meventtime, action, true); } ActivityEnd(meventtime, activity, true); businessFlow.ExecutionLogActivityCounter++; } Gr.SetActivityGroupsExecutionStatus(businessFlow, true); Gr.CalculateBusinessFlowFinalStatus(businessFlow); BusinessFlowEnd(meventtime, businessFlow, true); businessFlow.ExecutionLogFolder = string.Empty; return(true); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Execution Logger Failed to do Offline BusinessFlow Execution Log", ex); return(false); } }
public void InitRunner(GingerRunner runner) { //Configure Runner for execution runner.Status = eRunStatus.Pending; ConfigureRunnerForExecution(runner); //Set the Apps agents foreach (ApplicationAgent appagent in runner.ApplicationAgents.ToList()) { if (appagent.AgentName != null) { ObservableList <Agent> agents = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>(); appagent.Agent = (from a in agents where a.Name == appagent.AgentName select a).FirstOrDefault(); } } //Load the biz flows ObservableList <BusinessFlow> runnerFlows = new ObservableList <BusinessFlow>(); foreach (BusinessFlowRun businessFlowRun in runner.BusinessFlowsRunList.ToList()) { ObservableList <BusinessFlow> businessFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>(); BusinessFlow businessFlow = (from x in businessFlows where x.Guid == businessFlowRun.BusinessFlowGuid select x).FirstOrDefault(); //Fail over to try and find by name if (businessFlow == null) { businessFlow = (from x in businessFlows where x.Name == businessFlowRun.BusinessFlowName select x).FirstOrDefault(); } if (businessFlow == null) { Reporter.ToLog(eLogLevel.ERROR, string.Format("Can not find the '{0}' {1} for the '{2}' {3}", businessFlowRun.BusinessFlowName, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), mRunSetConfig.Name, GingerDicser.GetTermResValue(eTermResKey.RunSet))); continue; } else { // Very slow BusinessFlow BFCopy = (BusinessFlow)businessFlow.CreateCopy(false); BFCopy.ContainingFolder = businessFlow.ContainingFolder; BFCopy.Reset(); BFCopy.Active = businessFlowRun.BusinessFlowIsActive; BFCopy.Mandatory = businessFlowRun.BusinessFlowIsMandatory; if (businessFlowRun.BusinessFlowInstanceGuid == Guid.Empty) { BFCopy.InstanceGuid = Guid.NewGuid(); } else { BFCopy.InstanceGuid = businessFlowRun.BusinessFlowInstanceGuid; } if (businessFlowRun.BusinessFlowCustomizedRunVariables != null && businessFlowRun.BusinessFlowCustomizedRunVariables.Count > 0) { foreach (VariableBase varb in BFCopy.GetBFandActivitiesVariabeles(true)) { VariableBase runVar = businessFlowRun.BusinessFlowCustomizedRunVariables.Where(v => v.ParentGuid == varb.ParentGuid && v.ParentName == varb.ParentName && v.Name == varb.Name).FirstOrDefault(); if (runVar == null)//for supporting dynamic run set XML in which we do not have GUID { runVar = businessFlowRun.BusinessFlowCustomizedRunVariables.Where(v => v.ParentName == varb.ParentName && v.Name == varb.Name).FirstOrDefault(); if (runVar == null) { runVar = businessFlowRun.BusinessFlowCustomizedRunVariables.Where(v => v.Name == varb.Name).FirstOrDefault(); } } if (runVar != null) { RepositoryItemBase.ObjectsDeepCopy(runVar, varb); varb.DiffrentFromOrigin = runVar.DiffrentFromOrigin; varb.MappedOutputVariable = runVar.MappedOutputVariable; } else { varb.DiffrentFromOrigin = false; varb.MappedOutputVariable = null; } } } BFCopy.RunDescription = businessFlowRun.BusinessFlowRunDescription; BFCopy.BFFlowControls = businessFlowRun.BFFlowControls; runnerFlows.Add(BFCopy); } } runner.IsUpdateBusinessFlowRunList = true; runner.BusinessFlows = runnerFlows; }
public void InitRunner(GingerRunner runner) { //Configure Runner for execution runner.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Pending; ConfigureRunnerForExecution(runner); //Set the Apps agents foreach (ApplicationAgent p in runner.ApplicationAgents) { if (p.AgentName != null) { p.Agent = (from a in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>() where a.Name == p.AgentName select a).FirstOrDefault(); } } //Load the biz flows runner.BusinessFlows.Clear(); foreach (BusinessFlowRun bf in runner.BusinessFlowsRunList) { ObservableList <BusinessFlow> businessFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>(); BusinessFlow BF1 = (from bfr in businessFlows where bfr.Guid == bf.BusinessFlowGuid select bfr).FirstOrDefault(); if (BF1 == null) { BF1 = (from bfr in businessFlows where bfr.Name == bf.BusinessFlowName select bfr).FirstOrDefault(); } if (BF1 == null) { Reporter.ToUser(eUserMsgKeys.CannontFindBusinessFlow, bf.BusinessFlowName); continue; } else { // Very slow BusinessFlow BFCopy = (BusinessFlow)BF1.CreateCopy(false); BFCopy.Reset(); BFCopy.Active = bf.BusinessFlowIsActive; BFCopy.Mandatory = bf.BusinessFlowIsMandatory; BFCopy.AttachActivitiesGroupsAndActivities(); if (bf.BusinessFlowInstanceGuid == Guid.Empty) { BFCopy.InstanceGuid = Guid.NewGuid(); } else { BFCopy.InstanceGuid = bf.BusinessFlowInstanceGuid; } if (bf.BusinessFlowCustomizedRunVariables != null && bf.BusinessFlowCustomizedRunVariables.Count > 0) { foreach (VariableBase varb in BFCopy.GetBFandActivitiesVariabeles(true)) { VariableBase runVar = bf.BusinessFlowCustomizedRunVariables.Where(v => v.ParentGuid == varb.ParentGuid && v.ParentName == varb.ParentName && v.Name == varb.Name).FirstOrDefault(); if (runVar != null) { RepositoryItemBase.ObjectsDeepCopy(runVar, varb); varb.DiffrentFromOrigin = runVar.DiffrentFromOrigin; varb.MappedOutputVariable = runVar.MappedOutputVariable; } else { varb.DiffrentFromOrigin = false; varb.MappedOutputVariable = null; } } } BFCopy.RunDescription = bf.BusinessFlowRunDescription; BFCopy.BFFlowControls = bf.BFFlowControls; runner.BusinessFlows.Add(BFCopy); } } }
public void InitRunner(GingerRunner runner, GingerExecutionEngine ExecutorEngine) { //Configure Runner for execution runner.Status = eRunStatus.Pending; runner.Executor = ExecutorEngine; ConfigureRunnerForExecution((GingerExecutionEngine)runner.Executor); //Set the Apps agents foreach (ApplicationAgent appagent in runner.ApplicationAgents.ToList()) { if (appagent.AgentName != null) { ObservableList <Agent> agents = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>(); appagent.Agent = (from a in agents where a.Name == appagent.AgentName select a).FirstOrDefault(); } } //Load the biz flows ObservableList <BusinessFlow> runnerFlows = new ObservableList <BusinessFlow>(); foreach (BusinessFlowRun businessFlowRun in runner.BusinessFlowsRunList.ToList()) { ObservableList <BusinessFlow> businessFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>(); BusinessFlow businessFlow = (from x in businessFlows where x.Guid == businessFlowRun.BusinessFlowGuid select x).FirstOrDefault(); //Fail over to try and find by name if (businessFlow == null) { businessFlow = (from x in businessFlows where x.Name == businessFlowRun.BusinessFlowName select x).FirstOrDefault(); } if (businessFlow == null) { Reporter.ToLog(eLogLevel.ERROR, string.Format("Can not find the '{0}' {1} for the '{2}' {3}", businessFlowRun.BusinessFlowName, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), mRunSetConfig.Name, GingerDicser.GetTermResValue(eTermResKey.RunSet))); continue; } else { // Very slow BusinessFlow BFCopy = (BusinessFlow)businessFlow.CreateCopy(false); BFCopy.ContainingFolder = businessFlow.ContainingFolder; BFCopy.Reset(); BFCopy.Active = businessFlowRun.BusinessFlowIsActive; BFCopy.Mandatory = businessFlowRun.BusinessFlowIsMandatory; if (businessFlowRun.BusinessFlowInstanceGuid == Guid.Empty) { BFCopy.InstanceGuid = Guid.NewGuid(); } else { BFCopy.InstanceGuid = businessFlowRun.BusinessFlowInstanceGuid; } if (businessFlowRun.BusinessFlowCustomizedRunVariables != null && businessFlowRun.BusinessFlowCustomizedRunVariables.Count > 0) { ObservableList <VariableBase> allBfVars = BFCopy.GetBFandActivitiesVariabeles(true); Parallel.ForEach(businessFlowRun.BusinessFlowCustomizedRunVariables, customizedVar => { //This is needed to handle updating the outputvariable mappedoutvalues to new style UpdateOldOutputVariableMappedValues(customizedVar); VariableBase originalVar = allBfVars.Where(v => v.ParentGuid == customizedVar.ParentGuid && v.Guid == customizedVar.Guid).FirstOrDefault(); if (originalVar == null)//for supporting dynamic run set XML in which we do not have GUID { originalVar = allBfVars.Where(v => v.ParentName == customizedVar.ParentName && v.Name == customizedVar.Name).FirstOrDefault(); if (originalVar == null) { originalVar = allBfVars.Where(v => v.Name == customizedVar.Name).FirstOrDefault(); } } if (originalVar != null) { CopyCustomizedVariableConfigurations(customizedVar, originalVar); } }); } AllPreviousBusinessFlowRuns.Add(businessFlowRun); BFCopy.RunDescription = businessFlowRun.BusinessFlowRunDescription; BFCopy.BFFlowControls = businessFlowRun.BFFlowControls; runnerFlows.Add(BFCopy); } } runner.Executor.IsUpdateBusinessFlowRunList = true; runner.Executor.BusinessFlows = runnerFlows; }