public void SetUp() { log = MockRepository.GenerateMock<ILog>(); configMapper = MockRepository.GenerateMock<IConfigMapper>(); configRepository = MockRepository.GenerateMock<IConfigRepository>(); roleConfigFactory = MockRepository.GenerateMock<IRoleConfigFactory>(); environment = MockRepository.GenerateMock<IEnvironment>(); taskSetBuilder = MockRepository.GenerateMock<ITaskSetBuilder>(); configController = new ConfigController(this.configMapper, this.log, this.configRepository, this.roleConfigFactory, this.environment, taskSetBuilder); }
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); }
public static TaskManager CreateTaskManager(SqlToGraphiteSection configuration) { var cacheLength = new TimeSpan(0, configuration.ConfigCacheLengthMinutes, 0); var stop = new Stop(); var directoryImpl = new DirectoryImpl(); var assemblyResolver = new AssemblyResolver(directoryImpl, log); IEncryption encryption = new Encryption(); IDataClientFactory dataClientFactory = new DataClientFactory(log, assemblyResolver, encryption); IGraphiteClientFactory graphiteClientFactory = new GraphiteClientFactory(log); var configReader = new ConfigHttpReader(configuration.ConfigUri, configuration.ConfigUsername, configuration.ConfigPassword); var cache = new Cache(cacheLength, log); var sleeper = new Sleeper(); var genericSer = new GenericSerializer(Global.GetNameSpace()); var cr = new ConfigRepository(configReader, cache, sleeper, log, configuration.MinutesBetweenRetryToGetConfigOnError, genericSer); var configMapper = new ConfigMapper(configuration.Hostname, stop, dataClientFactory, graphiteClientFactory, log, cr); var roleConfigFactory = new RoleConfigFactory(); var environment = new Environment(); var taskSetBuilder = new TaskSetBuilder(); var configController = new ConfigController(configMapper, log, cr, roleConfigFactory, environment, taskSetBuilder); return new TaskManager(log, configController, configuration.ConfigUri, stop, sleeper, configuration.CheckConfigUpdatedEveryMinutes); }