public static void ClassInit(TestContext context) { AgentOperations agentOperations = new AgentOperations(wsAgent); wsAgent.AgentOperations = agentOperations; WorkSpace.Init(new WorkSpaceEventHandler()); WorkSpace.Instance.SolutionRepository = GingerSolutionRepository.CreateGingerSolutionRepository(); // Init SR SolutionRepository mSolutionRepository = WorkSpace.Instance.SolutionRepository; string TempRepositoryFolder = TestResources.GetTestTempFolder(Path.Combine("Solutions", "temp")); mSolutionRepository.Open(TempRepositoryFolder); Ginger.SolutionGeneral.Solution sol = new Ginger.SolutionGeneral.Solution(); sol.ContainingFolderFullPath = TempRepositoryFolder; WorkSpace.Instance.Solution = sol; if (WorkSpace.Instance.Solution.SolutionOperations == null) { WorkSpace.Instance.Solution.SolutionOperations = new SolutionOperations(WorkSpace.Instance.Solution); } WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder = Path.Combine(TempRepositoryFolder, "ExecutionResults"); mBF = new BusinessFlow(); mBF.Activities = new ObservableList <Activity>(); mBF.Name = "BF WebServices Web API"; mBF.Active = true; Platform p = new Platform(); p.PlatformType = ePlatformType.WebServices; mDriver = new WebServicesDriver(mBF); mDriver.SaveRequestXML = true; mDriver.SavedXMLDirectoryPath = "~\\Documents"; mDriver.SecurityType = @"None"; wsAgent.DriverType = Agent.eDriverType.WebServices; ((AgentOperations)wsAgent.AgentOperations).Driver = mDriver; ApplicationAgent mAG = new ApplicationAgent(); mAG.Agent = wsAgent; mGR = new GingerRunner(); mGR.Executor = new GingerExecutionEngine(mGR); ((GingerExecutionEngine)mGR.Executor).SolutionAgents = new ObservableList <Agent>(); ((GingerExecutionEngine)mGR.Executor).SolutionAgents.Add(wsAgent); mGR.Executor.BusinessFlows.Add(mBF); }
public void TestInitialize() { WorkSpace.Init(new WorkSpaceEventHandler()); WorkSpace.Instance.SolutionRepository = GingerSolutionRepository.CreateGingerSolutionRepository(); // Init SR mSolutionRepository = WorkSpace.Instance.SolutionRepository; string TempRepositoryFolder = TestResources.GetTestTempFolder(Path.Combine("Solutions", "temp")); mSolutionRepository.Open(TempRepositoryFolder); Ginger.SolutionGeneral.Solution sol = new Ginger.SolutionGeneral.Solution(); sol.ContainingFolderFullPath = TempRepositoryFolder; WorkSpace.Instance.Solution = sol; if (WorkSpace.Instance.Solution.SolutionOperations == null) { WorkSpace.Instance.Solution.SolutionOperations = new SolutionOperations(WorkSpace.Instance.Solution); } mSolutionRepository.StopAllRepositoryFolderWatchers(); WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder = Path.Combine(TempRepositoryFolder, "ExecutionResults"); runset = new RunSetConfig(); runset.Name = "NewRunset1"; WorkSpace.Instance.RunsetExecutor.RunSetConfig = runset; runner = new GingerExecutionEngine(new GingerRunner()); runner.GingerRunner.Name = "Runner1"; runner.CurrentSolution = new Ginger.SolutionGeneral.Solution(); WorkSpace.Instance.RunsetExecutor.Runners.Add(runner.GingerRunner); mEnv = new ProjEnvironment(); mEnv.Name = "Environment1"; EnvApplication app1 = new EnvApplication(); app1.Name = "App1"; app1.Url = "URL123"; mEnv.Applications.Add(app1); GeneralParam GP1 = new GeneralParam(); GP1.Name = "GP1"; GP1.Value = "GP1Value"; app1.GeneralParams.Add(GP1); mBF = new BusinessFlow(); mBF.Name = "Businessflow1"; runner.BusinessFlows.Add(mBF); mActivity = new GingerCore.Activity(); mActivity.Active = true; mActivity.ActivityName = "Activity1"; mAct = new ActDummy(); mAct.Active = true; mAct.Description = "Action1"; mActivity.Acts.Add(mAct); mActivity.Acts.CurrentItem = mAct; mBF.AddActivity(mActivity); BusinessFlow BF1 = new BusinessFlow(); BF1.Name = "Businessflow2"; runner.BusinessFlows.Add(BF1); GingerCore.Activity activity = new GingerCore.Activity(); activity.Active = true; activity.ActivityName = "Activity1"; ActDummy dummy = new ActDummy(); dummy.Active = true; dummy.Description = "Dummy1"; activity.Acts.Add(dummy); activity.Acts.CurrentItem = dummy; BF1.AddActivity(activity); }
public void SaveSolution(bool showWarning = true, eSolutionItemToSave solutionItemToSave = eSolutionItemToSave.GeneralDetails) { bool doSave = false; if (!showWarning) { doSave = true; } else { Solution lastSavedSolution = LoadSolution(FilePath, false); string extraChangedItems = ""; StringBuilder bldExtraChangedItems = new StringBuilder(); if (solutionItemToSave != eSolutionItemToSave.GeneralDetails) { if (this.Name != lastSavedSolution.Name || this.Account != lastSavedSolution.Account) { bldExtraChangedItems.Append("Solution General Details, "); } } if (solutionItemToSave != eSolutionItemToSave.ALMSettings) { if (this.ALMDomain != lastSavedSolution.ALMDomain || this.ALMProject != lastSavedSolution.ALMProject || this.ALMServerURL != lastSavedSolution.ALMServerURL || this.AlmType != lastSavedSolution.AlmType) { bldExtraChangedItems.Append("ALM Details, "); } } if (solutionItemToSave != eSolutionItemToSave.SourceControlSettings) { if (this.SourceControl != lastSavedSolution.SourceControl) { bldExtraChangedItems.Append("Source Control Details, "); } } if (solutionItemToSave != eSolutionItemToSave.LoggerConfiguration) { if (LoggerConfigurations != null) { if (LoggerConfigurations.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified || LoggerConfigurations.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.NoTracked) { bldExtraChangedItems.Append("Execution Logger configuration, "); } } } if (solutionItemToSave != eSolutionItemToSave.ReportConfiguration) { if (HTMLReportsConfigurationSetList != null && lastSavedSolution.HTMLReportsConfigurationSetList.Count != 0) { foreach (HTMLReportsConfiguration config in HTMLReportsConfigurationSetList) { if (config.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified || config.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.NoTracked) { bldExtraChangedItems.Append("Report configuration"); break; } } } } if (solutionItemToSave != eSolutionItemToSave.GlobalVariabels) { if (Variables.Count != lastSavedSolution.Variables.Count) { bldExtraChangedItems.Append(GingerDicser.GetTermResValue(eTermResKey.Variables, "Global ", ", ")); } else { foreach (VariableBase var in Variables) { if (var.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified || var.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.NoTracked) { bldExtraChangedItems.Append(GingerDicser.GetTermResValue(eTermResKey.Variables, "Global ", ", ")); break; } } } } if (solutionItemToSave != eSolutionItemToSave.TargetApplications) { if (ApplicationPlatforms.Count != lastSavedSolution.ApplicationPlatforms.Count) { bldExtraChangedItems.Append("Target Applications, "); } else { foreach (ApplicationPlatform app in ApplicationPlatforms) { if (app.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified || app.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.NoTracked) { bldExtraChangedItems.Append("Target Applications, "); break; } } } } if (solutionItemToSave != eSolutionItemToSave.Tags) { if (Tags.Count != lastSavedSolution.Tags.Count) { bldExtraChangedItems.Append("Tags, "); } else { foreach (RepositoryItemTag tag in Tags) { if (tag.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified || tag.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.NoTracked) { bldExtraChangedItems.Append("Tags, "); break; } } } } extraChangedItems = bldExtraChangedItems.ToString(); if (string.IsNullOrEmpty(extraChangedItems)) { doSave = true; } else { extraChangedItems = extraChangedItems.TrimEnd(); extraChangedItems = extraChangedItems.TrimEnd(new char[] { ',' }); if (Reporter.ToUser(eUserMsgKey.SolutionSaveWarning, extraChangedItems) == eUserMsgSelection.Yes) { doSave = true; } } } if (doSave) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, "Solution Configurations", "item"); RepositorySerializer.SaveToFile(this, FilePath); this.SetDirtyStatusToNoChange(); Reporter.HideStatusMessage(); } }