public Worker(IWorkerContextFactory factory)
 {
     if (factory == null)
     {
         throw new ArgumentNullException(nameof(factory));
     }
     this.factory = factory;
 }
Exemple #2
0
            public Implementation(IArgs options, Config implConfig)
            {
                _options     = options;
                _logger      = implConfig.ExecutionLoggerFactory.New(new JsonSerializer(), new WebSocketPool());
                _writer      = implConfig.Writer;
                _filePath    = implConfig.FilePath;
                _environment = implConfig.EnvironmentWrapper;

                _serverProxyFactory               = implConfig.ServerProxyFactory;
                _resourceCatalogProxyFactory      = implConfig.ResourceCatalogProxyFactory;
                _workerContextFactory             = implConfig.WorkerContextFactory;
                _triggersCatalogFactory           = implConfig.TriggersCatalogFactory;
                _fileSystemWatcherFactory         = implConfig.FileSystemWatcherFactory;
                _queueWorkerImplementationFactory = implConfig.QueueWorkerImplementationFactory;
            }
Exemple #3
0
        private Implementation.Config SetupQueueWorkerImplementationConfings(out Mock <IWriter> mockWriter, out Mock <IExecutionLogPublisher> mockExecutionLogPublisher,
                                                                             IEnvironmentConnection environmentConnection, IResourceCatalogProxy resourceCatalogProxy, IWorkerContextFactory workerContextFactory, ITriggersCatalog triggersCatalog,
                                                                             IFilePath filePath, IFileSystemWatcherFactory fileSystemWatcherFactory, IQueueWorkerImplementationFactory queueWorkerImplementationFactory, IEnvironmentWrapper environmentWrapper)
        {
            mockWriter = new Mock <IWriter>();

            mockExecutionLogPublisher = new Mock <IExecutionLogPublisher>();
            var mockExecutionLoggerFactory = new Mock <IExecutionLoggerFactory>();

            mockExecutionLoggerFactory.Setup(o => o.New(It.IsAny <ISerializer>(), It.IsAny <IWebSocketPool>())).Returns(mockExecutionLogPublisher.Object);

            var mockResourceCatalogProxyFactory = new Mock <IResourceCatalogProxyFactory>();

            mockResourceCatalogProxyFactory.Setup(o => o.New(environmentConnection)).Returns(resourceCatalogProxy);

            var mockServerProxyFactory = new Mock <IServerProxyFactory>();

            mockServerProxyFactory.Setup(o => o.New(new Uri("https://localhost:3143/"))).Returns(environmentConnection);

            var mockTriggersCatalogFactory = new Mock <ITriggersCatalogFactory>();

            mockTriggersCatalogFactory.Setup(o => o.New()).Returns(triggersCatalog);

            var implConfig = new Implementation.Config
            {
                EnvironmentWrapper     = environmentWrapper,
                ExecutionLoggerFactory = mockExecutionLoggerFactory.Object,
                FilePath = filePath,
                FileSystemWatcherFactory         = fileSystemWatcherFactory,
                QueueWorkerImplementationFactory = queueWorkerImplementationFactory,
                ResourceCatalogProxyFactory      = mockResourceCatalogProxyFactory.Object,
                ServerProxyFactory     = mockServerProxyFactory.Object,
                TriggersCatalogFactory = mockTriggersCatalogFactory.Object,
                WorkerContextFactory   = workerContextFactory,
                Writer = mockWriter.Object
            };

            return(implConfig);
        }