Esempio n. 1
0
        public ItemInfoDto SaveRun(RunDto run)
        {
            var res = _dataWriterService.SaveRun(run);

            _cache.SaveRun(run);
            return(res);
        }
Esempio n. 2
0
        public List <TestRunDto> GetTestRunsFromRun(RunDto runGuid)
        {
            var testRunsFromCache = _cache.GetTestRunsFromRun(runGuid);
            var res = testRunsFromCache ?? _dataReaderService.GetTestRunsFromRun(runGuid);

            return(res);
        }
Esempio n. 3
0
        public RunDto LoadRun(string fileName)
        {
            JsonSerializer serializer = new JsonSerializer();
            RunDto         runDto     = new RunDto();

            try
            {
                using (StreamReader sr = new StreamReader(fileName))
                    using (JsonReader reader = new JsonTextReader(sr))
                    {
                        runDto = serializer.Deserialize <RunDto>(reader);
                    }
            }
            catch (DirectoryNotFoundException)
            {
                throw;
            }
            catch (FileNotFoundException)
            {
                throw;
            }
            catch (JsonReaderException)
            {
                throw;
            }

            return(runDto);
        }
Esempio n. 4
0
        public static DatabaseEntity <Run> Map(this RunDto runDto)
        {
            var id  = $"run_{runDto.RunInfo.Guid}";
            var run = new Run
            {
                Name       = runDto.Name,
                RunInfo    = runDto.RunInfo.MapRunInfo(id),
                RunSummary = runDto.RunSummary.Map(),
                Sprint     = runDto.Sprint,
                TestRuns   = runDto.TestsInfo.Select(ti => new ItemInfo
                {
                    Guid   = ti.Guid,
                    Start  = ti.Start,
                    Finish = ti.Finish
                }).ToList()
            };
            var entity = new DatabaseEntity <Run>
            {
                Data = run,
                Id   = id,
                Type = EntityType.RunType
            };

            return(entity);
        }
Esempio n. 5
0
        public void SaveRun(RunDto runDto)
        {
            var run = runDto.Map();

            run.Save(_locationsProvider.RunsPath);
            run.RunInfo.SaveRunInfo(_locationsProvider);
        }
        public ItemInfoDto SaveRun(RunDto runDto)
        {
            var runEntity = runDto.Map();

            Database.SaveRun(runEntity);
            return(runEntity.Data.RunInfo.ToDto());
        }
Esempio n. 7
0
        public void SaveRun(RunDto dto, string fileName)
        {
            JsonSerializer jsonSerializer = new JsonSerializer();

            using (StreamWriter sw = new StreamWriter(fileName))
                using (JsonWriter writer = new JsonTextWriter(sw))
                {
                    jsonSerializer.Serialize(writer, dto);
                }
        }
Esempio n. 8
0
        public Task Run(string packageManifestLocation, string appId = null, CancellationToken cancellationToken = default, IProgress <ProgressData> progress = default)
        {
            var proxyObject = new RunDto
            {
                ManifestPath  = packageManifestLocation,
                ApplicationId = appId
            };

            return(this.client.Invoke(proxyObject, cancellationToken, progress));
        }
Esempio n. 9
0
        private void SaveRunToFile()
        {
            RunDto runDto = new RunDto();

            runDto = runDto.fromModel(split);

            RunSaver runSaver = new RunSaver();

            runSaver.SaveRun(runDto, split.File);
        }
Esempio n. 10
0
        public static RunDto ToDto(this Run run)
        {
            var runDto = new RunDto
            {
                TestsInfo = run.TestRuns.Select(
                    tr => tr.ToDto()).ToList(),
                Name       = run.Name,
                RunInfo    = run.RunInfo.ToDto(),
                RunSummary = run.RunSummary.ToDto(),
                Sprint     = run.Sprint
            };

            return(runDto);
        }
        public List <TestRunDto> GetTestRunsFromRun(RunDto runDto)
        {
            var tests = new List <TestRunDto>();

            foreach (var itemInfo in runDto.TestsInfo)
            {
                var test = GetTestRun(itemInfo);
                if (test != null)
                {
                    tests.Add(test);
                }
            }
            return(tests);
        }
Esempio n. 12
0
        public static Run Map(this RunDto runDto)
        {
            var run = new Run
            {
                TestRunFiles = runDto.TestsInfo.Select(
                    ti => Path.Combine(ti.Guid.ToString(), LocationsProvider.GetTestRunFileName(ti.Finish))).ToList(),
                Name       = runDto.Name,
                RunInfo    = runDto.RunInfo.MapRunInfo(),
                RunSummary = runDto.RunSummary.Map(),
                Sprint     = runDto.Sprint
            };

            return(run);
        }
Esempio n. 13
0
        public static Run Map(this RunDto runDto)
        {
            var run = new Run
            {
                TestRuns = runDto.TestsInfo.Select(
                    ti => ti.MapTestRunInfo()).ToList(),
                Name       = runDto.Name,
                RunInfo    = runDto.RunInfo.MapRunInfo(),
                RunSummary = runDto.RunSummary.Map(),
                Sprint     = runDto.Sprint
            };

            return(run);
        }
Esempio n. 14
0
        public async Task <RunDto> GetRunAsync(string userId, int runId)
        {
            RunDto result = null;

            var runDb = await _dbContext.Runs.AsNoTracking()
                        .FirstOrDefaultAsync(x => x.UserId == userId &&
                                             x.Id == runId);

            if (runDb != null)
            {
                result = _mapper.Map <RunDb, RunDto>(runDb);
            }

            return(result);
        }
Esempio n. 15
0
        public static RunDto LoadRun(this string path, string fileName)
        {
            RunDto run         = null;
            var    fullRunPath = Path.Combine(path, fileName);

            if (File.Exists(fullRunPath))
            {
                using (var file = File.OpenText(fullRunPath))
                {
                    var serializer = new JsonSerializer();
                    run = (RunDto)serializer.Deserialize(file, typeof(RunDto));
                }
            }
            return(run);
        }
Esempio n. 16
0
 public void OnRunStarted(ProjectSettings settings, DateTime runStartDateTime)
 {
     CurrentRun = new RunDto
     {
         RunInfo = new ItemInfoDto
         {
             Guid = settings.RunGuid.Equals("") || settings.RunGuid.Equals("null")
                 ? Guid.NewGuid() : Guid.Parse(settings.RunGuid),
             Start = runStartDateTime
         },
         Name       = settings.RunName,
         Sprint     = settings.Sprint,
         TestsInfo  = new List <ItemInfoDto>(),
         RunSummary = new RunSummaryDto()
     };
 }
Esempio n. 17
0
        private void LoadRunFromFile(string fileName)
        {
            RunLoader runLoader = new RunLoader();

            runLoader.LoadRun(fileName);

            RunDto runDto = runLoader.LoadRun(fileName);

            split      = runDto.toModel();
            split.File = fileName;
            informations.Clear();
            FillInformations();
            CreateSegmentsRectangles();
            displayMode = DisplayMode.SEGMENTS;
            SettingsApp.Default.LastRunFile = fileName;
            AddRunToLastRuns(fileName);
            SettingsApp.Default.Save();
        }
Esempio n. 18
0
        //REST API  call - AJAX
        ///~/Scripts/Apps/HomeIndex.js -updateRun()
        public async Task <IHttpActionResult> Put([FromBody] RunDto oRunDto)
        {
            try
            {
                var oRun = new Run()
                {
                    Number    = oRunDto.Key,
                    Note      = oRunDto.Note,
                    Signature = String.IsNullOrWhiteSpace(oRunDto.Signature) ? null : Convert.FromBase64String(oRunDto.Signature)
                };
                var oRunFactory = new RunFactory();

                await oRunFactory.Update(oRun);
            }
            catch (Exception oException)
            {
                oException.Log("Update run");
                return(this.InternalServerError());
            }

            return(this.Ok());
        }
        public ItemInfoDto SaveRun(RunDto run)
        {
            run.RunInfo.ItemName = NamesProvider.GetRunFileName(run.RunInfo.Guid);
            var runGuid  = run.RunInfo.Guid;
            var fileName = NamesProvider.GetRunFileName(runGuid);

            run.RunInfo.ItemName = fileName;
            _locationsProvider.RunsFolderPath.Create();
            var fullRunPath = _locationsProvider.GetRunFullPath(runGuid);

            using (var file = File.CreateText(fullRunPath))
            {
                var serializer = new JsonSerializer();
                serializer.Serialize(file, run);
            }
            _logger.Info($"Run was saved: '{fullRunPath}'");
            var runsInfoFullPath = run.RunInfo.SaveRunInfo(_locationsProvider);

            _logger.Info($"Runs Info was saved: '{runsInfoFullPath}'");
            _logger.Debug($"Run data was saved correctly: {JsonConvert.SerializeObject(run, Formatting.Indented)}");
            return(run.RunInfo);
        }
Esempio n. 20
0
        public static void Main(string[] args)
        {
            var reporter = ReporterFactory.Build(new DummyTestDataProvider());

            ResourceExtractor.ExtractReportBase(reporter.ReporterSettings.OutputPath);

            reporter.Logger.Info("STARTED");

            var reportSettings = new ReportSettingsDto(5, 7, "Awesome report", "Awesome project");

            reporter.DataWriterService.SaveReportSettings(reportSettings);
            reporter.DataWriterService.SaveReportSettings(reportSettings);
            reporter.DataWriterService.SaveReportSettings(reportSettings);

            var run = new RunDto
            {
                RunInfo = new ItemInfoDto
                {
                    Start  = DateTime.Now.AddMinutes(-2),
                    Finish = DateTime.Now,
                    Guid   = Guid.NewGuid()
                },
                RunSummary = new RunSummaryDto(),
                Name       = "Awesome run",
                Sprint     = "Sprint 1",
                TestsInfo  = new List <ItemInfoDto>()
            };

            reporter.DataWriterService.SaveRun(run);
            reporter.DataWriterService.SaveRun(run);

            reporter.Logger.Info("RUN SAVED");

            var testGuid = Guid.NewGuid();
            var screen   = new TestScreenshotDto
            {
                TestScreenshotInfo = new SimpleItemInfoDto
                {
                    Date     = DateTime.Now,
                    ItemName = "Screenshot"
                },
                Base64Data = "ASDJasdkajasdfas==",
                TestGuid   = testGuid
            };
            var test     = new TestRunDto(testGuid, "Test", "Test.FullName");
            var testInfo = new ItemInfoDto
            {
                Start  = DateTime.Now.AddSeconds(-2),
                Finish = DateTime.Now.AddSeconds(2),
                Guid   = testGuid
            };

            test.TestInfo = testInfo;
            reporter.DataWriterService.SaveScreenshot(screen);
            reporter.DataWriterService.SaveTestRun(test, new TestOutputDto
            {
                TestOutputInfo = new SimpleItemInfoDto
                {
                    Date     = DateTime.Now,
                    ItemName = "Some output"
                },
                Output      = "output",
                SuiteOutput = "suite output"
            });

            reporter.Logger.Info("DONE");
            reporter.TearDown();
        }
 public List <TestRunDto> GetTestRunsFromRun(RunDto runDto)
 {
     return(new List <TestRunDto>());
 }
Esempio n. 22
0
        public async Task GetCityGeometrics()
        {
            var cities = GetAllCities();
            var citiesgeoMetricsList = new List <CityGeometricDto>();
            await Task.Run(() => {
                ParallelOptions po        = new ParallelOptions();
                po.MaxDegreeOfParallelism = 7;
                Parallel.For(0, cities.Count, po, i => {
                    ChromeDriverService chromeDriverService     = ChromeDriverService.CreateDefaultService();
                    chromeDriverService.HideCommandPromptWindow = true;
                    ChromeOptions options = new ChromeOptions();
                    options.AddArgument("--headless");
                    var driver     = new ChromeDriver(chromeDriverService, options, TimeSpan.FromSeconds(120));
                    var currentRun = new RunDto
                    {
                        StartedAt = DateTime.Now
                    };
                    driver.Navigate().GoToUrl("https://www.gismeteo.ru/" + cities[i].Url + "10-days/");
                    _logger.LogInformation("https://www.gismeteo.ru/" + cities[i].Url + "10-days/");
                    citiesgeoMetricsList.Add(new CityGeometricDto
                    {
                        CityId     = cities[i].Id,
                        Geometrics = ParseData(driver).Result,
                        Run        = currentRun
                    });
                    currentRun.EndedAt = DateTime.Now;
                    Exit(driver, chromeDriverService);
                });
            });

            foreach (var city in citiesgeoMetricsList)
            {
                var newRun = new Run
                {
                    Id        = Guid.NewGuid(),
                    StartedAt = city.Run.StartedAt,
                    EndedAt   = city.Run.EndedAt,
                    FkCity    = city.CityId
                };
                Create(newRun);
                foreach (var gm in city.Geometrics)
                {
                    Create(new GeoMetric
                    {
                        Id        = Guid.NewGuid(),
                        DayName   = gm.DayName,
                        DayNumber = gm.DayNumber,
                        MaxTempC  = gm.MaxTempC,
                        MaxTempF  = gm.MaxTempF,
                        MinTempC  = gm.MinTempC,
                        MinTempF  = gm.MinTempF,
                        WindMs    = gm.WindMs,
                        MiH       = gm.MiH,
                        KmH       = gm.KmH,
                        Prec      = gm.Prec,
                        FkRunId   = newRun.Id
                    });
                }
            }
            Save();
        }
 public ItemInfoDto SaveRun(RunDto run)
 {
     return(new ItemInfoDto {
         Guid = Guid.NewGuid(), Start = DateTime.Now, ItemName = "SaveRun", Finish = DateTime.Now.AddSeconds(3)
     });
 }
Esempio n. 24
0
 public List <TestRunDto> GetTestRunsFromRun(RunDto runGuid)
 {
     throw new NotImplementedException();
 }