Ejemplo n.º 1
0
        // fix add to listener/loader class
        public override void ActivityStart(uint eventTime, Activity activity, bool continuerun = false)
        {
            mCurrentActivity = activity;
            if (this.Configuration.ExecutionLoggerConfigurationIsEnabled)
            {
                string ActivityFolder = string.Empty;
                if ((this.ExecutedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation) && (Configuration.ExecutionLoggerAutomationTabContext == ExecutionLoggerConfiguration.AutomationTabContext.ActivityRun))
                {
                    mExecutionLogger.ExecutionLogfolder = mExecutionLogger.SetExecutionLogFolder(mExecutionLogger.ExecutionLogfolder, true);
                    Configuration.ExecutionLoggerAutomationTabContext = ExecutionLoggerConfiguration.AutomationTabContext.None;
                }
                else if ((Configuration.ExecutionLoggerAutomationTabContext == ExecutionLoggerConfiguration.AutomationTabContext.ContinueRun))
                {
                    mExecutionLogger.ExecutionLogfolder = mExecutionLogger.SetExecutionLogFolder(mExecutionLogger.ExecutionLogfolder, false);
                    Configuration.ExecutionLoggerAutomationTabContext = ExecutionLoggerConfiguration.AutomationTabContext.None;
                    mCurrentBusinessFlow.ExecutionLogActivityCounter++;

                    ActivityFolder = Path.Combine(mCurrentBusinessFlow.ExecutionLogFolder, mCurrentBusinessFlow.ExecutionLogActivityCounter + " " + folderNameNormalazing(activity.ActivityName));
                }
                else
                {
                    if (this.ExecutedFrom == eExecutedFrom.Run && continuerun == false)
                    {
                        mCurrentBusinessFlow.ExecutionLogActivityCounter++;
                    }
                    else if (this.ExecutedFrom == eExecutedFrom.Automation && continuerun == false)
                    {
                        mCurrentBusinessFlow.ExecutionLogActivityCounter++;
                    }

                    ActivityFolder = Path.Combine(mCurrentBusinessFlow.ExecutionLogFolder, mCurrentBusinessFlow.ExecutionLogActivityCounter + " " + folderNameNormalazing(activity.ActivityName));
                }

                activity.ExecutionLogFolder = mExecutionLogger.GetLogFolder(ActivityFolder);
                // TODO: cleanup after all execution move to LiteDB
                if (mExecutionLogger.ExecutionLogfolder != null)
                {
                    mExecutionLogger.CreateNewDirectory(Path.Combine(mExecutionLogger.ExecutionLogfolder,
                                                                     ActivityFolder));
                }

                activity.VariablesBeforeExec = activity.Variables.Select(a => a.Name + "_:_" + a.Value + "_:_" + a.Description).ToList();
            }

            ExecutionProgressReporterListener.AddExecutionDetailsToLog(ExecutionProgressReporterListener.eExecutionPhase.Start, GingerDicser.GetTermResValue(eTermResKey.Activity), string.Format("{0} (ID:{1}, ParentID:{2})", activity.ActivityName, activity.Guid, activity.ExecutionParentGuid), null);
        }