Esempio n. 1
0
        public SearchOptionsFactoryTests()
        {
            var searchParameterDefinitionManager = Substitute.For <ISearchParameterDefinitionManager>();

            _resourceTypeSearchParameterInfo = new SearchParameter {
                Name = SearchParameterNames.ResourceType, Code = SearchParameterNames.ResourceType, Type = SearchParamType.String
            }.ToInfo();
            _lastUpdatedSearchParameterInfo = new SearchParameter {
                Name = SearchParameterNames.LastUpdated, Code = SearchParameterNames.LastUpdated, Type = SearchParamType.String
            }.ToInfo();
            searchParameterDefinitionManager.GetSearchParameter(Arg.Any <string>(), Arg.Any <string>()).Throws(ci => new SearchParameterNotSupportedException(ci.ArgAt <string>(0), ci.ArgAt <string>(1)));
            searchParameterDefinitionManager.GetSearchParameter(Arg.Any <string>(), SearchParameterNames.ResourceType).Returns(_resourceTypeSearchParameterInfo);
            searchParameterDefinitionManager.GetSearchParameter(Arg.Any <string>(), SearchParameterNames.LastUpdated).Returns(_lastUpdatedSearchParameterInfo);
            _coreFeatures = new CoreFeatureConfiguration();
            _defaultFhirRequestContext = new DefaultFhirRequestContext();

            _sortingValidator = Substitute.For <ISortingValidator>();

            _factory = new SearchOptionsFactory(
                _expressionParser,
                () => searchParameterDefinitionManager,
                new OptionsWrapper <CoreFeatureConfiguration>(_coreFeatures),
                _defaultFhirRequestContext.SetupAccessor(),
                _sortingValidator,
                NullLogger <SearchOptionsFactory> .Instance);
        }
        public SqlServerFhirDataStore(
            SqlServerDataStoreConfiguration configuration,
            SqlServerFhirModel model,
            SearchParameterToSearchValueTypeMap searchParameterTypeMap,
            VLatest.UpsertResourceTvpGenerator <ResourceMetadata> upsertResourceTvpGeneratorVLatest,
            IOptions <CoreFeatureConfiguration> coreFeatures,
            SqlConnectionWrapperFactory sqlConnectionWrapperFactory,
            ILogger <SqlServerFhirDataStore> logger,
            SchemaInformation schemaInformation)
        {
            EnsureArg.IsNotNull(configuration, nameof(configuration));
            EnsureArg.IsNotNull(model, nameof(model));
            EnsureArg.IsNotNull(searchParameterTypeMap, nameof(searchParameterTypeMap));
            EnsureArg.IsNotNull(upsertResourceTvpGeneratorVLatest, nameof(upsertResourceTvpGeneratorVLatest));
            EnsureArg.IsNotNull(coreFeatures, nameof(coreFeatures));
            EnsureArg.IsNotNull(sqlConnectionWrapperFactory, nameof(sqlConnectionWrapperFactory));
            EnsureArg.IsNotNull(logger, nameof(logger));
            EnsureArg.IsNotNull(schemaInformation, nameof(schemaInformation));

            _configuration                     = configuration;
            _model                             = model;
            _searchParameterTypeMap            = searchParameterTypeMap;
            _upsertResourceTvpGeneratorVLatest = upsertResourceTvpGeneratorVLatest;
            _coreFeatures                      = coreFeatures.Value;
            _sqlConnectionWrapperFactory       = sqlConnectionWrapperFactory;
            _logger                            = logger;
            _schemaInformation                 = schemaInformation;

            _memoryStreamManager = new RecyclableMemoryStreamManager();
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CosmosFhirDataStore"/> class.
        /// </summary>
        /// <param name="documentClientScope">
        /// A function that returns an <see cref="IDocumentClient"/>.
        /// Note that this is a function so that the lifetime of the instance is not directly controlled by the IoC container.
        /// </param>
        /// <param name="cosmosDataStoreConfiguration">The data store configuration.</param>
        /// <param name="namedCosmosCollectionConfigurationAccessor">The IOptions accessor to get a named version.</param>
        /// <param name="cosmosDocumentQueryFactory">The factory used to create the document query.</param>
        /// <param name="retryExceptionPolicyFactory">The retry exception policy factory.</param>
        /// <param name="logger">The logger instance.</param>
        /// <param name="modelInfoProvider">The model provider</param>
        /// <param name="coreFeatures">The core feature configuration</param>
        public CosmosFhirDataStore(
            IScoped <IDocumentClient> documentClientScope,
            CosmosDataStoreConfiguration cosmosDataStoreConfiguration,
            IOptionsMonitor <CosmosCollectionConfiguration> namedCosmosCollectionConfigurationAccessor,
            FhirCosmosDocumentQueryFactory cosmosDocumentQueryFactory,
            RetryExceptionPolicyFactory retryExceptionPolicyFactory,
            ILogger <CosmosFhirDataStore> logger,
            IModelInfoProvider modelInfoProvider,
            IOptions <CoreFeatureConfiguration> coreFeatures)
        {
            EnsureArg.IsNotNull(documentClientScope, nameof(documentClientScope));
            EnsureArg.IsNotNull(cosmosDataStoreConfiguration, nameof(cosmosDataStoreConfiguration));
            EnsureArg.IsNotNull(namedCosmosCollectionConfigurationAccessor, nameof(namedCosmosCollectionConfigurationAccessor));
            EnsureArg.IsNotNull(cosmosDocumentQueryFactory, nameof(cosmosDocumentQueryFactory));
            EnsureArg.IsNotNull(retryExceptionPolicyFactory, nameof(retryExceptionPolicyFactory));
            EnsureArg.IsNotNull(logger, nameof(logger));
            EnsureArg.IsNotNull(modelInfoProvider, nameof(modelInfoProvider));
            EnsureArg.IsNotNull(coreFeatures, nameof(coreFeatures));

            _documentClientScope         = documentClientScope;
            _cosmosDocumentQueryFactory  = cosmosDocumentQueryFactory;
            _retryExceptionPolicyFactory = retryExceptionPolicyFactory;
            _logger            = logger;
            _modelInfoProvider = modelInfoProvider;
            _coreFeatures      = coreFeatures.Value;

            CosmosCollectionConfiguration collectionConfiguration = namedCosmosCollectionConfigurationAccessor.Get(Constants.CollectionConfigurationName);

            DatabaseId    = cosmosDataStoreConfiguration.DatabaseId;
            CollectionId  = collectionConfiguration.CollectionId;
            CollectionUri = cosmosDataStoreConfiguration.GetRelativeCollectionUri(collectionConfiguration.CollectionId);

            _upsertWithHistoryProc = new UpsertWithHistory();
            _hardDelete            = new HardDelete();
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CosmosFhirDataStore"/> class.
        /// </summary>
        /// <param name="containerScope">
        /// A function that returns an <see cref="Container"/>.
        /// Note that this is a function so that the lifetime of the instance is not directly controlled by the IoC container.
        /// </param>
        /// <param name="cosmosDataStoreConfiguration">The data store configuration.</param>
        /// <param name="namedCosmosCollectionConfigurationAccessor">The IOptions accessor to get a named version.</param>
        /// <param name="cosmosQueryFactory">The factory used to create the document query.</param>
        /// <param name="retryExceptionPolicyFactory">The retry exception policy factory.</param>
        /// <param name="logger">The logger instance.</param>
        /// <param name="modelInfoProvider">The model provider</param>
        /// <param name="coreFeatures">The core feature configuration</param>
        public CosmosFhirDataStore(
            IScoped <Container> containerScope,
            CosmosDataStoreConfiguration cosmosDataStoreConfiguration,
            IOptionsMonitor <CosmosCollectionConfiguration> namedCosmosCollectionConfigurationAccessor,
            ICosmosQueryFactory cosmosQueryFactory,
            RetryExceptionPolicyFactory retryExceptionPolicyFactory,
            ILogger <CosmosFhirDataStore> logger,
            IModelInfoProvider modelInfoProvider,
            IOptions <CoreFeatureConfiguration> coreFeatures)
        {
            EnsureArg.IsNotNull(containerScope, nameof(containerScope));
            EnsureArg.IsNotNull(cosmosDataStoreConfiguration, nameof(cosmosDataStoreConfiguration));
            EnsureArg.IsNotNull(namedCosmosCollectionConfigurationAccessor, nameof(namedCosmosCollectionConfigurationAccessor));
            EnsureArg.IsNotNull(cosmosQueryFactory, nameof(cosmosQueryFactory));
            EnsureArg.IsNotNull(retryExceptionPolicyFactory, nameof(retryExceptionPolicyFactory));
            EnsureArg.IsNotNull(logger, nameof(logger));
            EnsureArg.IsNotNull(modelInfoProvider, nameof(modelInfoProvider));
            EnsureArg.IsNotNull(coreFeatures, nameof(coreFeatures));

            _containerScope              = containerScope;
            _cosmosQueryFactory          = cosmosQueryFactory;
            _retryExceptionPolicyFactory = retryExceptionPolicyFactory;
            _logger            = logger;
            _modelInfoProvider = modelInfoProvider;
            _coreFeatures      = coreFeatures.Value;
        }
        public BundlePostConfigureOptions(IOptions <CoreFeatureConfiguration> coreFeatures, IConfiguredConformanceProvider configuredConformanceProvider)
        {
            EnsureArg.IsNotNull(coreFeatures, nameof(coreFeatures));
            EnsureArg.IsNotNull(configuredConformanceProvider, nameof(configuredConformanceProvider));

            _coreFeatures = coreFeatures.Value;
            _configuredConformanceProvider = configuredConformanceProvider;
        }
Esempio n. 6
0
        public SearchOptionsFactoryTests()
        {
            var searchParameterDefinitionManager = Substitute.For <ISearchParameterDefinitionManager>();

            _resourceTypeSearchParameterInfo = new SearchParameter {
                Name = SearchParameterNames.ResourceType, Type = SearchParamType.String
            }.ToInfo();
            searchParameterDefinitionManager.GetSearchParameter(Arg.Any <string>(), Arg.Any <string>()).Throws(ci => new SearchParameterNotSupportedException(ci.ArgAt <string>(0), ci.ArgAt <string>(1)));
            searchParameterDefinitionManager.GetSearchParameter(Arg.Any <string>(), SearchParameterNames.ResourceType).Returns(_resourceTypeSearchParameterInfo);
            _coreFeatures = new CoreFeatureConfiguration();

            _factory = new SearchOptionsFactory(
                _expressionParser,
                () => searchParameterDefinitionManager,
                new OptionsWrapper <CoreFeatureConfiguration>(_coreFeatures),
                NullLogger <SearchOptionsFactory> .Instance);
        }
        public SearchOptionsFactory(
            IExpressionParser expressionParser,
            ISearchParameterDefinitionManager.SearchableSearchParameterDefinitionManagerResolver searchParameterDefinitionManagerResolver,
            IOptions <CoreFeatureConfiguration> featureConfiguration,
            ILogger <SearchOptionsFactory> logger)
        {
            EnsureArg.IsNotNull(expressionParser, nameof(expressionParser));
            EnsureArg.IsNotNull(searchParameterDefinitionManagerResolver, nameof(searchParameterDefinitionManagerResolver));
            EnsureArg.IsNotNull(featureConfiguration?.Value, nameof(featureConfiguration));
            EnsureArg.IsNotNull(logger, nameof(logger));

            _expressionParser = expressionParser;
            _searchParameterDefinitionManager = searchParameterDefinitionManagerResolver();
            _logger = logger;
            _featureConfiguration = featureConfiguration.Value;

            _resourceTypeSearchParameter = _searchParameterDefinitionManager.GetSearchParameter(ResourceType.Resource.ToString(), SearchParameterNames.ResourceType);
        }
Esempio n. 8
0
        private CapabilityStatementBuilder(
            ListedCapabilityStatement statement,
            IModelInfoProvider modelInfoProvider,
            ISearchParameterDefinitionManager searchParameterDefinitionManager,
            IOptions <CoreFeatureConfiguration> configuration,
            IKnowSupportedProfiles supportedProfiles)
        {
            EnsureArg.IsNotNull(statement, nameof(statement));
            EnsureArg.IsNotNull(modelInfoProvider, nameof(modelInfoProvider));
            EnsureArg.IsNotNull(searchParameterDefinitionManager, nameof(searchParameterDefinitionManager));
            EnsureArg.IsNotNull(configuration, nameof(configuration));
            EnsureArg.IsNotNull(supportedProfiles, nameof(supportedProfiles));

            _statement         = statement;
            _modelInfoProvider = modelInfoProvider;
            _searchParameterDefinitionManager = searchParameterDefinitionManager;
            _configuration     = configuration.Value;
            _supportedProfiles = supportedProfiles;
        }
Esempio n. 9
0
        public SqlServerFhirDataStore(
            ISqlServerFhirModel model,
            SearchParameterToSearchValueTypeMap searchParameterTypeMap,
            V6.UpsertResourceTvpGenerator <ResourceMetadata> upsertResourceTvpGeneratorV6,
            V7.UpsertResourceTvpGenerator <ResourceMetadata> upsertResourceTvpGeneratorV7,
            V13.UpsertResourceTvpGenerator <IReadOnlyList <ResourceWrapper> > upsertResourceTvpGeneratorV13,
            V17.UpsertResourceTvpGenerator <IReadOnlyList <ResourceWrapper> > upsertResourceTvpGeneratorV17,
            V18.UpsertResourceTvpGenerator <IReadOnlyList <ResourceWrapper> > upsertResourceTvpGeneratorV18,
            VLatest.UpsertResourceTvpGenerator <IReadOnlyList <ResourceWrapper> > upsertResourceTvpGeneratorVLatest,
            V17.ReindexResourceTvpGenerator <IReadOnlyList <ResourceWrapper> > reindexResourceTvpGeneratorV17,
            VLatest.ReindexResourceTvpGenerator <IReadOnlyList <ResourceWrapper> > reindexResourceTvpGeneratorVLatest,
            V17.BulkReindexResourcesTvpGenerator <IReadOnlyList <ResourceWrapper> > bulkReindexResourcesTvpGeneratorV17,
            VLatest.BulkReindexResourcesTvpGenerator <IReadOnlyList <ResourceWrapper> > bulkReindexResourcesTvpGeneratorVLatest,
            IOptions <CoreFeatureConfiguration> coreFeatures,
            SqlConnectionWrapperFactory sqlConnectionWrapperFactory,
            ICompressedRawResourceConverter compressedRawResourceConverter,
            ILogger <SqlServerFhirDataStore> logger,
            SchemaInformation schemaInformation,
            IModelInfoProvider modelInfoProvider)
        {
            _model = EnsureArg.IsNotNull(model, nameof(model));
            _searchParameterTypeMap                  = EnsureArg.IsNotNull(searchParameterTypeMap, nameof(searchParameterTypeMap));
            _upsertResourceTvpGeneratorV6            = EnsureArg.IsNotNull(upsertResourceTvpGeneratorV6, nameof(upsertResourceTvpGeneratorV6));
            _upsertResourceTvpGeneratorV7            = EnsureArg.IsNotNull(upsertResourceTvpGeneratorV7, nameof(upsertResourceTvpGeneratorV7));
            _upsertResourceTvpGeneratorV13           = EnsureArg.IsNotNull(upsertResourceTvpGeneratorV13, nameof(upsertResourceTvpGeneratorV13));
            _upsertResourceTvpGeneratorV17           = EnsureArg.IsNotNull(upsertResourceTvpGeneratorV17, nameof(upsertResourceTvpGeneratorV17));
            _upsertResourceTvpGeneratorV18           = EnsureArg.IsNotNull(upsertResourceTvpGeneratorV18, nameof(upsertResourceTvpGeneratorV18));
            _upsertResourceTvpGeneratorVLatest       = EnsureArg.IsNotNull(upsertResourceTvpGeneratorVLatest, nameof(upsertResourceTvpGeneratorVLatest));
            _reindexResourceTvpGeneratorV17          = EnsureArg.IsNotNull(reindexResourceTvpGeneratorV17, nameof(reindexResourceTvpGeneratorV17));
            _reindexResourceTvpGeneratorVLatest      = EnsureArg.IsNotNull(reindexResourceTvpGeneratorVLatest, nameof(reindexResourceTvpGeneratorVLatest));
            _bulkReindexResourcesTvpGeneratorV17     = EnsureArg.IsNotNull(bulkReindexResourcesTvpGeneratorV17, nameof(bulkReindexResourcesTvpGeneratorV17));
            _bulkReindexResourcesTvpGeneratorVLatest = EnsureArg.IsNotNull(bulkReindexResourcesTvpGeneratorVLatest, nameof(bulkReindexResourcesTvpGeneratorVLatest));
            _coreFeatures = EnsureArg.IsNotNull(coreFeatures?.Value, nameof(coreFeatures));
            _sqlConnectionWrapperFactory    = EnsureArg.IsNotNull(sqlConnectionWrapperFactory, nameof(sqlConnectionWrapperFactory));
            _compressedRawResourceConverter = EnsureArg.IsNotNull(compressedRawResourceConverter, nameof(compressedRawResourceConverter));
            _logger            = EnsureArg.IsNotNull(logger, nameof(logger));
            _schemaInformation = EnsureArg.IsNotNull(schemaInformation, nameof(schemaInformation));
            _modelInfoProvider = EnsureArg.IsNotNull(modelInfoProvider, nameof(modelInfoProvider));

            _memoryStreamManager = new RecyclableMemoryStreamManager();
        }
        public SqlServerFhirDataStore(
            ISqlServerFhirModel model,
            SearchParameterToSearchValueTypeMap searchParameterTypeMap,
            V6.UpsertResourceTvpGenerator <ResourceMetadata> upsertResourceTvpGeneratorV6,
            V7.UpsertResourceTvpGenerator <ResourceMetadata> upsertResourceTvpGeneratorV7,
            VLatest.UpsertResourceTvpGenerator <IReadOnlyList <ResourceWrapper> > upsertResourceTvpGeneratorVLatest,
            VLatest.ReindexResourceTvpGenerator <IReadOnlyList <ResourceWrapper> > reindexResourceTvpGeneratorVLatest,
            VLatest.BulkReindexResourcesTvpGenerator <IReadOnlyList <ResourceWrapper> > bulkReindexResourcesTvpGeneratorVLatest,
            IOptions <CoreFeatureConfiguration> coreFeatures,
            SqlConnectionWrapperFactory sqlConnectionWrapperFactory,
            ILogger <SqlServerFhirDataStore> logger,
            SchemaInformation schemaInformation)
        {
            EnsureArg.IsNotNull(model, nameof(model));
            EnsureArg.IsNotNull(searchParameterTypeMap, nameof(searchParameterTypeMap));
            EnsureArg.IsNotNull(upsertResourceTvpGeneratorV6, nameof(upsertResourceTvpGeneratorV6));
            EnsureArg.IsNotNull(upsertResourceTvpGeneratorV7, nameof(upsertResourceTvpGeneratorV7));
            EnsureArg.IsNotNull(upsertResourceTvpGeneratorVLatest, nameof(upsertResourceTvpGeneratorVLatest));
            EnsureArg.IsNotNull(reindexResourceTvpGeneratorVLatest, nameof(reindexResourceTvpGeneratorVLatest));
            EnsureArg.IsNotNull(bulkReindexResourcesTvpGeneratorVLatest, nameof(bulkReindexResourcesTvpGeneratorVLatest));
            EnsureArg.IsNotNull(coreFeatures, nameof(coreFeatures));
            EnsureArg.IsNotNull(sqlConnectionWrapperFactory, nameof(sqlConnectionWrapperFactory));
            EnsureArg.IsNotNull(logger, nameof(logger));
            EnsureArg.IsNotNull(schemaInformation, nameof(schemaInformation));

            _model = model;
            _searchParameterTypeMap                  = searchParameterTypeMap;
            _upsertResourceTvpGeneratorV6            = upsertResourceTvpGeneratorV6;
            _upsertResourceTvpGeneratorV7            = upsertResourceTvpGeneratorV7;
            _upsertResourceTvpGeneratorVLatest       = upsertResourceTvpGeneratorVLatest;
            _reindexResourceTvpGeneratorVLatest      = reindexResourceTvpGeneratorVLatest;
            _bulkReindexResourcesTvpGeneratorVLatest = bulkReindexResourcesTvpGeneratorVLatest;
            _coreFeatures = coreFeatures.Value;
            _sqlConnectionWrapperFactory = sqlConnectionWrapperFactory;
            _logger            = logger;
            _schemaInformation = schemaInformation;

            _memoryStreamManager = new RecyclableMemoryStreamManager();
        }
Esempio n. 11
0
        public SqlServerFhirDataStore(
            SqlServerDataStoreConfiguration configuration,
            SqlServerFhirModel model,
            SearchParameterToSearchValueTypeMap searchParameterTypeMap,
            V1.UpsertResourceTvpGenerator <ResourceMetadata> upsertResourceTvpGenerator,
            ILogger <SqlServerFhirDataStore> logger,
            IOptions <CoreFeatureConfiguration> coreFeatures)
        {
            EnsureArg.IsNotNull(configuration, nameof(configuration));
            EnsureArg.IsNotNull(model, nameof(model));
            EnsureArg.IsNotNull(searchParameterTypeMap, nameof(searchParameterTypeMap));
            EnsureArg.IsNotNull(upsertResourceTvpGenerator, nameof(upsertResourceTvpGenerator));
            EnsureArg.IsNotNull(logger, nameof(logger));
            EnsureArg.IsNotNull(coreFeatures, nameof(coreFeatures));

            _configuration              = configuration;
            _model                      = model;
            _searchParameterTypeMap     = searchParameterTypeMap;
            _upsertResourceTvpGenerator = upsertResourceTvpGenerator;
            _logger                     = logger;
            _memoryStreamManager        = new RecyclableMemoryStreamManager();
            _coreFeatures               = coreFeatures.Value;
        }