public async Task GivenAnExistingDicomInstance_WhenDeletedByStudyId_ThenItShouldBeRemovedAndAddedToDeletedInstanceTable() { string studyInstanceUid = TestUidGenerator.Generate(); string seriesInstanceUid = TestUidGenerator.Generate(); string sopInstanceUid = TestUidGenerator.Generate(); Instance instance = await CreateIndexAndVerifyInstance(studyInstanceUid, seriesInstanceUid, sopInstanceUid); await _indexDataStore.DeleteStudyIndexAsync(studyInstanceUid, Clock.UtcNow); Assert.Empty(await _testHelper.GetInstancesAsync(studyInstanceUid, seriesInstanceUid, sopInstanceUid)); Assert.Empty(await _testHelper.GetSeriesMetadataAsync(seriesInstanceUid)); Assert.Empty(await _testHelper.GetStudyMetadataAsync(seriesInstanceUid)); Assert.Collection(await _testHelper.GetDeletedInstanceEntriesAsync(studyInstanceUid, seriesInstanceUid, sopInstanceUid), ValidateSingleDeletedInstance(instance)); }
public async Task GivenStudyWithMultileInstances_WhenDeleteStudy_ThenAssociatedErrorsShouldBeRemoved() { string studyUid1 = TestUidGenerator.Generate(); string seriesUid1 = TestUidGenerator.Generate(); string instanceUid1 = TestUidGenerator.Generate(); string seriesUid2 = TestUidGenerator.Generate(); string instanceUid2 = TestUidGenerator.Generate(); string studyUid3 = TestUidGenerator.Generate(); string seriesUid3 = TestUidGenerator.Generate(); string instanceUid3 = TestUidGenerator.Generate(); // add instances: instance1 and instance2 are in same study long watermark1 = await AddInstanceAsync(studyUid1, seriesUid1, instanceUid1); long watermark2 = await AddInstanceAsync(studyUid1, seriesUid2, instanceUid2); long watermark3 = await AddInstanceAsync(studyUid3, seriesUid3, instanceUid3); // add tag DicomTag tag = DicomTag.DeviceSerialNumber; int tagKey = await AddTagAsync(tag); // add errors ValidationErrorCode errorCode = ValidationErrorCode.DateIsInvalid; await _extendedQueryTagErrorStore.AddExtendedQueryTagErrorAsync(tagKey, errorCode, watermark1); await _extendedQueryTagErrorStore.AddExtendedQueryTagErrorAsync(tagKey, errorCode, watermark2); await _extendedQueryTagErrorStore.AddExtendedQueryTagErrorAsync(tagKey, errorCode, watermark3); // delete instance await _indexDataStore.DeleteStudyIndexAsync(DefaultPartition.Key, studyUid1, DateTime.UtcNow); // check errors var errors = await _extendedQueryTagErrorStore.GetExtendedQueryTagErrorsAsync(tag.GetPath(), int.MaxValue, 0); Assert.Single(errors); Assert.Equal(studyUid3, errors[0].StudyInstanceUid); Assert.Equal(seriesUid3, errors[0].SeriesInstanceUid); Assert.Equal(instanceUid3, errors[0].SopInstanceUid); }
/// <inheritdoc /> public async Task DeleteStudyIndexAsync(string studyInstanceUid, DateTimeOffset cleanupAfter, CancellationToken cancellationToken) { LogDeleteStudyInstanceIndexDelegate(_logger, studyInstanceUid, cleanupAfter, null); try { await _indexDataStore.DeleteStudyIndexAsync(studyInstanceUid, cleanupAfter, cancellationToken); LogOperationSucceededDelegate(_logger, null); } catch (Exception ex) { LogOperationFailedDelegate(_logger, ex); throw; } }
public async Task DeleteStudyAsync(string studyInstanceUid, CancellationToken cancellationToken) { DateTimeOffset cleanupAfter = GenerateCleanupAfter(_deletedInstanceCleanupConfiguration.DeleteDelay); await _indexDataStore.DeleteStudyIndexAsync(studyInstanceUid, cleanupAfter, cancellationToken); }
public Task DeleteStudyAsync(string studyInstanceUid, CancellationToken cancellationToken) { DateTimeOffset cleanupAfter = GenerateCleanupAfter(_deletedInstanceCleanupConfiguration.DeleteDelay); return(_indexDataStore.DeleteStudyIndexAsync(GetPartitionKey(), studyInstanceUid, cleanupAfter, cancellationToken)); }