public void EmptyTaskWorkerConfiguration2() { ITaskWorkersConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskWorkerConfiguration("Empty2"); Assert.IsNotNull(configuration); Assert.IsNull(configuration[typeof(FakeTask)]); }
public void TaskWorker() { ITaskWorkersConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskWorkerConfiguration("TaskWorker"); Assert.AreEqual(typeof(FakeTaskWorker), configuration[typeof(FakeTask)].WorkerType); Assert.AreEqual(typeof(FakeTaskWorker), configuration[typeof(FakePollingQueueTask)].WorkerType); Assert.IsTrue(configuration[typeof(FakeTask)].HasTaskJobSettings); Assert.IsFalse(configuration[typeof(FakePollingQueueTask)].HasTaskJobSettings); }
/// <summary> /// Initializes a new instance of the <see cref="TaskWorkerFactory"/> class. /// </summary> /// <param name="configurationProvider">The configuration factory to provide task worker configuration.</param> /// <param name="locator">The service locator to resolve task worker instances.</param> /// <exception cref="ArgumentNullException">Parameter <paramref name="configurationProvider"/> or <paramref name="locator"/> is null.</exception> public TaskWorkerFactory(ITaskProcessorConfigurationProvider configurationProvider, IRadoslavServiceLocator locator) { if (configurationProvider == null) { throw new ArgumentNullException(nameof(configurationProvider)); } if (locator == null) { throw new ArgumentNullException(nameof(locator)); } this.locator = locator; this.configuration = configurationProvider.GetTaskWorkerConfiguration(); }
/// <summary> /// Initializes a new instance of the <see cref="TaskWorkerBootstrap"/> class. /// </summary> /// <param name="configProvider">The configuration provider to use.</param> /// <param name="repository">The repository to use.</param> /// <param name="messageBus">The message bus to use.</param> /// <param name="taskWorkerFactory">The task worker factory to use.</param> /// <param name="dateTimeProvider">The date time provider to use.</param> /// <exception cref="ArgumentNullException">Parameter <paramref name="repository"/>, <paramref name="messageBus"/>, /// <paramref name="taskWorkerFactory"/> or <paramref name="dateTimeProvider"/> is null.</exception> public TaskWorkerBootstrap(ITaskProcessorConfigurationProvider configProvider, ITaskProcessorRepository repository, ITaskProcessorMessageBus messageBus, ITaskWorkerFactory taskWorkerFactory, IDateTimeProvider dateTimeProvider) { if (configProvider == null) { throw new ArgumentNullException("configProvider"); } if (repository == null) { throw new ArgumentNullException("repository"); } if (messageBus == null) { throw new ArgumentNullException("messageBus"); } if (taskWorkerFactory == null) { throw new ArgumentNullException("taskWorkerFactory"); } if (dateTimeProvider == null) { throw new ArgumentNullException("dateTimeProvider"); } this.configuration = configProvider.GetTaskWorkerConfiguration(); if (this.configuration == null) { throw new ArgumentException("'{0}' returned null configuration.".FormatInvariant(configProvider.GetType()), nameof(configProvider)); } this.repository = repository; this.messageBus = messageBus; this.taskFactory = taskWorkerFactory; this.dateTimeProvider = dateTimeProvider; }