diff options
author | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2022-05-16 11:09:06 -0400 |
---|---|---|
committer | kuldipr <kuldip.rai@amdocs.com> | 2022-08-03 15:29:55 -0400 |
commit | fa536ca8bd901dc51833cfe906f7b22846674d2f (patch) | |
tree | 57509fbcbaac90f45ec9869ef5b95c3759617680 /ms/blueprintsprocessor/functions/resource-resolution/src/test | |
parent | eb7eb24bf107bbd42537a9557e07b5ca82280c60 (diff) |
Enable deleting resources by lastN occurrences
Also enable deletion using resource-type and resource-id.
Issue-ID: CCSDK-3735
Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
Signed-off-by: kuldipr <kuldip.rai@amdocs.com>
Change-Id: Id1b487fce97f582bd3781dfd5bcff61a8df08c5c
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src/test')
-rw-r--r-- | ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt index 8d4109fcf..69e7a646a 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt @@ -321,15 +321,54 @@ open class ResourceResolutionDBServiceTest { } @Test - fun deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyTest() { + fun deleteResourcesResolutionKeyAll() { every { - resourceResolutionRepository.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(any(), any(), any(), any()) - } returns Unit + resourceResolutionRepository.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(blueprintName, blueprintVersion, artifactPrefix, resolutionKey) + } returns 3 runBlocking { - val res = resourceResolutionDBService.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey( - blueprintName, blueprintVersion, artifactPrefix, resolutionKey + val res = resourceResolutionDBService.deleteResources( + blueprintName, blueprintVersion, artifactPrefix, resolutionKey, null ) - assertEquals(Unit, res) + assertEquals(3, res) + } + } + + @Test + fun deleteResourcesResolutionKeyLastN() { + every { + resourceResolutionRepository.deleteLastNOccurences(blueprintName, blueprintVersion, artifactPrefix, resolutionKey, 1) + } returns 4 + runBlocking { + val res = resourceResolutionDBService.deleteResources( + blueprintName, blueprintVersion, artifactPrefix, resolutionKey, 1 + ) + assertEquals(4, res) + } + } + + @Test + fun deleteResourcesResourceIdAndTypeAll() { + every { + resourceResolutionRepository.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceTypeAndResourceId(blueprintName, blueprintVersion, artifactPrefix, resourceType, resourceId) + } returns 3 + runBlocking { + val res = resourceResolutionDBService.deleteResources( + blueprintName, blueprintVersion, artifactPrefix, resourceType, resourceId, null + ) + assertEquals(3, res) + } + } + + @Test + fun deleteResourcesResourceIdAndTypeLastN() { + every { + resourceResolutionRepository.deleteLastNOccurences(blueprintName, blueprintVersion, artifactPrefix, resourceType, resourceId, 2) + } returns 6 + runBlocking { + val res = resourceResolutionDBService.deleteResources( + blueprintName, blueprintVersion, artifactPrefix, resourceType, resourceId, 2 + ) + assertEquals(6, res) } } } |