private void ResetBusFlowVariables(object sender, RoutedEventArgs e) { try { BusinessFlow originalBF = (from bf in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>() where bf.Guid == mBusinessFlow.Guid select bf).FirstOrDefault(); if (originalBF == null) { originalBF = (from bf in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>() where bf.Name == mBusinessFlow.Name select bf).FirstOrDefault(); } if (originalBF == null) { Reporter.ToUser(eUserMsgKey.ResetBusinessFlowRunVariablesFailed, "Original " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " was not found"); return; } else { BusinessFlow originalBFCopy = (BusinessFlow)originalBF.CreateCopy(false); mBusinessFlow.Variables = originalBFCopy.Variables; mBusinessFlow.Activities = originalBFCopy.Activities; LoadGridData(); } } catch (Exception ex) { Reporter.ToUser(eUserMsgKey.ResetBusinessFlowRunVariablesFailed, ex.Message); } }
public void TestRunsetConfigBFVariables() { //Arrange ObservableList <BusinessFlow> bfList = SR.GetAllRepositoryItems <BusinessFlow>(); BusinessFlow BF1 = bfList[0]; ObservableList <Activity> activityList = BF1.Activities; Activity activity = activityList[0]; ActDummy act1 = new ActDummy() { Value = "", Active = true }; activity.Acts.Add(act1); VariableString v1 = new VariableString() { Name = "v1", InitialStringValue = "aaa" }; BF1.AddVariable(v1); BF1.Active = true; mGR.BusinessFlows.Add(BF1); //Adding Same Business Flow Again to GingerRunner BusinessFlow bfToAdd = (BusinessFlow)BF1.CreateCopy(false); bfToAdd.ContainingFolder = BF1.ContainingFolder; bfToAdd.Active = true; bfToAdd.Reset(); bfToAdd.InstanceGuid = Guid.NewGuid(); mGR.BusinessFlows.Add(bfToAdd); WorkSpace.Instance.SolutionRepository = SR; //Act //Changing initial value of 2nd BF from BusinessFlow Config mGR.BusinessFlows[2].Variables[0].Value = "bbb"; mGR.BusinessFlows[2].Variables[0].DiffrentFromOrigin = true; mGR.RunRunner(); //Assert Assert.AreEqual(BF1.RunStatus, eRunStatus.Passed); Assert.AreEqual(activity.Status, eRunStatus.Passed); Assert.AreEqual(bfToAdd.RunStatus, eRunStatus.Passed); Assert.AreEqual(mGR.BusinessFlows[1].Variables[0].Value, "aaa"); Assert.AreEqual(mGR.BusinessFlows[2].Variables[0].Value, "bbb"); }
private void Businessflow_DuplicateClick(object sender, RoutedEventArgs e) { if (CheckCurrentRunnerIsNotRuning()) { return; } BusinessFlow bf = (BusinessFlow)((RunnerItemPage)sender).ItemObject; BusinessFlow bCopy = (BusinessFlow)bf.CreateCopy(false); bCopy.InstanceGuid = Guid.NewGuid(); bCopy.Reset(); AddBuinessFlowToRunner(bCopy, 1); }
public void BusinessFlowWithSRItemsInstanceCreateCopyTest() { //Arrange ObservableList <BusinessFlow> businessFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>(); BusinessFlow originalFlow = businessFlows.Where(x => x.Name == "Flow 2").FirstOrDefault(); //Act BusinessFlow businessFlowCopy = (BusinessFlow)originalFlow.CreateCopy(true); //Assert Assert.AreEqual(originalFlow.ActivitiesGroups[0].ParentGuid, businessFlowCopy.ActivitiesGroups[0].ParentGuid); Assert.AreEqual(originalFlow.Activities[0].ParentGuid, businessFlowCopy.Activities[0].ParentGuid); Assert.AreEqual(originalFlow.Activities[0].Variables[0].ParentGuid, businessFlowCopy.Activities[0].Variables[0].ParentGuid); }
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; }