public ConfigRepository(IConfigReader configReader, KnownGraphiteClients knownGraphiteClients, ICache cache, ISleep sleep, ILog log, int errorReadingConfigSleepTime)
 {
     this.configReader = configReader;
     this.knownGraphiteClients = knownGraphiteClients;
     this.cache = cache;
     this.sleep = sleep;
     this.log = log;
     this.errorReadingConfigSleepTime = errorReadingConfigSleepTime;
 }
Example #2
0
 public static TaskManager CreateTaskManager(SqlToGraphiteSection configuration)
 {
     var cacheLength = new TimeSpan(0, configuration.ConfigCacheLengthMinutes, 0);
     var stop = new Stop();
     IDataClientFactory dataClientFactory = new DataClientFactory(log);
     IGraphiteClientFactory graphiteClientFactory = new GraphiteClientFactory(log);
     var configMapper = new ConfigMapper(configuration.Hostname, stop, dataClientFactory, graphiteClientFactory, log);
     var configReader = new ConfigReader(configuration.ConfigUri,configuration.ConfigUsername,configuration.ConfigPassword);
     var cache = new Cache(cacheLength, log);
     var sleeper = new Sleeper();
     var knownGraphiteClients = new KnownGraphiteClients();
     var cr = new ConfigRepository(configReader, knownGraphiteClients, cache, sleeper, log, configuration.MinutesBetweenRetryToGetConfigOnError);
     var configController = new ConfigController(configMapper, log, cr);
     return new TaskManager(log, configController, configuration.ConfigUri, stop, sleeper, configuration.CheckConfigUpdatedEveryMinutes);
 }
 private void AddKnownClient(KnownGraphiteClients knownGraphiteClients, SqlToGraphiteConfigClientsClient client)
 {
     if (knownGraphiteClients.IsKnown(client.name))
     {
         this.clientList.Add(client.name, client.port);
     }
     else
     {
         Errors.Add(string.Format("{0} {1}", UnknownClient, client.name));
     }
 }
 public void Should_not_know_other()
 {
     var knownGraphiteClients = new KnownGraphiteClients();
     Assert.IsFalse(knownGraphiteClients.IsKnown("unknown"));
 }
 public void Should_know_statsdudp()
 {
     var knownGraphiteClients = new KnownGraphiteClients();
     Assert.IsTrue(knownGraphiteClients.IsKnown("statsdudp"));
 }
 public void Should_know_nativetcp()
 {
     var knownGraphiteClients = new KnownGraphiteClients();
     Assert.IsTrue(knownGraphiteClients.IsKnown("graphitetcp"));
 }