コード例 #1
0
        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);
        }
コード例 #2
0
        public GisAppConfig CreateGisAppConfig()
        {
            GisAppConfig gisAppConfig = new GisAppConfig();

            gisAppConfig.QueryInstances.Add("test", CreateQueryConfig());

            return(gisAppConfig);
        }
コード例 #3
0
 /// <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;
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        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();
            }
        }
コード例 #6
0
 public AppConfigHealthCheck(IQueryConfigureValidator searchConfigureValidator, GisAppConfig appConfigInstance)
 {
     SearchConfigureValidator = searchConfigureValidator;
     AppConfigInstance        = appConfigInstance;
 }
コード例 #7
0
 public void Setup()
 {
     _gisAppConfig = new GisAppConfig();
 }