/// <summary>
        /// initalises a new instance of the <see cref="LoggingContextScopeFactory"/>
        /// </summary>
        /// <param name="log">the microsoft log</param>
        /// <param name="logHelper">the DFC logging helper</param>
        public LoggingContextScopeFactory(ILoggerHelper logHelper)
        {
            It.IsNull(logHelper)
            .AsGuard <ArgumentNullException>(nameof(logHelper));

            LoggerHelper = logHelper;
        }
Exemplo n.º 2
0
        public RestProxyInterceptor(IToken token, ILoggerHelper loggerHelper)
        {
            _token        = token;
            _loggerHelper = loggerHelper;

            _baseUrl = _baseUrl.EndsWith("/") ? _baseUrl : _baseUrl + "/";
        }
 public AgitationServices(IMapper mapper, IAgitationRepository dal, ILoggerHelper loggerHelper)
 {
     this._mapper  = mapper;
     _dal          = dal;
     this.BaseDal  = dal;
     _loggerHelper = loggerHelper;
 }
Exemplo n.º 4
0
        public Functions(IIntegrationEventLogService eventLogService,
                         EdcConfiguration edcConfiguration,
                         IEdcPublishService edcPublishService,
                         JobsConfiguration jobsConfiguration,
                         IEmailService emailService,
                         ILogger logger,
                         ILoggerHelper loggerHelper,
                         IEmailTemplateProvider emailTemplateProvider)
        {
            Ensure.That(eventLogService).IsNotNull();
            Ensure.That(edcConfiguration).IsNotNull();
            Ensure.That(edcPublishService).IsNotNull();
            Ensure.That(jobsConfiguration).IsNotNull();
            Ensure.That(emailService).IsNotNull();
            Ensure.That(logger).IsNotNull();
            Ensure.That(loggerHelper).IsNotNull();
            Ensure.That(emailTemplateProvider).IsNotNull();

            _eventLogService       = eventLogService;
            _edcConfiguration      = edcConfiguration;
            _edcPublishService     = edcPublishService;
            _jobsConfiguration     = jobsConfiguration;
            _emailService          = emailService;
            _logger                = logger;
            _loggerHelper          = loggerHelper;
            _emailTemplateProvider = emailTemplateProvider;
        }
Exemplo n.º 5
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="blogArticle"></param>
 /// <param name="loggerHelper"></param>
 public BlogArticleController(IBlogArticleService blogArticle, ICategoryService categoryService, ILoggerHelper loggerHelper, IMapper mapper)
 {
     this.blogArticleService = blogArticle;
     this.categoryService    = categoryService;
     this.loggerHelper       = loggerHelper;
     this.mapper             = mapper;
 }
Exemplo n.º 6
0
 public LogService(IDmHelper dm, DiscordSocketClient client, ILoggerHelper handler, IEmbedHelper embed)
 {
     _dm      = dm;
     _client  = client;
     _embed   = embed;
     _handler = handler;
 }
Exemplo n.º 7
0
 public WeixiaoRequestIMiddleware(ILogger <WeixiaoRequestIMiddleware> logger, ILoggerHelper log4, IOptions <RSASettings> setting)
 {
     this.logger  = logger;
     this.log4    = log4;
     this.setting = setting.Value;
     rsa          = new RSAHelper(RSAType.RSA2, Encoding.UTF8, this.setting.PrivateKey, this.setting.PublicKey, this.setting.AppKey, this.setting.SplitStr);
 }
Exemplo n.º 8
0
 public AdminsController(IAdminService admin, IMapper IMapper, ILoggerHelper loggerHelper)
 {
     //_context = context;
     this.adminService = admin;
     this.IMapper      = IMapper;
     this.loggerHelper = loggerHelper;
 }
 public PageContentService(INewsRepository newsRepository, IPageContentRepository pageContentRepository,
                           INavigationRepositrory navigationRepositrory, ILoggerHelper logger, IServiceProvider serviceProvider) : base(logger, serviceProvider)
 {
     this.newsRepository        = newsRepository;
     this.pageContentRepository = pageContentRepository;
     this.navigationRepositrory = navigationRepositrory;
 }
 public PostCollectionHttpTriggerService([Inject] ICollectionValidator collectionValidator, [Inject] IHttpRequestHelper requestHelper, [Inject] ILoggerHelper loggerHelper, [Inject] ICollectionDataStore dataStore)
 {
     _requestHelper       = requestHelper;
     _loggerHelper        = loggerHelper;
     _collectionValidator = collectionValidator;
     _dataStore           = dataStore;
 }
Exemplo n.º 11
0
        public static async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "paths/{path}/regions/{pageRegion}")]
            HttpRequest req,
            ILogger log,
            string path,
            int pageRegion,
            [Inject] ILoggerHelper loggerHelper,
            [Inject] IHttpRequestHelper httpRequestHelper,
            [Inject] IHttpResponseMessageHelper httpResponseMessageHelper,
            [Inject] IJsonHelper jsonHelper,
            [Inject] IRegionService regionService
            )
        {
            loggerHelper.LogMethodEnter(log);

            // validate the parameters are present
            var dssCorrelationId = httpRequestHelper.GetDssCorrelationId(req);

            if (string.IsNullOrEmpty(dssCorrelationId))
            {
                log.LogInformation($"Unable to locate '{nameof(dssCorrelationId)}' in request header");
            }

            if (!Guid.TryParse(dssCorrelationId, out var correlationGuid))
            {
                log.LogInformation($"Unable to parse '{nameof(dssCorrelationId)}' to a Guid");
                correlationGuid = Guid.NewGuid();
            }

            if (string.IsNullOrEmpty(path))
            {
                loggerHelper.LogInformationMessage(log, correlationGuid, $"Missing value in request for '{nameof(path)}'");
                return(httpResponseMessageHelper.BadRequest());
            }

            if (pageRegion == 0 || !Enum.IsDefined(typeof(PageRegions), pageRegion))
            {
                loggerHelper.LogInformationMessage(log, correlationGuid, $"Missing/invalid value in request for '{nameof(pageRegion)}'");
                return(httpResponseMessageHelper.BadRequest());
            }

            PageRegions pageRegionValue = (PageRegions)pageRegion;

            loggerHelper.LogInformationMessage(log, correlationGuid, $"Attempting to get Region {pageRegionValue} for Path {path}");

            var regionModel = await regionService.GetAsync(path, pageRegionValue);

            if (regionModel == null)
            {
                loggerHelper.LogInformationMessage(log, correlationGuid, $"Region does not exist for {pageRegionValue} for Path {path}");
                return(httpResponseMessageHelper.NoContent());
            }

            loggerHelper.LogMethodExit(log);

            return(regionModel != null
                ? httpResponseMessageHelper.Ok(jsonHelper.SerializeObjectAndRenameIdProperty(regionModel, "id", nameof(Models.Region.DocumentId)))
                : httpResponseMessageHelper.NoContent());
        }
Exemplo n.º 12
0
 public GetCollectionByIdHtppTriggerService([Inject] IHttpRequestHelper requestHelper, [Inject] IHttpResponseMessageHelper responseMessageHelper, [Inject] ILoggerHelper loggerHelper, [Inject] IJsonHelper jsonHelper, [Inject] ICollectionDataStore dataStore)
 {
     _requestHelper         = requestHelper;
     _loggerHelper          = loggerHelper;
     _responseMessageHelper = responseMessageHelper;
     _jsonHelper            = jsonHelper;
     _dataStore             = dataStore;
 }
Exemplo n.º 13
0
 public Importer(ILogger logger, ILoggerHelper logger_helper,
                 IMonitorDataLayer mon_repo, ITestingDataLayer test_repo)
 {
     _logger        = logger;
     _logger_helper = logger_helper;
     _mon_repo      = mon_repo;
     _test_repo     = test_repo;
 }
Exemplo n.º 14
0
        /// <summary>
        /// initialises an instance of <see cref="LoggingContextScope"/>
        /// </summary>
        /// <param name="log">the microsoft log</param>
        /// <param name="helper">the DFC logger helper</param>
        /// <param name="initialisingRoutine">the calling routine</param>
        public LoggingContextScope(ILogger log, ILoggerHelper helper, string initialisingRoutine)
        {
            Log          = log;
            LoggerHelper = helper;

            CorrelationID = Guid.NewGuid();

            Information($"commencing scoped logging from: '{initialisingRoutine}' for correlation id: {CorrelationID}").ConfigureAwait(false);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ErrorHandlingMiddleware"/> class.
 /// </summary>
 /// <param name="next">The Http Request delegate.</param>
 /// <param name="logger">The Logger instance.</param>
 /// <param name="localizer">The Localizer instance.</param>
 public ErrorHandlingMiddleware(
     RequestDelegate next,
     ILoggerHelper <ErrorHandlingMiddleware> logger,
     IStringLocalizer <SharedResources> localizer)
 {
     this.next   = next;
     this.logger = logger;
     ErrorHandlingMiddleware.localizer = localizer;
 }
Exemplo n.º 16
0
 public ParametersChecker(ILogger logger, ILoggerHelper logger_helper,
                          ICredentials credentials, IMonitorDataLayer mon_repo,
                          ITestingDataLayer test_repo)
 {
     _logger        = logger;
     _logger_helper = logger_helper;
     _credentials   = credentials;
     _mon_repo      = mon_repo;
     _test_repo     = test_repo;
 }
        public void Setup()
        {
            _log                       = Substitute.For <ILogger>();
            _request                   = new DefaultHttpRequest(new DefaultHttpContext());
            _loggerHelper              = Substitute.For <ILoggerHelper>();
            _httpRequestHelper         = Substitute.For <IHttpRequestHelper>();
            _httpResponseMessageHelper = Substitute.For <IHttpResponseMessageHelper>();
            _jsonHelper                = Substitute.For <IJsonHelper>();

            _regionService = Substitute.For <Services.IRegionService>();
        }
        public void TearDown()
        {
            _log                       = null;
            _request                   = null;
            _loggerHelper              = null;
            _httpRequestHelper         = null;
            _httpResponseMessageHelper = null;
            _jsonHelper                = null;

            _regionService = null;
        }
Exemplo n.º 19
0
 public Harvester(ILogger logger, ILoggerHelper logger_helper,
                  IMonitorDataLayer mon_repo, IStorageDataLayer storage_repo,
                  ITestingDataLayer test_repo
                  )
 {
     _logger        = logger;
     _logger_helper = logger_helper;
     _mon_repo      = mon_repo;
     _storage_repo  = storage_repo;
     _test_repo     = test_repo;
 }
 public GetPathHttpTrigger(
     ILogger <GetPathHttpTrigger> logger,
     ILoggerHelper loggerHelper,
     IHttpRequestHelper httpRequestHelper,
     IPathService pathService)
 {
     _logger            = logger;
     _loggerHelper      = loggerHelper;
     _httpRequestHelper = httpRequestHelper;
     _pathService       = pathService;
 }
		public NetworkServer(IConfigHelper config, ILoggerHelper log, IClientsManager clientsManager)
		{
			_config = config;
			_log = log;
			_clientsManager = clientsManager;

			_ip = _config.Get<IPAddress>("server.ip");
			_port = _config.Get<int>("server.port");

			_listener = new TcpListener(_ip, _port);
			_isPortOpen = false;
		}
Exemplo n.º 22
0
 public DataReadOrWriteController(
     ICreateInterface create,
     ILoggerHelper loggerHelper,
     IQueryDBData queryDbData,
     IUpdateToDB updateToDb,
     IDeleteFormDB deleteFormDb)
 {
     _create       = create;
     _loggerHelper = loggerHelper;
     _queryDbData  = queryDbData;
     _updateToDb   = updateToDb;
     _deleteFormDb = deleteFormDb;
 }
Exemplo n.º 23
0
 public HomeService(INavigationRepositrory navigationRepositrory, IImgPlayInfoRepository imgPlayInfoRepository,
                    INewsRepository newsRepository, IFriendlyLinkRepository friendlyLinkRepository,
                    IPageContentRepository pageContentRepository, IOwnerService ownerService,
                    IKeyValueService keyValueService, ILoggerHelper logger, IServiceProvider serviceProvider) : base(logger, serviceProvider)
 {
     this.navigationRepositrory  = navigationRepositrory;
     this.imgPlayInfoRepository  = imgPlayInfoRepository;
     this.newsRepository         = newsRepository;
     this.friendlyLinkRepository = friendlyLinkRepository;
     this.pageContentRepository  = pageContentRepository;
     this.ownerService           = ownerService;
     this.keyValueService        = keyValueService;
 }
        public void GetCollectionByIdHtppTriggerService_Create_Test()
        {
            //Assign
            IHttpRequestHelper         requestHelper         = new HttpRequestHelper();
            IHttpResponseMessageHelper responseMessageHelper = new HttpResponseMessageHelper();
            ILoggerHelper        mockLoggerHelper            = MockingHelper.GetMockLoggerHelper();
            IJsonHelper          jsonHelper              = new JsonHelper();
            ICollectionDataStore mockDataStore           = MockingHelper.GetMockCollectionDataStore();
            IGetCollectionByIdHtppTriggerService service = new GetCollectionByIdHtppTriggerService(requestHelper, responseMessageHelper, mockLoggerHelper, jsonHelper, mockDataStore);

            //Assert
            Assert.IsNotNull(service);
        }
Exemplo n.º 25
0
        public TestingDataLayer(ILogger logger, ICredentials credentials, ILoggerHelper logger_helper)
        {
            builder = new NpgsqlConnectionStringBuilder();

            builder.Host     = credentials.Host;
            builder.Username = credentials.Username;
            builder.Password = credentials.Password;

            builder.Database = "test";
            _db_conn         = builder.ConnectionString;

            _credentials = credentials;

            _logger        = logger;
            _logger_helper = logger_helper;
        }
Exemplo n.º 26
0
        public void GetCollectionsHttpTriggerService_Process_Test()
        {
            //Assign
            IHttpRequestHelper         requestHelper         = new HttpRequestHelper();
            IHttpResponseMessageHelper responseMessageHelper = new HttpResponseMessageHelper();
            ILoggerHelper mockLoggerHelper = MockingHelper.GetMockLoggerHelper();
            IJsonHelper   jsonHelper       = new JsonHelper();

            IGetCollectionsHttpTriggerService service = new GetCollectionsHttpTriggerService(new HttpRequestHelper(), new LoggerHelper(), new CollectionDataStore());

            //Act
            IEnumerable <Collection> result = service.ProcessRequestAsync().Result;

            //Assert
            Assert.IsNotNull(service);
            Assert.IsNotNull(result);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Creates an instance of <see cref="UserBll" />.
        /// </summary>
        /// <param name="connConfig"></param>
        /// <param name="logger"></param>
        /// <param name="localizer"></param>
        public UserBll(
            IUserDal userDal,
            IConnectionFactory connectionFactory,
            UserCtxResolver userCtxResolver,
            IOptions <AppConfig> config,
            ILoggerHelper <UserBll> logger,
            IStringLocalizer <SharedResources> localizer
            )
        {
            this.userDal           = userDal;
            this.connectionFactory = connectionFactory;
            this.userCtxResolver   = userCtxResolver;
            this.AppConfig         = config.Value;
            this.Localizer         = localizer;
            this.Logger            = logger;

            this.userCtxResolver.Check();
        }
        public void GetCollectionByIdHtppTriggerService_Process_Test()
        {
            //Assign
            IHttpRequestHelper         requestHelper         = new HttpRequestHelper();
            IHttpResponseMessageHelper responseMessageHelper = new HttpResponseMessageHelper();
            ILoggerHelper        mockLoggerHelper            = MockingHelper.GetMockLoggerHelper();
            IJsonHelper          jsonHelper = new JsonHelper();
            ICollectionDataStore dataStore  = new CollectionDataStore();
            IGetCollectionByIdHtppTriggerService getCollectionByIdHtppTriggerService = new GetCollectionByIdHtppTriggerService(requestHelper, responseMessageHelper, mockLoggerHelper, jsonHelper, dataStore);

            //Act
            var result = getCollectionByIdHtppTriggerService.ProcessRequestAsync(Guid.NewGuid().ToString()).Result;

            //Assert
            Assert.IsNotNull(getCollectionByIdHtppTriggerService);
            Assert.IsNotNull(result);
            Assert.AreEqual(typeof(Collection), result.GetType());
        }
        public void PostCollectionHttpTriggerService_Process_Test_Success()
        {
            //Assign
            ILoggerHelper mockLoggingHelper = MockingHelper.GetMockLoggerHelper();

            Collection testCollection = new Collection()
            {
                CollectionId     = Guid.NewGuid(),
                TouchPointId     = Guid.NewGuid(),
                LastModifiedDate = DateTime.Now,
                UKPRN            = "12312345"
            };

            //Act
            IPostCollectionHttpTriggerService postCollectionHttpTriggerService = new PostCollectionHttpTriggerService(new CollectionValidator(), new HttpRequestHelper(), new LoggerHelper(), new CollectionDataStore());
            var result = postCollectionHttpTriggerService.ProcessRequestAsync(testCollection).Result;

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(true, result);
        }
        public static HttpResponseMessage Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = ApiDefRoute)]
            HttpRequest req,
            ILogger logger,
            [Inject] ISwaggerDocumentGenerator swaggerDocumentGenerator,
            [Inject] ILoggerHelper loggerHelper
            )
        {
            string ApiSuffix = Environment.GetEnvironmentVariable("ApiSuffix");
            string ApiTitle  = "Composite Paths " + ApiSuffix;

            loggerHelper.LogMethodEnter(logger);

            var swagger = swaggerDocumentGenerator.GenerateSwaggerDocument(req, ApiTitle, ApiDescription, ApiDefinitionName, ApiVersion, Assembly.GetExecutingAssembly());

            loggerHelper.LogMethodExit(logger);

            return(new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(swagger)
            });
        }
Exemplo n.º 31
0
 public GlobalExceptionsFilter(IHostingEnvironment env, ILoggerHelper loggerHelper, IHubContext <ChatHub> hubContext)
 {
     _env          = env;
     _loggerHelper = loggerHelper;
     _hubContext   = hubContext;
 }