diff options
Diffstat (limited to 'ms/blueprintsprocessor/functions')
2 files changed, 25 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt index 382a1312f..cf7de679b 100644 --- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt +++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt @@ -115,4 +115,16 @@ open class ResourceConfigSnapshotService(private val resourceConfigSnapshotRepos } storedSnapshot } + + suspend fun deleteByResourceIdAndResourceTypeAndStatus( + resourceId: String, + resourceType: String, + status: ResourceConfigSnapshot.Status + ) { + resourceConfigSnapshotRepository.deleteByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, status) + log.info( + "Deleted configuration snapshot for resourceId=($resourceId), " + + "resourceType=($resourceType), status=($status)" + ) + } } diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt index f25b6f9c7..403f92bc9 100644 --- a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt +++ b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt @@ -78,4 +78,17 @@ class ResourceConfigSnapshotServiceTest { assertEquals(tr, res) } } + + @Test + fun deleteResourceConfigSnapshot() { + runBlocking { + every { + cfgRepository.deleteByResourceIdAndResourceTypeAndStatus(any(), any(), any()) + } returns Unit + cfgService.deleteByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, resourceStatus) + verify { + cfgRepository.deleteByResourceIdAndResourceTypeAndStatus(eq(resourceId), eq(resourceType), eq(resourceStatus)) + } + } + } } |