Exemplo n.º 1
0
 /// <summary>
 /// Creates a <see cref="HttpNodeJSService"/>.
 /// </summary>
 /// <param name="outOfProcessNodeJSServiceOptionsAccessor"></param>
 /// <param name="httpContentFactory"></param>
 /// <param name="embeddedResourcesService"></param>
 /// <param name="fileWatcherFactory"></param>
 /// <param name="monitorService"></param>
 /// <param name="taskService"></param>
 /// <param name="httpClientService"></param>
 /// <param name="jsonService"></param>
 /// <param name="nodeJSProcessFactory"></param>
 /// <param name="logger"></param>
 public HttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeJSServiceOptionsAccessor,
                          IHttpContentFactory httpContentFactory,
                          IEmbeddedResourcesService embeddedResourcesService,
                          IFileWatcherFactory fileWatcherFactory,
                          IMonitorService monitorService,
                          ITaskService taskService,
                          IHttpClientService httpClientService,
                          IJsonService jsonService,
                          INodeJSProcessFactory nodeJSProcessFactory,
                          ILogger <HttpNodeJSService> logger) :
     base(nodeJSProcessFactory,
          logger,
          outOfProcessNodeJSServiceOptionsAccessor,
          embeddedResourcesService,
          fileWatcherFactory,
          monitorService,
          taskService,
          typeof(HttpNodeJSService).GetTypeInfo().Assembly,
          SERVER_SCRIPT_NAME)
 {
     _httpClientService  = httpClientService;
     _jsonService        = jsonService;
     _logger             = logger;
     _httpContentFactory = httpContentFactory;
 }
        private HttpNodeJSService CreateHttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeHostOptionsAccessor = null,
                                                          IHttpContentFactory httpContentFactory             = null,
                                                          IEmbeddedResourcesService embeddedResourcesService = null,
                                                          IFileWatcherFactory fileWatcherFactory             = null,
                                                          IMonitorService monitorService           = null,
                                                          ITaskService taskService                 = null,
                                                          IHttpClientService httpClientService     = null,
                                                          IJsonService jsonService                 = null,
                                                          INodeJSProcessFactory nodeProcessFactory = null,
                                                          ILogger <HttpNodeJSService> logger       = null)
        {
            if (logger == null)
            {
                Mock <ILogger <HttpNodeJSService> > mockLogger = _mockRepository.Create <ILogger <HttpNodeJSService> >();
                logger = mockLogger.Object;
            }

            return(new HttpNodeJSService(outOfProcessNodeHostOptionsAccessor,
                                         httpContentFactory,
                                         embeddedResourcesService,
                                         fileWatcherFactory,
                                         monitorService,
                                         taskService,
                                         httpClientService,
                                         jsonService,
                                         nodeProcessFactory,
                                         logger));
        }
Exemplo n.º 3
0
 public ExposedHttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeHostOptionsAccessor,
                                 IHttpContentFactory httpContentFactory,
                                 IEmbeddedResourcesService embeddedResourcesService,
                                 IHttpClientService httpClientService,
                                 IJsonService jsonService,
                                 INodeJSProcessFactory nodeProcessFactory,
                                 ILoggerFactory loggerFactory) :
     base(outOfProcessNodeHostOptionsAccessor, httpContentFactory, embeddedResourcesService, httpClientService, jsonService, nodeProcessFactory, loggerFactory)
 {
 }
Exemplo n.º 4
0
 private ExposedHttpNodeJSService CreateHttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeHostOptionsAccessor = null,
                                                          IHttpContentFactory httpContentFactory             = null,
                                                          IEmbeddedResourcesService embeddedResourcesService = null,
                                                          IHttpClientService httpClientService     = null,
                                                          IJsonService jsonService                 = null,
                                                          INodeJSProcessFactory nodeProcessFactory = null,
                                                          ILoggerFactory loggerFactory             = null)
 {
     return(new ExposedHttpNodeJSService(outOfProcessNodeHostOptionsAccessor,
                                         httpContentFactory,
                                         embeddedResourcesService,
                                         httpClientService,
                                         jsonService,
                                         nodeProcessFactory,
                                         loggerFactory));
 }
 /// <summary>
 /// Creates a <see cref="HttpNodeJSService"/> instance.
 /// </summary>
 /// <param name="outOfProcessNodeJSServiceOptionsAccessor"></param>
 /// <param name="httpContentFactory"></param>
 /// <param name="embeddedResourcesService"></param>
 /// <param name="httpClientService"></param>
 /// <param name="jsonService"></param>
 /// <param name="nodeJSProcessFactory"></param>
 /// <param name="loggerFactory"></param>
 public HttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeJSServiceOptionsAccessor,
                          IHttpContentFactory httpContentFactory,
                          IEmbeddedResourcesService embeddedResourcesService,
                          IHttpClientService httpClientService,
                          IJsonService jsonService,
                          INodeJSProcessFactory nodeJSProcessFactory,
                          ILoggerFactory loggerFactory) :
     base(nodeJSProcessFactory,
          loggerFactory.CreateLogger(typeof(HttpNodeJSService)),
          outOfProcessNodeJSServiceOptionsAccessor,
          embeddedResourcesService,
          typeof(HttpNodeJSService).GetTypeInfo().Assembly,
          SERVER_SCRIPT_NAME)
 {
     _httpClientService  = httpClientService;
     _jsonService        = jsonService;
     _httpContentFactory = httpContentFactory;
 }
Exemplo n.º 6
0
        private ExposedHttpNodeJSService CreateHttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeHostOptionsAccessor = null,
                                                                 IHttpContentFactory httpContentFactory             = null,
                                                                 IEmbeddedResourcesService embeddedResourcesService = null,
                                                                 IFileWatcherFactory fileWatcherFactory             = null,
                                                                 IMonitorService monitorService           = null,
                                                                 ITaskService taskService                 = null,
                                                                 IHttpClientService httpClientService     = null,
                                                                 IJsonService jsonService                 = null,
                                                                 INodeJSProcessFactory nodeProcessFactory = null,
                                                                 ILogger <HttpNodeJSService> logger       = null,
                                                                 StringBuilder loggerStringBuilder        = null)
        {
            if (logger == null)
            {
                // Log output
                if (loggerStringBuilder != null)
                {
                    var services = new ServiceCollection();
                    services.AddLogging(lb =>
                    {
                        lb.
                        AddProvider(new StringBuilderProvider(loggerStringBuilder)).
                        AddFilter <StringBuilderProvider>((LogLevel LogLevel) => LogLevel >= LogLevel.Trace);
                    });
                    logger = services.BuildServiceProvider().GetRequiredService <ILogger <HttpNodeJSService> >();
                }
                else
                {
                    Mock <ILogger <HttpNodeJSService> > mockLogger = _mockRepository.Create <ILogger <HttpNodeJSService> >();
                    logger = mockLogger.Object;
                }
            }

            return(new ExposedHttpNodeJSService(outOfProcessNodeHostOptionsAccessor,
                                                httpContentFactory,
                                                embeddedResourcesService,
                                                fileWatcherFactory,
                                                monitorService,
                                                taskService,
                                                httpClientService,
                                                jsonService,
                                                nodeProcessFactory,
                                                logger));
        }
        /// <summary>
        /// Creates an <see cref="HttpNodeJSService"/>.
        /// </summary>
        /// <param name="outOfProcessNodeJSServiceOptionsAccessor">The <see cref="OutOfProcessNodeJSServiceOptions"/> accessor.</param>
        /// <param name="httpNodeJSServiceOptionsAccessor">The <see cref="HttpNodeJSServiceOptions"/> accessor.</param>
        /// <param name="httpContentFactory">The factory for creating <see cref="HttpContent"/>s.</param>
        /// <param name="embeddedResourcesService">The service for retrieving NodeJS Http server scripts.</param>
        /// <param name="fileWatcherFactory">The service for creating <see cref="IFileWatcher"/>s</param>
        /// <param name="monitorService">The service for lock-based thread synchronization.</param>
        /// <param name="taskService">The service for utilizing tasks.</param>
        /// <param name="httpClientService">The service for utilizing <see cref="HttpClient"/>.</param>
        /// <param name="jsonService">The service for JSON serialization and deserialization.</param>
        /// <param name="nodeJSProcessFactory">The factory for creating <see cref="NodeJSProcess"/>s.</param>
        /// <param name="logger">The logger for the instance.</param>
        public HttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeJSServiceOptionsAccessor,
                                 IOptions <HttpNodeJSServiceOptions> httpNodeJSServiceOptionsAccessor,
                                 IHttpContentFactory httpContentFactory,
                                 IEmbeddedResourcesService embeddedResourcesService,
                                 IFileWatcherFactory fileWatcherFactory,
                                 IMonitorService monitorService,
                                 ITaskService taskService,
                                 IHttpClientService httpClientService,
                                 IJsonService jsonService,
                                 INodeJSProcessFactory nodeJSProcessFactory,
                                 ILogger <HttpNodeJSService> logger) :
            base(nodeJSProcessFactory,
                 logger,
                 outOfProcessNodeJSServiceOptionsAccessor,
                 embeddedResourcesService,
                 fileWatcherFactory,
                 monitorService,
                 taskService,
                 typeof(HttpNodeJSService).GetTypeInfo().Assembly,
#if NETCOREAPP3_1 || NET5_0_OR_GREATER
                 httpNodeJSServiceOptionsAccessor.Value.Version == HttpVersion.Version20 ? HTTP20_SERVER_SCRIPT_NAME : HTTP11_SERVER_SCRIPT_NAME)
Exemplo n.º 8
0
 public ExposedHttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeJSServiceOptionsAccessor,
                                 IHttpContentFactory httpContentFactory,
                                 IEmbeddedResourcesService embeddedResourcesService,
                                 IFileWatcherFactory fileWatcherFactory,
                                 IMonitorService monitorService,
                                 ITaskService taskService,
                                 IHttpClientService httpClientService,
                                 IJsonService jsonService,
                                 INodeJSProcessFactory nodeJSProcessFactory,
                                 ILogger <HttpNodeJSService> logger) :
     base(outOfProcessNodeJSServiceOptionsAccessor,
          httpContentFactory,
          embeddedResourcesService,
          fileWatcherFactory,
          monitorService,
          taskService,
          httpClientService,
          jsonService,
          nodeJSProcessFactory,
          logger)
 {
 }
Exemplo n.º 9
0
        private ExposedHttpNodeJSService CreateHttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeHostOptionsAccessor = null,
                                                                 IHttpContentFactory httpContentFactory             = null,
                                                                 IEmbeddedResourcesService embeddedResourcesService = null,
                                                                 IHttpClientService httpClientService     = null,
                                                                 IJsonService jsonService                 = null,
                                                                 INodeJSProcessFactory nodeProcessFactory = null,
                                                                 ILoggerFactory loggerFactory             = null)
        {
            if (loggerFactory == null)
            {
                Mock <ILogger>        mockLogger        = _mockRepository.Create <ILogger>();
                Mock <ILoggerFactory> mockLoggerFactory = _mockRepository.Create <ILoggerFactory>();
                mockLoggerFactory.Setup(l => l.CreateLogger(typeof(HttpNodeJSService).FullName)).Returns(mockLogger.Object);
                loggerFactory = mockLoggerFactory.Object;
            }

            return(new ExposedHttpNodeJSService(outOfProcessNodeHostOptionsAccessor,
                                                httpContentFactory,
                                                embeddedResourcesService,
                                                httpClientService,
                                                jsonService,
                                                nodeProcessFactory,
                                                loggerFactory));
        }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of <see cref="ContentParameterAttribute"/>
 /// </summary>
 protected ContentParameterAttribute(IHttpContentFactory httpContentFactory)
 {
     HttpContentFactory = httpContentFactory;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of <see cref="ContentRequestParameterDescription"/>
 /// </summary>
 public ContentRequestParameterDescription(int position, IHttpContentFactory contentFactory)
 {
     Position       = position;
     ContentFactory = contentFactory;
 }