public async Task GivenAnExistingDicomInstance_WhenDeletedBySeriesId_ThenItShouldBeRemovedAndAddedToDeletedInstanceTable() { string studyInstanceUid = TestUidGenerator.Generate(); string seriesInstanceUid = TestUidGenerator.Generate(); string sopInstanceUid = TestUidGenerator.Generate(); Instance instance = await CreateIndexAndVerifyInstance(studyInstanceUid, seriesInstanceUid, sopInstanceUid); await _indexDataStore.DeleteSeriesIndexAsync(studyInstanceUid, seriesInstanceUid, Clock.UtcNow); Assert.Empty(await _testHelper.GetInstancesAsync(studyInstanceUid, seriesInstanceUid, sopInstanceUid)); Assert.Empty(await _testHelper.GetSeriesMetadataAsync(seriesInstanceUid)); Assert.Empty(await _testHelper.GetStudyMetadataAsync(studyInstanceUid)); Assert.Collection(await _testHelper.GetDeletedInstanceEntriesAsync(studyInstanceUid, seriesInstanceUid, sopInstanceUid), ValidateSingleDeletedInstance(instance)); }
/// <inheritdoc /> public async Task DeleteSeriesIndexAsync(string studyInstanceUid, string seriesInstanceUid, DateTimeOffset cleanupAfter, CancellationToken cancellationToken) { LogDeleteSeriesIndexDelegate(_logger, studyInstanceUid, seriesInstanceUid, cleanupAfter, null); try { await _indexDataStore.DeleteSeriesIndexAsync(studyInstanceUid, seriesInstanceUid, cleanupAfter, cancellationToken); LogOperationSucceededDelegate(_logger, null); } catch (Exception ex) { LogOperationFailedDelegate(_logger, ex); throw; } }
public async Task GivenSeriesWithMultileInstances_WhenDeleteSeries_ThenAssociatedErrorsShouldBeRemoved() { string studyUid = TestUidGenerator.Generate(); string seriesUid1 = TestUidGenerator.Generate(); string instanceUid1 = TestUidGenerator.Generate(); string instanceUid2 = TestUidGenerator.Generate(); string seriesUid3 = TestUidGenerator.Generate(); string instanceUid3 = TestUidGenerator.Generate(); // add instances: instance1 and instance2 are in same series long watermark1 = await AddInstanceAsync(studyUid, seriesUid1, instanceUid1); long watermark2 = await AddInstanceAsync(studyUid, seriesUid1, instanceUid2); long watermark3 = await AddInstanceAsync(studyUid, 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.DeleteSeriesIndexAsync(DefaultPartition.Key, studyUid, seriesUid1, DateTime.UtcNow); // check errors var errors = await _extendedQueryTagErrorStore.GetExtendedQueryTagErrorsAsync(tag.GetPath(), int.MaxValue, 0); Assert.Single(errors); Assert.Equal(studyUid, errors[0].StudyInstanceUid); Assert.Equal(seriesUid3, errors[0].SeriesInstanceUid); Assert.Equal(instanceUid3, errors[0].SopInstanceUid); }
public async Task DeleteSeriesAsync(string studyInstanceUid, string seriesInstanceUid, CancellationToken cancellationToken) { DateTimeOffset cleanupAfter = GenerateCleanupAfter(_deletedInstanceCleanupConfiguration.DeleteDelay); await _indexDataStore.DeleteSeriesIndexAsync(studyInstanceUid, seriesInstanceUid, cleanupAfter, cancellationToken); }
public Task DeleteSeriesAsync(string studyInstanceUid, string seriesInstanceUid, CancellationToken cancellationToken) { DateTimeOffset cleanupAfter = GenerateCleanupAfter(_deletedInstanceCleanupConfiguration.DeleteDelay); return(_indexDataStore.DeleteSeriesIndexAsync(GetPartitionKey(), studyInstanceUid, seriesInstanceUid, cleanupAfter, cancellationToken)); }