Example #1
0
        public TestEngineService(
            ICacheProvider cacheProvider,
            ISpecificationRepository specificationRepository,
            ILogger logger,
            ITestEngine testEngine,
            IScenariosRepository scenariosRepository,
            IProviderSourceDatasetsRepository providerSourceDatasetsRepository,
            ITestResultsService testResultsService,
            ITestResultsRepository testResultsRepository,
            IBuildProjectRepository buildProjectRepository,
            ITelemetry telemetry,
            ITestRunnerResiliencePolicies resiliencePolicies,
            ICalculationsRepository calculationsRepository)
        {
            _cacheProvider           = cacheProvider;
            _specificationRepository = specificationRepository;
            _logger              = logger;
            _testEngine          = testEngine;
            _scenariosRepository = scenariosRepository;
            _providerSourceDatasetsRepository = providerSourceDatasetsRepository;
            _testResultsService    = testResultsService;
            _testResultsRepository = testResultsRepository;
            _telemetry             = telemetry;

            _cacheProviderPolicy                    = resiliencePolicies.CacheProviderRepository;
            _specificationRepositoryPolicy          = resiliencePolicies.SpecificationRepository;
            _scenariosRepositoryPolicy              = resiliencePolicies.ScenariosRepository;
            _providerSourceDatasetsRepositoryPolicy = resiliencePolicies.ProviderSourceDatasetsRepository;
            _testResultsRepositoryPolicy            = resiliencePolicies.TestResultsRepository;
            _builProjectsRepositoryPolicy           = resiliencePolicies.BuildProjectRepository;
            _buildProjectRepository                 = buildProjectRepository;
            _calculationsRepository                 = calculationsRepository;
        }
        public void Initialize()
        {
            _calculationEngine                = Substitute.For <ICalculationEngine>();
            _providersApiClient               = Substitute.For <IProvidersApiClient>();
            _specificationsApiClient          = Substitute.For <ISpecificationsApiClient>();
            _providerSourceDatasetsRepository = Substitute.For <IProviderSourceDatasetsRepository>();
            _calculationAggregationService    = Substitute.For <ICalculationAggregationService>();
            _calculationsRepository           = Substitute.For <ICalculationsRepository>();
            _logger = Substitute.For <ILogger>();
            _mapper = CreateMapper();

            _calculatorResiliencePolicies = new CalculatorResiliencePolicies
            {
                SpecificationsApiClient = Policy.NoOpAsync(),
                ProvidersApiClient      = Policy.NoOpAsync(),
                CalculationsApiClient   = Policy.NoOpAsync()
            };

            _calculationEnginePreviewService = new CalculationEnginePreviewService(
                _calculationEngine,
                _providersApiClient,
                _mapper,
                _calculatorResiliencePolicies,
                _specificationsApiClient,
                _providerSourceDatasetsRepository,
                _calculationAggregationService,
                _calculationsRepository,
                _logger);
        }
Example #3
0
 public AllocationModelDebugRunner(ILogger logger, IFeatureToggle featureToggles, IProviderSourceDatasetsRepository providerSourceDatasetsRepository, IProviderService providerService)
 {
     _logger         = logger;
     _featureToggles = featureToggles;
     _providerSourceDatasetsRepository = providerSourceDatasetsRepository;
     _providerService = providerService;
 }
        public TestEngineService(
            ICacheProvider cacheProvider,
            ISpecificationsApiClient specificationsApiClient,
            ILogger logger,
            ITestEngine testEngine,
            IScenariosRepository scenariosRepository,
            IProviderSourceDatasetsRepository providerSourceDatasetsRepository,
            ITestResultsService testResultsService,
            ITestResultsRepository testResultsRepository,
            ICalculationsApiClient calcsApiClient,
            ITelemetry telemetry,
            ITestRunnerResiliencePolicies resiliencePolicies,
            ICalculationsRepository calculationsRepository,
            IMapper mapper)
        {
            Guard.ArgumentNotNull(cacheProvider, nameof(cacheProvider));
            Guard.ArgumentNotNull(specificationsApiClient, nameof(specificationsApiClient));
            Guard.ArgumentNotNull(logger, nameof(logger));
            Guard.ArgumentNotNull(testEngine, nameof(testEngine));
            Guard.ArgumentNotNull(scenariosRepository, nameof(scenariosRepository));
            Guard.ArgumentNotNull(providerSourceDatasetsRepository, nameof(providerSourceDatasetsRepository));
            Guard.ArgumentNotNull(testResultsService, nameof(testResultsService));
            Guard.ArgumentNotNull(testResultsRepository, nameof(testResultsRepository));
            Guard.ArgumentNotNull(telemetry, nameof(telemetry));
            Guard.ArgumentNotNull(resiliencePolicies?.CacheProviderRepository, nameof(resiliencePolicies.CacheProviderRepository));
            Guard.ArgumentNotNull(resiliencePolicies?.SpecificationsApiClient, nameof(resiliencePolicies.SpecificationsApiClient));
            Guard.ArgumentNotNull(resiliencePolicies?.ScenariosRepository, nameof(resiliencePolicies.ScenariosRepository));
            Guard.ArgumentNotNull(resiliencePolicies?.ProviderSourceDatasetsRepository, nameof(resiliencePolicies.ProviderSourceDatasetsRepository));
            Guard.ArgumentNotNull(resiliencePolicies?.TestResultsRepository, nameof(resiliencePolicies.TestResultsRepository));
            Guard.ArgumentNotNull(resiliencePolicies?.CalculationsApiClient, nameof(resiliencePolicies.CalculationsApiClient));;
            Guard.ArgumentNotNull(resiliencePolicies?.SpecificationsApiClient, nameof(resiliencePolicies.SpecificationsApiClient));
            Guard.ArgumentNotNull(calcsApiClient, nameof(calcsApiClient));
            Guard.ArgumentNotNull(calculationsRepository, nameof(calculationsRepository));
            Guard.ArgumentNotNull(mapper, nameof(mapper));

            _cacheProvider           = cacheProvider;
            _specificationsApiClient = specificationsApiClient;
            _logger              = logger;
            _testEngine          = testEngine;
            _scenariosRepository = scenariosRepository;
            _providerSourceDatasetsRepository = providerSourceDatasetsRepository;
            _testResultsService    = testResultsService;
            _testResultsRepository = testResultsRepository;
            _telemetry             = telemetry;
            _mapper = mapper;

            _cacheProviderPolicy       = resiliencePolicies.CacheProviderRepository;
            _scenariosRepositoryPolicy = resiliencePolicies.ScenariosRepository;
            _providerSourceDatasetsRepositoryPolicy = resiliencePolicies.ProviderSourceDatasetsRepository;
            _testResultsRepositoryPolicy            = resiliencePolicies.TestResultsRepository;
            _calcsApiClientPolicy          = resiliencePolicies.CalculationsApiClient;
            _calcsApiClient                = calcsApiClient;
            _calculationsRepository        = calculationsRepository;
            _specificationsApiClientPolicy = resiliencePolicies.SpecificationsApiClient;
        }
 protected static ProcessDatasetService CreateProcessDatasetService(
     IBlobClient blobClient             = null,
     IMessengerService messengerService = null,
     ILogger logger = null,
     IDatasetRepository datasetRepository                        = null,
     IExcelDatasetReader excelDatasetReader                      = null,
     ICacheProvider cacheProvider                                = null,
     ICalcsRepository calcsRepository                            = null,
     IProvidersApiClient providersApiClient                      = null,
     ISpecificationsApiClient specificationsApiClient            = null,
     IProviderSourceDatasetsRepository providerResultsRepository = null,
     ITelemetry telemetry = null,
     IDatasetsResiliencePolicies datasetsResiliencePolicies         = null,
     IDatasetsAggregationsRepository datasetsAggregationsRepository = null,
     IFeatureToggle featureToggle = null,
     IMapper mapper = null,
     IJobManagement jobManagement = null,
     IProviderSourceDatasetVersionKeyProvider versionKeyProvider = null,
     IJobsApiClient jobsApiClient = null,
     IVersionBulkRepository <ProviderSourceDatasetVersion> versionBulkRepository = null,
     IProviderSourceDatasetBulkRepository providerSourceDatasetBulkRepository    = null)
 {
     return(new ProcessDatasetService(
                datasetRepository ?? CreateDatasetsRepository(),
                excelDatasetReader ?? CreateExcelDatasetReader(),
                cacheProvider ?? CreateCacheProvider(),
                calcsRepository ?? CreateCalcsRepository(),
                blobClient ?? CreateBlobClient(),
                messengerService ?? CreateMessengerService(),
                providerResultsRepository ?? CreateProviderResultsRepository(),
                providersApiClient ?? CreateProvidersApiClient(),
                specificationsApiClient ?? CreateSpecificationsApiClient(),
                logger ?? CreateLogger(),
                datasetsResiliencePolicies ?? DatasetsResilienceTestHelper.GenerateTestPolicies(),
                datasetsAggregationsRepository ?? CreateDatasetsAggregationsRepository(),
                featureToggle ?? CreateFeatureToggle(),
                mapper ?? CreateMapper(),
                jobManagement ?? CreateJobManagement(),
                versionKeyProvider ?? CreateDatasetVersionKeyProvider(),
                versionBulkRepository ?? new Mock <IVersionBulkRepository <ProviderSourceDatasetVersion> >().Object,
                providerSourceDatasetBulkRepository ?? new Mock <IProviderSourceDatasetBulkRepository>().Object));
 }
        public CalculationEngineService(
            ILogger logger,
            ICalculationEngine calculationEngine,
            ICacheProvider cacheProvider,
            IMessengerService messengerService,
            IProviderSourceDatasetsRepository providerSourceDatasetsRepository,
            ITelemetry telemetry,
            IProviderResultsRepository providerResultsRepository,
            ICalculationsRepository calculationsRepository,
            EngineSettings engineSettings,
            ICalculatorResiliencePolicies resiliencePolicies,
            IValidator <ICalculatorResiliencePolicies> calculatorResiliencePoliciesValidator,
            IDatasetAggregationsRepository datasetAggregationsRepository,
            IFeatureToggle featureToggle,
            IJobsApiClient jobsApiClient)
        {
            _calculatorResiliencePoliciesValidator = calculatorResiliencePoliciesValidator;

            CalculationEngineServiceValidator.ValidateConstruction(_calculatorResiliencePoliciesValidator,
                                                                   engineSettings, resiliencePolicies, calculationsRepository);

            _logger            = logger;
            _calculationEngine = calculationEngine;
            _cacheProvider     = cacheProvider;
            _messengerService  = messengerService;
            _providerSourceDatasetsRepository = providerSourceDatasetsRepository;
            _telemetry = telemetry;
            _providerResultsRepository = providerResultsRepository;
            _calculationsRepository    = calculationsRepository;
            _engineSettings            = engineSettings;
            _cacheProviderPolicy       = resiliencePolicies.CacheProvider;
            _messengerServicePolicy    = resiliencePolicies.Messenger;
            _providerSourceDatasetsRepositoryPolicy = resiliencePolicies.ProviderSourceDatasetsRepository;
            _providerResultsRepositoryPolicy        = resiliencePolicies.ProviderResultsRepository;
            _calculationsRepositoryPolicy           = resiliencePolicies.CalculationsRepository;
            _datasetAggregationsRepository          = datasetAggregationsRepository;
            _featureToggle       = featureToggle;
            _jobsApiClient       = jobsApiClient;
            _jobsApiClientPolicy = resiliencePolicies.JobsApiClient;
        }
Example #7
0
        public CalculationEnginePreviewService(
            ICalculationEngine calculationEngine,
            IProvidersApiClient providersApiClient,
            IMapper mapper,
            ICalculatorResiliencePolicies resiliencePolicies,
            ISpecificationsApiClient specificationsApiClient,
            IProviderSourceDatasetsRepository providerSourceDatasetsRepository,
            ICalculationAggregationService calculationAggregationService,
            ICalculationsRepository calculationsRepository,
            ILogger logger)
        {
            Guard.ArgumentNotNull(calculationEngine, nameof(calculationEngine));
            Guard.ArgumentNotNull(providersApiClient, nameof(providersApiClient));
            Guard.ArgumentNotNull(mapper, nameof(mapper));
            Guard.ArgumentNotNull(providerSourceDatasetsRepository, nameof(providerSourceDatasetsRepository));
            Guard.ArgumentNotNull(calculationAggregationService, nameof(calculationAggregationService));
            Guard.ArgumentNotNull(calculationsRepository, nameof(calculationsRepository));
            Guard.ArgumentNotNull(logger, nameof(logger));

            Guard.ArgumentNotNull(resiliencePolicies, nameof(resiliencePolicies));
            Guard.ArgumentNotNull(resiliencePolicies.SpecificationsApiClient, nameof(resiliencePolicies.SpecificationsApiClient));
            Guard.ArgumentNotNull(resiliencePolicies.ProvidersApiClient, nameof(resiliencePolicies.ProvidersApiClient));
            Guard.ArgumentNotNull(resiliencePolicies.CalculationsApiClient, nameof(resiliencePolicies.CalculationsApiClient));

            _calculationEngine                = calculationEngine;
            _providersApiClient               = providersApiClient;
            _mapper                           = mapper;
            _specificationsApiClient          = specificationsApiClient;
            _providerSourceDatasetsRepository = providerSourceDatasetsRepository;
            _calculationAggregationService    = calculationAggregationService;
            _specificationsApiPolicy          = resiliencePolicies.SpecificationsApiClient;
            _providersApiClientPolicy         = resiliencePolicies.ProvidersApiClient;
            _calculationsApiClientPolicy      = resiliencePolicies.CalculationsApiClient;
            _calculationsRepository           = calculationsRepository;
            _logger                           = logger;
        }
        public CalculationEngineService(
            ILogger logger,
            ICalculationEngine calculationEngine,
            ICacheProvider cacheProvider,
            IMessengerService messengerService,
            IProviderSourceDatasetsRepository providerSourceDatasetsRepository,
            ITelemetry telemetry,
            IProviderResultsRepository providerResultsRepository,
            ICalculationsRepository calculationsRepository,
            EngineSettings engineSettings,
            ICalculatorResiliencePolicies resiliencePolicies,
            IJobManagement jobManagement,
            ISpecificationsApiClient specificationsApiClient,
            IResultsApiClient resultsApiClient,
            IValidator <ICalculatorResiliencePolicies> calculatorResiliencePoliciesValidator,
            ICalculationEngineServiceValidator calculationEngineServiceValidator,
            ICalculationAggregationService calculationAggregationService,
            IAssemblyService assemblyService) : base(jobManagement, logger)
        {
            Guard.ArgumentNotNull(logger, nameof(logger));
            Guard.ArgumentNotNull(calculationEngine, nameof(calculationEngine));
            Guard.ArgumentNotNull(cacheProvider, nameof(cacheProvider));
            Guard.ArgumentNotNull(messengerService, nameof(messengerService));
            Guard.ArgumentNotNull(providerSourceDatasetsRepository, nameof(providerSourceDatasetsRepository));
            Guard.ArgumentNotNull(telemetry, nameof(telemetry));
            Guard.ArgumentNotNull(providerResultsRepository, nameof(providerResultsRepository));
            Guard.ArgumentNotNull(calculationsRepository, nameof(calculationsRepository));
            Guard.ArgumentNotNull(engineSettings, nameof(engineSettings));
            Guard.ArgumentNotNull(resiliencePolicies?.SpecificationsApiClient, nameof(resiliencePolicies.SpecificationsApiClient));
            Guard.ArgumentNotNull(resiliencePolicies?.CacheProvider, nameof(resiliencePolicies.CacheProvider));
            Guard.ArgumentNotNull(resiliencePolicies?.Messenger, nameof(resiliencePolicies.Messenger));
            Guard.ArgumentNotNull(resiliencePolicies?.ProviderSourceDatasetsRepository, nameof(resiliencePolicies.ProviderSourceDatasetsRepository));
            Guard.ArgumentNotNull(resiliencePolicies?.CalculationResultsRepository, nameof(resiliencePolicies.CalculationResultsRepository));
            Guard.ArgumentNotNull(resiliencePolicies?.CalculationsApiClient, nameof(resiliencePolicies.CalculationsApiClient));
            Guard.ArgumentNotNull(resiliencePolicies?.ResultsApiClient, nameof(resiliencePolicies.ResultsApiClient));
            Guard.ArgumentNotNull(specificationsApiClient, nameof(specificationsApiClient));
            Guard.ArgumentNotNull(calculatorResiliencePoliciesValidator, nameof(calculatorResiliencePoliciesValidator));
            Guard.ArgumentNotNull(calculationEngineServiceValidator, nameof(calculationEngineServiceValidator));
            Guard.ArgumentNotNull(resultsApiClient, nameof(resultsApiClient));
            Guard.ArgumentNotNull(calculationAggregationService, nameof(calculationAggregationService));
            Guard.ArgumentNotNull(assemblyService, nameof(assemblyService));

            _calculationEngineServiceValidator = calculationEngineServiceValidator;
            _logger            = logger;
            _calculationEngine = calculationEngine;
            _cacheProvider     = cacheProvider;
            _messengerService  = messengerService;
            _providerSourceDatasetsRepository = providerSourceDatasetsRepository;
            _telemetry = telemetry;
            _providerResultsRepository = providerResultsRepository;
            _calculationsRepository    = calculationsRepository;
            _engineSettings            = engineSettings;
            _cacheProviderPolicy       = resiliencePolicies.CacheProvider;
            _messengerServicePolicy    = resiliencePolicies.Messenger;
            _providerSourceDatasetsRepositoryPolicy = resiliencePolicies.ProviderSourceDatasetsRepository;
            _providerResultsRepositoryPolicy        = resiliencePolicies.CalculationResultsRepository;
            _calculationsApiClientPolicy            = resiliencePolicies.CalculationsApiClient;
            _specificationsApiClient       = specificationsApiClient;
            _specificationsApiPolicy       = resiliencePolicies.SpecificationsApiClient;
            _resultsApiClientPolicy        = resiliencePolicies.ResultsApiClient;
            _resultsApiClient              = resultsApiClient;
            _calculationAggregationService = calculationAggregationService;
            _assemblyService = assemblyService;

            _typeIdentifierGenerator = new VisualBasicTypeIdentifierGenerator();
        }