public ValidatingResult ValidateAllQueryConfiguration(GisAppConfig appConfigInstance) { _logger.LogInformation("Start validating GIS Query Data configuration"); var result = new ValidatingResult { Status = true }; var stopWatch = new Stopwatch(); stopWatch.Start(); try { foreach (var pairConfig in appConfigInstance.QueryInstances.Values) { ValidateQueryConfiguration(pairConfig); } } catch (Exception ex) { _logger.LogError("Validation failed due to the exception", ex); result.OutputException = ex; result.Status = false; } finally { stopWatch.Stop(); result.ResponseTime = stopWatch.ElapsedMilliseconds; result.Description = "Checking search data configuration"; //TODO it can be configurable, getting from database } return(result); }
public GisAppConfig CreateGisAppConfig() { GisAppConfig gisAppConfig = new GisAppConfig(); gisAppConfig.QueryInstances.Add("test", CreateQueryConfig()); return(gisAppConfig); }
/// <summary> /// </summary> /// <param name="mediator"></param> /// <param name="appConfigInstance"></param> /// <param name="versionInformation"></param> /// <param name="logger"></param> public GisQueryController(IMediator mediator, GisAppConfig appConfigInstance, VersionInformation versionInformation, ILogger <GisQueryController> logger) { _mediator = mediator; _appConfigInstance = appConfigInstance; _versionInformation = versionInformation; _logger = logger; }
public void ValidateAllQueryConfigurationTest_return_true_if_there_is_no_exception() { GisAppConfig gisAppConfig = CreateGisAppConfig(); _mockDbSvc.Setup(x => x.CollectionExists(It.IsAny <string>())).Returns(true); _mockDbSvc.Setup(x => x.GetOneDocument(It.IsAny <string>())).Returns(DataHelper.CreateBJson()); ValidatingResult result = _validator.ValidateAllQueryConfiguration(gisAppConfig); result.Status.Should().Be(true); }
private void InitializeConfig() { AppConfigInstance = new GisAppConfig(); //TODO Extend to MsSQL switch (DbSettings.DatabaseType) { case SourceType.Mongodb: AppConfigInstance.AddQueryConfigs(AppBuilderFromMongodb.BuildConfigApp(DbSettings)); break; case SourceType.MsSql: throw new NotImplementedException("Getting Query Data Configuration from MsSQL is not implemented"); default: throw new ArgumentOutOfRangeException(); } }
public AppConfigHealthCheck(IQueryConfigureValidator searchConfigureValidator, GisAppConfig appConfigInstance) { SearchConfigureValidator = searchConfigureValidator; AppConfigInstance = appConfigInstance; }
public void Setup() { _gisAppConfig = new GisAppConfig(); }