Ejemplo n.º 1
0
        public static AccountReportActivity MapActivityStartData(Activity activity, Context context)
        {
            activity.ExecutionId       = Guid.NewGuid();// check incase of rerun / flow control
            activity.ParentExecutionId = context.BusinessFlow.CurrentActivitiesGroup.ExecutionId;

            AccountReportActivity accountReportActivity = new AccountReportActivity();

            accountReportActivity.Id       = activity.ExecutionId;
            accountReportActivity.EntityId = activity.Guid;
            accountReportActivity.AccountReportDbActivityGroupId = activity.ParentExecutionId;
            accountReportActivity.ExecutionId               = (Guid)WorkSpace.Instance.RunsetExecutor.RunSetConfig.ExecutionID;
            accountReportActivity.Seq                       = context.BusinessFlow.ExecutionLogActivityCounter;
            accountReportActivity.Name                      = activity.ActivityName;
            accountReportActivity.Description               = activity.Description;
            accountReportActivity.RunDescription            = GetCalculatedValue(context, activity.RunDescription);
            accountReportActivity.Environment               = ((GingerExecutionEngine)context.Runner).GingerRunner.ProjEnvironment.Name;
            accountReportActivity.EnvironmentId             = ((GingerExecutionEngine)context.Runner).GingerRunner.ProjEnvironment.Guid;
            accountReportActivity.StartTimeStamp            = activity.StartTimeStamp;
            accountReportActivity.VariablesBeforeExec       = activity.Variables.Select(a => a.Name + "_:_" + a.Value + "_:_" + a.Description + "_:_" + a.Guid + "_:_" + a.SetAsInputValue + "_:_" + a.SetAsOutputValue + "_:_" + a.Publish).ToList();
            accountReportActivity.ActivityGroupName         = activity.ActivitiesGroupID;
            accountReportActivity.ChildExecutableItemsCount = activity.Acts.Count(x => x.Active == true);
            accountReportActivity.RunStatus                 = _InProgressStatus;
            accountReportActivity.IsPublished               = activity.Publish;
            return(accountReportActivity);
        }
Ejemplo n.º 2
0
        public static AccountReportActivity MapActivityEndData(Activity activity, Context context)
        {
            AccountReportActivity accountReportActivity = new AccountReportActivity();

            accountReportActivity.Id       = activity.ExecutionId;
            accountReportActivity.EntityId = activity.Guid;
            accountReportActivity.AccountReportDbActivityGroupId = activity.ParentExecutionId;
            accountReportActivity.ExecutionId         = (Guid)WorkSpace.Instance.RunsetExecutor.RunSetConfig.ExecutionID;
            accountReportActivity.Name                = activity.ActivityName;
            accountReportActivity.EndTimeStamp        = activity.EndTimeStamp;
            accountReportActivity.ElapsedEndTimeStamp = activity.Elapsed;
            accountReportActivity.RunStatus           = activity.Status.ToString();
            accountReportActivity.VariablesAfterExec  = activity.Variables.Select(a => a.Name + "_:_" + a.Value + "_:_" + a.Description + "_:_" + a.Guid + "_:_" + a.SetAsInputValue + "_:_" + a.SetAsOutputValue + "_:_" + a.Publish).ToList();

            accountReportActivity.ChildExecutedItemsCount   = activity.Acts.Count(x => x.Status == eRunStatus.Passed || x.Status == eRunStatus.Failed || x.Status == eRunStatus.FailIgnored || x.Status == eRunStatus.Stopped || x.Status == eRunStatus.Completed);
            accountReportActivity.ChildPassedItemsCount     = activity.Acts.Count(x => x.Status == eRunStatus.Passed);
            accountReportActivity.ChildExecutableItemsCount = activity.Acts.Count(x => x.Active == true);

            accountReportActivity.ExecutionRate = string.Format("{0:F1}", CalculateExecutionOrPassRate((int)accountReportActivity.ChildExecutedItemsCount, (int)accountReportActivity.ChildExecutableItemsCount));
            accountReportActivity.PassRate      = string.Format("{0:F1}", CalculateExecutionOrPassRate((int)accountReportActivity.ChildPassedItemsCount, (int)accountReportActivity.ChildExecutedItemsCount));
            return(accountReportActivity);
        }
        public async Task SendActivityExecutionDataToCentralDBAsync(AccountReportActivity accountReportActivity, bool isUpdate = false)
        {
            if (restClient != null)
            {
                string message = string.Format("execution data to Central DB for the Activity:'{0}' (Execution Id:'{1}', Parent Execution Id:'{2}')", accountReportActivity.Name, accountReportActivity.Id, accountReportActivity.AccountReportDbActivityGroupId);
                try
                {
                    bool responseIsSuccess = await SendRestRequestAndGetResponse(SEND_ACTIVITY_EXECUTION_DATA, accountReportActivity, isUpdate).ConfigureAwait(false);

                    if (responseIsSuccess)
                    {
                        Reporter.ToLog(eLogLevel.DEBUG, "Successfully sent " + message);
                    }
                    else
                    {
                        Reporter.ToLog(eLogLevel.ERROR, "Failed to send " + message);
                    }
                }
                catch (Exception ex)
                {
                    Reporter.ToLog(eLogLevel.ERROR, "Exception when sending " + message, ex);
                }
            }
        }
 private async Task ActivityEndTask(Activity activity)
 {
     AccountReportActivity accountReportActivity = AccountReportEntitiesDataMapping.MapActivityEndData(activity, mContext);
     //accountReportActivity.UpdateData = true;
     await AccountReportApiHandler.SendActivityExecutionDataToCentralDBAsync(accountReportActivity, true);
 }
 private async Task ActivityStartTask(Activity activity)
 {
     AccountReportActivity accountReportActivity = AccountReportEntitiesDataMapping.MapActivityStartData(activity, mContext);
     await AccountReportApiHandler.SendActivityExecutionDataToCentralDBAsync(accountReportActivity);
 }