예제 #1
0
        private void DeleteExecutionReports(System.Collections.IList runSetReports)
        {
            foreach (RunSetReport runSetReport in runSetReports)
            {
                if (runSetReport.DataRepMethod == ExecutionLoggerConfiguration.DataRepositoryMethod.LiteDB)
                {
                    LiteDbManager       dbManager  = new LiteDbManager(executionLoggerHelper.GetLoggerDirectory(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder));
                    var                 result     = dbManager.GetRunSetLiteData();
                    List <LiteDbRunSet> filterData = null;
                    filterData = result.IncludeAll().Find(a => a._id.ToString() == runSetReport.GUID).ToList();

                    LiteDbConnector dbConnector = new LiteDbConnector(Path.Combine(mRunSetExecsRootFolder, "GingerExecutionResults.db"));
                    dbConnector.DeleteDocumentByLiteDbRunSet(filterData[0]);
                }
                else
                {
                    string runSetFolder = executionLoggerHelper.GetLoggerDirectory(runSetReport.LogFolder);

                    var fi = new DirectoryInfo(runSetFolder);
                    CleanDirectory(fi.FullName);
                    fi.Delete();
                }
            }

            if (grdExecutionsHistory.Grid.SelectedItems.Count > 0)
            {
                LoadExecutionsHistoryData();
            }
        }
예제 #2
0
        private void DeleteSelectedExecutionResults(object sender, System.Windows.RoutedEventArgs e)
        {
            if ((Reporter.ToUser(eUserMsgKey.ExecutionsResultsToDelete)) == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
            {
                foreach (RunSetReport runSetReport in grdExecutionsHistory.Grid.SelectedItems)
                {
                    if (runSetReport.DataRepMethod == ExecutionLoggerConfiguration.DataRepositoryMethod.LiteDB)
                    {
                        LiteDbManager       dbManager  = new LiteDbManager(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder);
                        var                 result     = dbManager.GetRunSetLiteData();
                        List <LiteDbRunSet> filterData = null;
                        filterData = result.IncludeAll().Find(a => a._id.ToString() == runSetReport.GUID).ToList();

                        LiteDbConnector dbConnector = new LiteDbConnector(Path.Combine(mRunSetExecsRootFolder, "GingerExecutionResults.db"));
                        dbConnector.DeleteDocumentByLiteDbRunSet(filterData[0]);
                        break;
                    }
                    string runSetFolder = executionLoggerHelper.GetLoggerDirectory(runSetReport.LogFolder);

                    var fi = new DirectoryInfo(runSetFolder);
                    CleanDirectory(fi.FullName);
                    fi.Delete();
                }

                if (grdExecutionsHistory.Grid.SelectedItems.Count > 0)
                {
                    LoadExecutionsHistoryData();
                }
            }
        }
예제 #3
0
        private void GenerateBFReport(BusinessFlow bf)
        {
            try
            {
                LiteDbManager dbManager = new LiteDbManager(WorkSpace.Instance.SolutionRepository.ConvertSolutionRelativePath(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder));
                var           result    = dbManager.GetRunSetLiteData();

                List <LiteDbRunSet> filterData = dbManager.FilterCollection(result, Query.All());

                LiteDbRunSet runSetLast = filterData.Last();
                //runSetLast._id = new ObjectId();

                LiteDbRunner runnerFilter = runSetLast.RunnersColl.Find(r => r.GUID.ToString() == mRunner.Guid.ToString());
                //runnerFilter._id = new ObjectId();
                //runSetLast.RunnersColl = new List<LiteDbRunner>() { runnerFilter };

                LiteDbBusinessFlow bfFilter = runnerFilter.BusinessFlowsColl.Find(b => b.GUID.ToString() == bf.Guid.ToString() && b.StartTimeStamp.ToString() == bf.StartTimeStamp.ToLocalTime().ToString());
                if (bfFilter == null)
                {
                    Reporter.ToUser(eUserMsgKey.BFNotExistInDB);
                    return;
                }
                //runnerFilter.RunStatus = bfFilter.RunStatus;
                //runSetLast.RunStatus = runnerFilter.RunStatus;
                //runnerFilter.BusinessFlowsColl = new List<LiteDbBusinessFlow>() { bfFilter };

                //dbManager.WriteToLiteDb(dbManager.NameInDb<LiteDbRunner>(), new List<LiteDbReportBase>() { runnerFilter });
                //dbManager.WriteToLiteDb(dbManager.NameInDb<LiteDbRunSet>(), new List<LiteDbReportBase>() { runSetLast });


                WebReportGenerator webReporterRunner = new WebReportGenerator();
                webReporterRunner.RunNewHtmlReport(string.Empty, runSetLast._id.ToString(), new WebReportFilter()
                {
                    Guid = bfFilter.GUID.ToString()
                });

                //var newRSData = dbManager.GetRunSetLiteData();
                //newRSData.Delete(runSetLast._id);
                //var newRunnerData = dbManager.GetRunnerLiteData();
                //newRunnerData.Delete(runnerFilter._id);
            }
            catch (Exception ex)
            {
            }
        }
예제 #4
0
        // TODO: Make this function to just generate the report folder !!!
        public LiteDbRunSet RunNewHtmlReport(string runSetGuid = null, WebReportFilter openObject = null, bool shouldDisplayReport = true)
        {
            LiteDbRunSet lightDbRunSet = new LiteDbRunSet();
            bool         response      = false;

            try
            {
                string clientAppFolderPath = Path.Combine(WorkSpace.Instance.LocalUserApplicationDataFolderPath, "Reports", "Ginger-Web-Client");
                if (!Directory.Exists(clientAppFolderPath))
                {
                    return(lightDbRunSet);
                }
                DeleteFoldersData(Path.Combine(clientAppFolderPath, "assets", "Execution_Data"));
                DeleteFoldersData(Path.Combine(clientAppFolderPath, "assets", "screenshots"));
                LiteDbManager       dbManager  = new LiteDbManager(new ExecutionLoggerHelper().GetLoggerDirectory(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder));
                var                 result     = dbManager.GetRunSetLiteData();
                List <LiteDbRunSet> filterData = null;
                if (!string.IsNullOrEmpty(runSetGuid))
                {
                    filterData = result.IncludeAll().Find(a => a._id.ToString() == runSetGuid).ToList();
                }
                else
                {
                    runSetGuid = result.IncludeAll().Max(x => x._id).AsString;
                    filterData = result.IncludeAll().Find(a => a._id.ToString() == runSetGuid).ToList();
                }
                lightDbRunSet = filterData.Last();
                PopulateMissingFields(lightDbRunSet, clientAppFolderPath);
                string json = Newtonsoft.Json.JsonConvert.SerializeObject(lightDbRunSet);
                response = RunClientApp(json, clientAppFolderPath, openObject, shouldDisplayReport);
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "RunNewHtmlReport,error :" + ex.ToString());
            }
            return(lightDbRunSet);
        }