Ejemplo n.º 1
0
        public DeleteServiceTests()
        {
            _indexDataStore        = Substitute.For <IIndexDataStore>();
            _metadataStore         = Substitute.For <IMetadataStore>();
            _fileDataStore         = Substitute.For <IFileStore>();
            _indexDataStoreFactory = Substitute.For <IIndexDataStoreFactory>();
            _deleteConfiguration   = new DeletedInstanceCleanupConfiguration
            {
                DeleteDelay     = TimeSpan.FromDays(1),
                BatchSize       = 10,
                MaxRetries      = 5,
                PollingInterval = TimeSpan.FromSeconds(1),
                RetryBackOff    = TimeSpan.FromDays(4),
            };

            IOptions <DeletedInstanceCleanupConfiguration> deletedInstanceCleanupConfigurationOptions = Substitute.For <IOptions <DeletedInstanceCleanupConfiguration> >();

            deletedInstanceCleanupConfigurationOptions.Value.Returns(_deleteConfiguration);
            ITransactionHandler transactionHandler = Substitute.For <ITransactionHandler>();

            _transactionScope = Substitute.For <ITransactionScope>();
            transactionHandler.BeginTransaction().Returns(_transactionScope);

            _indexDataStoreFactory.GetInstance().Returns(_indexDataStore);
            _deleteService = new DeleteService(_indexDataStoreFactory, _metadataStore, _fileDataStore, deletedInstanceCleanupConfigurationOptions, transactionHandler, NullLogger <DeleteService> .Instance);
        }
Ejemplo n.º 2
0
        public BackgroundServiceHealthCheck(
            IIndexDataStoreFactory indexDataStoreFactory,
            IOptions <DeletedInstanceCleanupConfiguration> deletedInstanceCleanupConfiguration,
            TelemetryClient telemetryClient,
            BackgroundServiceHealthCheckCache backgroundServiceHealthCheckCache)
        {
            EnsureArg.IsNotNull(indexDataStoreFactory, nameof(indexDataStoreFactory));
            EnsureArg.IsNotNull(deletedInstanceCleanupConfiguration?.Value, nameof(deletedInstanceCleanupConfiguration));
            EnsureArg.IsNotNull(telemetryClient, nameof(telemetryClient));
            EnsureArg.IsNotNull(backgroundServiceHealthCheckCache, nameof(backgroundServiceHealthCheckCache));

            _indexDataStore = indexDataStoreFactory.GetInstance();
            _deletedInstanceCleanupConfiguration = deletedInstanceCleanupConfiguration.Value;
            _telemetryClient = telemetryClient;
            _backgroundServiceHealthCheckCache = backgroundServiceHealthCheckCache;
        }
        public StoreOrchestrator(
            IFileStore fileStore,
            IMetadataStore metadataStore,
            IIndexDataStoreFactory indexDataStoreFactory,
            IDeleteService deleteService,
            IQueryTagService queryTagService)
        {
            EnsureArg.IsNotNull(fileStore, nameof(fileStore));
            EnsureArg.IsNotNull(metadataStore, nameof(metadataStore));
            EnsureArg.IsNotNull(indexDataStoreFactory, nameof(indexDataStoreFactory));
            EnsureArg.IsNotNull(deleteService, nameof(deleteService));
            EnsureArg.IsNotNull(queryTagService, nameof(queryTagService));

            _fileStore       = fileStore;
            _metadataStore   = metadataStore;
            _deleteService   = deleteService;
            _queryTagService = queryTagService;
            _indexDataStore  = indexDataStoreFactory.GetInstance();
        }
        public StoreOrchestratorTests()
        {
            _dicomDataset = new DicomDataset()
            {
                { DicomTag.StudyInstanceUID, DefaultStudyInstanceUid },
                { DicomTag.SeriesInstanceUID, DefaultSeriesInstanceUid },
                { DicomTag.SOPInstanceUID, DefaultSopInstanceUid },
            };

            _dicomInstanceEntry.GetDicomDatasetAsync(DefaultCancellationToken).Returns(_dicomDataset);
            _dicomInstanceEntry.GetStreamAsync(DefaultCancellationToken).Returns(_stream);

            _indexDataStoreFactory.GetInstance().Returns(_indexDataStore);

            _indexDataStore.CreateInstanceIndexAsync(_dicomDataset, DefaultCancellationToken).Returns(DefaultVersion);
            _queryTagService.GetQueryTagsAsync(Arg.Any <CancellationToken>())
            .Returns(Array.Empty <QueryTag>());

            _storeOrchestrator = new StoreOrchestrator(_fileStore, _metadataStore, _indexDataStoreFactory, _deleteService, _queryTagService);
        }
Ejemplo n.º 5
0
        public DeleteService(
            IIndexDataStoreFactory indexDataStoreFactory,
            IMetadataStore metadataStore,
            IFileStore fileStore,
            IOptions <DeletedInstanceCleanupConfiguration> deletedInstanceCleanupConfiguration,
            ITransactionHandler transactionHandler,
            ILogger <DeleteService> logger)
        {
            EnsureArg.IsNotNull(indexDataStoreFactory, nameof(indexDataStoreFactory));
            EnsureArg.IsNotNull(metadataStore, nameof(metadataStore));
            EnsureArg.IsNotNull(fileStore, nameof(fileStore));
            EnsureArg.IsNotNull(deletedInstanceCleanupConfiguration?.Value, nameof(deletedInstanceCleanupConfiguration));
            EnsureArg.IsNotNull(transactionHandler, nameof(transactionHandler));
            EnsureArg.IsNotNull(logger, nameof(logger));

            _indexDataStore = indexDataStoreFactory.GetInstance();
            _metadataStore  = metadataStore;
            _fileStore      = fileStore;
            _deletedInstanceCleanupConfiguration = deletedInstanceCleanupConfiguration.Value;
            _transactionHandler = transactionHandler;
            _logger             = logger;
        }