private void UploadToGlobalParam(object sender, RoutedEventArgs e) { AppModelParameter CurrentAMDP = (AppModelParameter)ModelParametersGrid.CurrentItem; GlobalAppModelParameter globalAppModelParameter = GlobalAppModelParameter.DuplicateAppModelParamAsGlobal(CurrentAMDP); ObservableList <GlobalAppModelParameter> ModelsGlobalParamsList = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <GlobalAppModelParameter>(); foreach (GlobalAppModelParameter GAMDP in ModelsGlobalParamsList) { if (GAMDP != globalAppModelParameter && GAMDP.PlaceHolder == CurrentAMDP.PlaceHolder) { Reporter.ToUser(eUserMsgKeys.ParameterAlreadyExists, "Global Model Parameters already contains a parameter Place Holder with the same value"); return; } } mApplicationModel.AppModelParameters.Remove(CurrentAMDP); WorkSpace.Instance.SolutionRepository.AddRepositoryItem(globalAppModelParameter); AddGlobalParametertoAPIGlobalParameterList(mApplicationModel.GlobalAppModelParameters, globalAppModelParameter); }
private void AddGlobalParam(object sender, RoutedEventArgs e) { GlobalAppModelParameter newModelGlobalParam = new GlobalAppModelParameter(); SetUniquePlaceHolderName(newModelGlobalParam); string newParamPlaceholder = newModelGlobalParam.PlaceHolder; while (InputBoxWindow.GetInputWithValidation("Add Model Global Parameter", "Parameter Name:", ref newParamPlaceholder, System.IO.Path.GetInvalidPathChars())) { newModelGlobalParam.PlaceHolder = newParamPlaceholder; if (!IsParamPlaceholderNameConflict(newModelGlobalParam)) { newModelGlobalParam.OptionalValuesList.Add(new OptionalValue() { Value = GlobalAppModelParameter.CURRENT_VALUE, IsDefault = true }); WorkSpace.Instance.SolutionRepository.AddRepositoryItem(newModelGlobalParam); newModelGlobalParam.StartDirtyTracking(); break; } } }
private void ReplaceGlobalParameter(string p) { string VarName = p.Replace("{GlobalAppsModelsParam Name=", ""); VarName = VarName.Substring(0, VarName.Length - 1); ObservableList <GlobalAppModelParameter> ModelsGlobalParamsList = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <GlobalAppModelParameter>(); GlobalAppModelParameter Param = ModelsGlobalParamsList.Where(x => x.PlaceHolder == VarName).FirstOrDefault(); if (Param != null) { if (DecryptFlag == true) { bool res = false; String strValuetoPass; strValuetoPass = EncryptionHandler.DecryptString(Param.CurrentValue, ref res); if (res == true) { mValueCalculated = mValueCalculated.Replace(p, strValuetoPass); } else { mValueCalculated = mValueCalculated.Replace(p, Param.CurrentValue); } } else { mValueCalculated = mValueCalculated.Replace(p, Param.CurrentValue); } } else { mValueCalculated = mValueCalculated.Replace(p, string.Format("ERROR: The Global Model Parameter '{0}' was not found", VarName)); } }
public static List <AnalyzerItemBase> Analyze(BusinessFlow BusinessFlow, Activity parentActivity, Act a, ObservableList <DataSourceBase> DSList) { // Put all tests on Action here List <string> ActivityUsedVariables = new List <string>(); List <string> mUsedGlobalParameters = new List <string>(); List <string> mMissingStoreToGlobalParameters = new List <string>(); List <AnalyzerItemBase> IssuesList = new List <AnalyzerItemBase>(); ObservableList <GlobalAppModelParameter> mModelsGlobalParamsList = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <GlobalAppModelParameter>(); // Check if the action is obsolete and suggest conversion/upgrade/delete //if (a is IObsoleteAction) //{ // if (a.Active) // { // // TODO: get platform from activity in test // Platform.eType ActivitySourcePlatform = Platform.eType.AndroidDevice; //FIXME temp // // if it is active then create conversion issue // if (((IObsoleteAction)a).IsObsoleteForPlatform(ActivitySourcePlatform)) // { // AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, Activity, a); // AA.Description = GingerDicser.GetTermResValue(eTermResKey.Activity) + " Contains Obsolete action"; ; // AA.Details = a.Description + " Old Class=" + a.ActClass; // AA.HowToFix = "Convert to new action"; // TODO: get name of new action // AA.CanAutoFix = AnalyzerItemBase.eCanFix.Yes; // AA.IssueType = eType.Warning; // AA.Impact = "New action can have more capabilities and more stable, good to upgrade"; // AA.Severity = eSeverity.Medium; // AA.FixItHandler = UpgradeAction; // AA.ActivitySourcePlatform = ActivitySourcePlatform; // } // } // else // { // // old action but not active so create issue of delete old unused action // AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, Activity, a); // AA.Description = GingerDicser.GetTermResValue(eTermResKey.Activity) + " Contains Obsolete action which is not used"; ; // AA.Details = a.Description + " Old Class=" + a.ActClass; // AA.HowToFix = "Delete action"; // AA.CanAutoFix = AnalyzerItemBase.eCanFix.Yes; // AA.IssueType = eType.Warning; // AA.Impact = "slower execution, disk space"; // AA.Severity = eSeverity.Low; // AA.FixItHandler = DeleteAction; // } //} //Flow Control -> GoToAction , Check if Action u want to go to exist if (a.FlowControls.Count > 0) { foreach (GingerCore.FlowControlLib.FlowControl f in a.FlowControls) { if (f.Active == true) { if (f.FlowControlAction == eFlowControlAction.GoToAction) { string GoToActionName = f.GetNameFromValue(); if (parentActivity.GetAct(f.GetGuidFromValue(true), f.GetNameFromValue(true)) == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control is mapped to Action which does not exist";; AA.Details = "'" + GoToActionName + "' Action does not exist in '" + parentActivity.ActivityName + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity); AA.HowToFix = "Remap the Flow Control Action"; if (parentActivity.Acts.Where(x => x.Description == f.GetNameFromValue()).FirstOrDefault() != null) { //can be auto fix AA.HowToFix = "Remap Flow Control Action. Auto fix found other Action with the same name so it will fix the mapping to this Action."; AA.ErrorInfoObject = f; AA.CanAutoFix = AnalyzerItemBase.eCanFix.Yes; AA.FixItHandler = FixFlowControlWrongActionMapping; } else { AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; } AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } if (f.FlowControlAction == eFlowControlAction.GoToActivity) { string GoToActivity = f.GetNameFromValue(); //if (BusinessFlow.Activities.Where(x => (x.ActivityName == GoToActivity)).FirstOrDefault() == null) if (BusinessFlow.GetActivity(f.GetGuidFromValue(true), f.GetNameFromValue(true)) == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control is mapped to " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist";; AA.Details = "'" + GoToActivity + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " does not exist in the '" + BusinessFlow.Name + " ' " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow); AA.HowToFix = "Remap the Flow Control Action"; if (BusinessFlow.Activities.Where(x => x.ActivityName == f.GetNameFromValue()).FirstOrDefault() != null) { //can be auto fix AA.HowToFix = "Remap Flow Control " + GingerDicser.GetTermResValue(eTermResKey.Activity) + ". Auto fix found other " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " with the same name so it will fix the mapping to this " + GingerDicser.GetTermResValue(eTermResKey.Activity) + "."; AA.ErrorInfoObject = f; AA.CanAutoFix = AnalyzerItemBase.eCanFix.Yes; AA.FixItHandler = FixFlowControlWrongActivityMapping; } else { AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; } AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } if (f.FlowControlAction == eFlowControlAction.GoToNextActivity) { if (BusinessFlow.Activities.IndexOf(parentActivity) == (BusinessFlow.Activities.Count() - 1)) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control is mapped to " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist";; AA.Details = "Flow Control is set to 'GoToNextActivity' but the parent " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " is last one in flow."; AA.HowToFix = "Remap the Flow Control Action"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } if (f.FlowControlAction == eFlowControlAction.SetVariableValue) { if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false) { string SetVariableValue = f.GetNameFromValue(); string[] vals = SetVariableValue.Split(new char[] { '=' }); if (!BusinessFlow.CheckIfVariableExists(vals[0].ToString().Trim(), parentActivity)) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control mapped to " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " which does not exist";; AA.Details = "'" + vals[0].Trim() + "' " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " does not exist in parent items"; AA.HowToFix = "Remap the Flow Control Action"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } if (f.FlowControlAction == eFlowControlAction.RunSharedRepositoryActivity) { if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false) { //f.CalcualtedValue(BusinessFlow, App.ProjEnvironment, WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems<DataSourceBase>()); string RunSharedRepositoryActivity = f.GetNameFromValue(); ObservableList <Activity> activities = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Activity>(); if (activities.Where(x => x.ActivityName == RunSharedRepositoryActivity).FirstOrDefault() == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control mapped to Shared Repository " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist"; AA.Details = "'" + RunSharedRepositoryActivity + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " does not exist in Shared Repository"; AA.HowToFix = "Remap the Flow Control Action"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } if (f.FlowControlAction == eFlowControlAction.GoToActivityByName) { if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false) { string activityToGoTo = f.GetNameFromValue(); if (BusinessFlow.Activities.Where(x => x.ActivityName == activityToGoTo).FirstOrDefault() == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control mapped to " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist"; AA.Details = "'" + activityToGoTo + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " does not exist in the parent " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow); AA.HowToFix = "Remap the Flow Control Action"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } } } } if (a.ActReturnValues.Count > 0) { foreach (ActReturnValue ARV in a.ActReturnValues) { if (ARV.StoreTo != ActReturnValue.eStoreTo.None) { string StoreToValue = ARV.StoreToValue; ActReturnValue.eStoreTo StoreToType = ARV.StoreTo; if (StoreToType == ActReturnValue.eStoreTo.Variable) { if (BusinessFlow.GetAllVariables(parentActivity).Where(x => x.Name == StoreToValue).Select(x => x.Name).FirstOrDefault() == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Output Values is missing " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " '" + StoreToValue + "'"; AA.Details = "'" + StoreToValue + "' does not exist In " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " '" + BusinessFlow.Name + "' => " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' =>" + "Action '" + a.Description + "' "; AA.HowToFix = "Remap Output Values"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Execution will fail in run time"; AA.Severity = eSeverity.Critical; IssuesList.Add(AA); } } else if (StoreToType == ActReturnValue.eStoreTo.DataSource) { if (StoreToValue != "" && StoreToValue != null) { string chkDataSource = ""; Regex rxDSPattern = new Regex(@"{(\bDS Name=)\w+\b[^{}]*}", RegexOptions.Compiled); MatchCollection matches = rxDSPattern.Matches(StoreToValue); foreach (Match match in matches) { chkDataSource = GingerCore.General.CheckDataSource(match.Value, DSList); if (chkDataSource != "") { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = chkDataSource; AA.Details = "Invalid '" + StoreToValue + "' StoreTo Value used In " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " '" + BusinessFlow.Name + "' => " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' =>" + "Action '" + a.Description + "' "; AA.HowToFix = "Remap Output Values"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Execution will fail in run time"; AA.Severity = eSeverity.Critical; IssuesList.Add(AA); } } } } } } } //Disabling the below because there are many actions which shows Locate By/Value but it is not needed for most operation types //if (a.ObjectLocatorConfigsNeeded == true && a.ActionDescription != "Script Action" && a.ActionDescription != "File Operations") //{ // if (a.LocateBy.ToString() == "NA") // { // AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, parentActivity, a); // AA.Description = "Action is missing LocateBy value"; // AA.Details = "Action '" + a.Description + "' In " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' is missing LocateBy value"; // AA.HowToFix = " Add LocateBy value to '" + a.Description + "'"; // AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; // yes if we have one target app, or just set the first // AA.IssueType = eType.Warning; // AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will not be executed and will fail"; // AA.Severity = eSeverity.Medium; // } // if (a.LocateValue == null || a.LocateValue == "") // { // AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, parentActivity, a); // AA.Description = "Action is missing Locate Value "; // AA.Details = "Action '" + a.Description + "' In " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' is missing Locate value"; // AA.HowToFix = " Add Locate Value to '" + a.Description + "'"; // AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; // yes if we have one target app, or just set the first // AA.IssueType = eType.Warning; // AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will not be executed and will fail"; // AA.Severity = eSeverity.Medium; // } //} VariableBase.GetListOfUsedVariables(a, ref ActivityUsedVariables); if (ActivityUsedVariables.Count > 0) { foreach (string Var in ActivityUsedVariables) { if (BusinessFlow.GetAllVariables(parentActivity).Where(x => x.Name == Var).Select(x => x.Name).FirstOrDefault() == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "The " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " '" + Var + "' is missing"; AA.Details = "The " + GingerDicser.GetTermResValue(eTermResKey.Variable) + ": '" + Var + "' Does not exist In " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " '" + BusinessFlow.Name + "' => " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' =>" + "Action '" + a.Description + "' "; AA.HowToFix = " Create new " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " or Delete it from the action."; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will fail due to missing " + GingerDicser.GetTermResValue(eTermResKey.Variable); AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } GlobalAppModelParameter.GetListOfUsedGlobalParameters(a, ref mUsedGlobalParameters); if (mUsedGlobalParameters.Count > 0) { foreach (string Param in mUsedGlobalParameters) { GlobalAppModelParameter globalParam = mModelsGlobalParamsList.Where(x => x.PlaceHolder == Param).FirstOrDefault(); if (globalParam == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "The Application Global Parameter " + Param + " is missing"; AA.Details = "The Application Global Parameter: '" + Param + "' Does not exist in Models Global Parameters"; AA.HowToFix = " Create new Application Global Parameter or Delete it from the action."; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will fail due to missing " + GingerDicser.GetTermResValue(eTermResKey.Variable); AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } GetAllStoreToGlobalParameters(a, mModelsGlobalParamsList, ref mMissingStoreToGlobalParameters); if (mMissingStoreToGlobalParameters.Count > 0) { foreach (string Param in mMissingStoreToGlobalParameters) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "The Output Value with Parameter '" + Param + "' is having store to Parameter which doesn't exist anymore"; AA.Details = "The Output Value with Parameter: '" + Param + "' can be found at " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " '" + BusinessFlow.Name + "' => " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' =>" + "Action '" + a.Description + "' "; AA.HowToFix = " Create new Parameter and change to it in the 'Store to' dropdown under the above path"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will fail due to missing Parameter"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } // Put All Special Actions Analyze Here //actions combination if (a.GetType() == typeof(ActLaunchJavaWSApplication))//forbidden combination: Launch & (platform\agent manipulation action) { List <IAct> driverActs = parentActivity.Acts.Where(x => ((x is ActWithoutDriver && x.GetType() != typeof(ActAgentManipulation)) == false) && x.Active == true).ToList(); if (driverActs.Count > 0) { string list = string.Join(",", driverActs.Select(x => x.ActionDescription).ToList().ToArray()); AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = GingerDicser.GetTermResValue(eTermResKey.Activity) + " has forbidden combinations"; AA.Details = GingerDicser.GetTermResValue(eTermResKey.Activity) + " has " + a.ActionDescription + " Action with the following platform actions: " + list + ".\nPlatform action inside this current " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " will try to activate the agent before the application is launch(will cause agent issue)."; AA.HowToFix = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and put " + a.ActionDescription + " Action in a separate " + GingerDicser.GetTermResValue(eTermResKey.Activity); AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; // we can autofix by delete, but don't want to AA.IssueType = eType.Error; AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will be executed and will fail due to java agent connection"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } if (a.LocateBy == eLocateBy.POMElement || ((a is ActUIElement) && ((ActUIElement)a).ElementLocateBy == eLocateBy.POMElement)) { try { string[] pOMandElementGUIDs = ((ActUIElement)a).ElementLocateValue.Split('_'); Guid selectedPOMGUID = new Guid(pOMandElementGUIDs[0]); ApplicationPOMModel POM = WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid <ApplicationPOMModel>(selectedPOMGUID); if (POM == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Action's mapped Page Objects Model is missing"; AA.Details = "Action " + a.ActionDescription + " has mapped Page Objects Model which is missing, reason can be that the Page Objects Model has been deleted after mapping it to this action."; AA.HowToFix = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and the Action in order to map different Page Objects Model and Element"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Action will fail during execution"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } else { Guid selectedPOMElementGUID = new Guid(pOMandElementGUIDs[1]); ElementInfo selectedPOMElement = (ElementInfo)POM.MappedUIElements.Where(z => z.Guid == selectedPOMElementGUID).FirstOrDefault(); if (selectedPOMElement == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Page Objects Model Element which mapped to this action is missing"; AA.Details = "Action " + a.ActionDescription + " has mapped Page Objects Model Element which is missing, reason can be that the Element has been deleted after mapping it to this action."; AA.HowToFix = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and the Action in order to map different Element"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Action will fail during execution"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } catch (Exception ex) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Action's mapped Page Objects Model or Element is invalid"; AA.Details = "Action " + a.ActionDescription + " has invalid mapped Page Objects Model or Element."; AA.HowToFix = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and the Action in order to map different Page Objects Model and Element"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Action will fail during execution"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } return(IssuesList); }
public void RefreshGlobalAppModelParams(ApplicationModelBase AppModel) { ObservableList <GlobalAppModelParameter> allGlobalParams = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <GlobalAppModelParameter>(); for (int i = 0; i < AppModel.GlobalAppModelParameters.Count; i++) { GlobalAppModelParameter apiGlobalParamInstance = AppModel.GlobalAppModelParameters[i]; GlobalAppModelParameter globalParamInstance = allGlobalParams.Where(x => x.Guid == apiGlobalParamInstance.Guid).FirstOrDefault(); //If the param still exist in the global list if (globalParamInstance != null) { //Check for change and update in Configurations tab if (!globalParamInstance.PlaceHolder.Equals(apiGlobalParamInstance.PlaceHolder)) { AppModel.UpdateParamsPlaceholder(this, new List <string> { apiGlobalParamInstance.PlaceHolder }, globalParamInstance.PlaceHolder); apiGlobalParamInstance.PlaceHolder = globalParamInstance.PlaceHolder; } apiGlobalParamInstance.CurrentValue = globalParamInstance.CurrentValue; if (globalParamInstance.OptionalValuesList.Count > 0) { bool recoverSavedOV = false; Guid currentDefaultOVGuid = new Guid(); //Save current default if (apiGlobalParamInstance.OptionalValuesList.Count > 0) { currentDefaultOVGuid = apiGlobalParamInstance.OptionalValuesList.Where(x => x.IsDefault == true).FirstOrDefault().Guid; recoverSavedOV = true; } string newDefaultOV = null; apiGlobalParamInstance.OptionalValuesList.ClearAll(); foreach (OptionalValue ov in globalParamInstance.OptionalValuesList) { OptionalValue newOV = new OptionalValue(); newOV.Guid = ov.Guid; newOV.Value = ov.Value; if (ov.IsDefault) { newDefaultOV = ov.Guid.ToString(); } apiGlobalParamInstance.OptionalValuesList.Add(newOV); } if (recoverSavedOV) { OptionalValue savedOV = apiGlobalParamInstance.OptionalValuesList.Where(x => x.Guid == currentDefaultOVGuid).FirstOrDefault(); if (savedOV != null) { savedOV.IsDefault = true; } else { apiGlobalParamInstance.OptionalValuesList.Where(x => x.Guid.ToString() == newDefaultOV).FirstOrDefault().IsDefault = true; } } else { apiGlobalParamInstance.OptionalValuesList.Where(x => x.Guid.ToString() == newDefaultOV).FirstOrDefault().IsDefault = true; } apiGlobalParamInstance.OnPropertyChanged(nameof(AppModelParameter.OptionalValuesString)); } else { apiGlobalParamInstance.OptionalValuesList.ClearAll(); } apiGlobalParamInstance.OnPropertyChanged(nameof(AppModelParameter.PlaceHolder)); } else { AppModel.GlobalAppModelParameters.Remove(apiGlobalParamInstance); i--; } } }
private void AddGlobalParametertoAPIGlobalParameterList(ObservableList <GlobalAppModelParameter> APIGlobalParamList, GlobalAppModelParameter GAMP) { GlobalAppModelParameter newAPIGlobalParam = new GlobalAppModelParameter(); newAPIGlobalParam.Guid = GAMP.Guid; newAPIGlobalParam.CurrentValue = GAMP.CurrentValue; newAPIGlobalParam.PlaceHolder = GAMP.PlaceHolder; newAPIGlobalParam.Description = GAMP.Description; foreach (OptionalValue ov in GAMP.OptionalValuesList) { OptionalValue newOV = new OptionalValue(); newOV.Guid = ov.Guid; newOV.Value = ov.Value; newOV.IsDefault = ov.IsDefault; newAPIGlobalParam.OptionalValuesList.Add(newOV); } APIGlobalParamList.Add(newAPIGlobalParam); }
private async void grdMain_CellEditEndingAsync(object sender, DataGridCellEditEndingEventArgs e) { GlobalAppModelParameter CurrentGAMP = null; if (e.Column.Header.ToString() == gridPlaceholderHeader) { CurrentGAMP = (GlobalAppModelParameter)xModelsGlobalParamsGrid.CurrentItem; if (IsParamPlaceholderNameConflict(CurrentGAMP)) { return; } } if (e.Column.SortMemberPath == nameof(GlobalAppModelParameter.PlaceHolder)) { GlobalAppModelParameter selectedGlobalAppModelParameter = (GlobalAppModelParameter)xModelsGlobalParamsGrid.CurrentItem; string NameAfterEdit = selectedGlobalAppModelParameter.PlaceHolder; if (PlaceholderBeforeEdit != NameAfterEdit) { char[] invalidChars = System.IO.Path.GetInvalidPathChars().Where(c => c != '<' && c != '>').ToArray <char>(); if (NameAfterEdit.IndexOfAny(invalidChars) > 0) { System.Text.StringBuilder builder = new System.Text.StringBuilder(); foreach (char value in invalidChars) { builder.Append(value); builder.Append(" "); } Reporter.ToUser(eUserMsgKey.ValueIssue, "Value cannot contain characters like: " + builder); selectedGlobalAppModelParameter.PlaceHolder = PlaceholderBeforeEdit; return; } if (Reporter.ToUser(eUserMsgKey.ParameterUpdate, "The Global Parameter name may be used in Solution items Value Expression, Do you want to automatically update all those Value Expression instances with the parameter name change?") == Amdocs.Ginger.Common.eUserMsgSelection.Yes) { this.Dispatcher.Invoke(() => { xPageGrid.Visibility = Visibility.Collapsed; xUpdatingItemsPnl.Visibility = Visibility.Visible; }); await this.Dispatcher.Invoke(async() => { await Task.Run(() => { UpdateModelGlobalParamVeWithNameChange(PlaceholderBeforeEdit, NameAfterEdit); }); }); this.Dispatcher.Invoke(() => { xUpdatingItemsPnl.Visibility = Visibility.Collapsed; xPageGrid.Visibility = Visibility.Visible; }); Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "Update finished successfully." + Environment.NewLine + "Please do not forget to save all modified " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlows)); } } } }