コード例 #1
0
        public void Setup()
        {
            _mockMiaEnvConfig = new MiaEnvConfiguration
            {
                USERID_HEADER_KEY                 = "userid",
                USER_PROPERTIES_HEADER_KEY        = "userproperties",
                GROUPS_HEADER_KEY                 = "groups",
                CLIENTTYPE_HEADER_KEY             = "clienttype",
                BACKOFFICE_HEADER_KEY             = "isbackoffice",
                MICROSERVICE_GATEWAY_SERVICE_NAME = "gateway-name"
            };

            _mockHeaderDictionary = new HeaderDictionary
            {
                { "userid", "user" },
                { "userproperties", "props" },
                { "groups", "groups" },
                { "clienttype", "client" },
                { "isbackoffice", "true" },
                { "gateway-name", "gateway" }
            };

            _httpContext = new DefaultHttpContext();;

            var miaHeadersPropagator =
                new MiaHeadersPropagator(_mockHeaderDictionary, _mockMiaEnvConfig);

            _httpContext.Items = new Dictionary <object, object> {
                { "MiaHeadersPropagator", miaHeadersPropagator }
            };

            _mockServiceClientFactory     = new ServiceClientFactory(_mockMiaEnvConfig);
            _mockDecoratorResponseFactory = new DecoratorResponseFactory();
        }
コード例 #2
0
 protected ServiceStatusController(
     MiaEnvsConfigurations miaEnvsConfigurations,
     ServiceClientFactory serviceClientFactory,
     DecoratorResponseFactory decoratorResponseFactory) :
     base(miaEnvsConfigurations, serviceClientFactory, decoratorResponseFactory)
 {
 }
コード例 #3
0
 public ServiceController(MiaEnvsConfigurations miaEnvsConfigurations, ServiceClientFactory serviceClientFactory,
                          DecoratorResponseFactory decoratorResponseFactory)
 {
     MiaEnvsConfigurations    = miaEnvsConfigurations;
     ServiceClientFactory     = serviceClientFactory;
     DecoratorResponseFactory = decoratorResponseFactory;
 }
コード例 #4
0
        public static void ConfigureMiaLibraryServices(IServiceCollection services, IConfiguration configuration, MiaEnvsConfigurations envsConfigurations)
        {
            /*
             * The line below is necessary to invoke log4net and to load its configuration,
             * without this line every logging functionality will be disabled.
             * Follow this link to better understand how log4net configuration works:
             * https://logging.apache.org/log4net/release/manual/configuration.html
             */
            LogManager.GetLogger(typeof(Logger));

            configuration.Bind(envsConfigurations);
            envsConfigurations.Validate();

            var serviceClientFactory     = new ServiceClientFactory(envsConfigurations);
            var decoratorResponseFactory = new DecoratorResponseFactory();

            SetupJsonSerializer();

            services.AddSingleton(envsConfigurations);
            services.AddSingleton(serviceClientFactory);
            services.AddSingleton(decoratorResponseFactory);
        }
 public void Setup()
 {
     _decoratorResponseFactory = new DecoratorResponseFactory();
 }
 public TemplateController(MiaEnvConfiguration miaEnvConfiguration, ServiceClientFactory serviceClientFactory,
                           DecoratorResponseFactory decoratorResponseFactory) : base(miaEnvConfiguration, serviceClientFactory,
                                                                                     decoratorResponseFactory)
 {
 }