private void CreateFormChecks(IEnumerable <CheckDefinition> checkDefinition, ICheckFactory checkFactory) { checkDefinition.ToList().ForEach(f => { // create check var check = checkFactory.CreateFormCheck(f); _checks.Add(check); }); }
public DefaultHealthCheckService(ISystemClock clock, IHealthCheckPolicyProvider policyProvider, ICheckFactory checkFactory) { if (checkFactory == null) { throw new ArgumentNullException(nameof(checkFactory)); } if (clock == null) { throw new ArgumentNullException(nameof(clock)); } if (policyProvider == null) { throw new ArgumentNullException(nameof(policyProvider)); } _checkFactory = checkFactory; _clock = clock; _defaultPolicy = policyProvider.DefaultPolicy; _resultCache = CreateCache(); }
public static NZazuField AddChecks( this NZazuField field, IEnumerable <CheckDefinition> checkDefinitions, ICheckFactory checkFactory, Func <FormData> formData = null, INZazuTableDataSerializer tableSerializer = null, int rowIdx = -1) { if (checkDefinitions == null) { return(field); } var checks = checkDefinitions .Select(x => checkFactory.CreateCheck(x, field.Definition, formData, tableSerializer, rowIdx)) .ToArray(); field.Check = checks.Length == 1 ? checks.First() : new AggregateCheck(checks.ToArray()); return(field); }
public HealthCheckHostedService(ILogger <HealthCheckHostedService> logger, HealthCheckServiceConfiguration config, IMemoryCache cache, IConfiguration configuration, ICheckFactory factory, BuildModel build) : base(logger, config.Enabled, config.Interval, true) { config.Name = factory.ExpandTemplate(config.Name); checks = new List <Check>(); foreach (var check in config.Checks) { checks.Add(factory.Create(check)); } var healthCheck = new HealthCheck(config, checks, build, cache, factory.Logger, factory.Recorder); healthCheck.Initialize(new CheckConfiguration() { Name = config.Name, Interval = config.Interval, CacheDuration = config.CacheDuration, Timeout = config.Interval }); checks.Add(healthCheck); this.config = config; }