summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test/groovy/org
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-02-14 13:24:40 +0000
committerdanielhanrahan <daniel.hanrahan@est.tech>2023-02-15 14:19:42 +0000
commite28b62148676d189bdd11b78d8d78419d548e358 (patch)
tree13974274471b6328bc22474358949c87e210687b /cps-service/src/test/groovy/org
parent9575b84ab4e2db885d8761a98eaae9ff3a06aa81 (diff)
Bulk delete schemasets in CM handle deregistration
- Batch delete schema sets in single query - Call deleteUnusedYangResourceModules once per batch, not per CM handle - Results for deregistering 10k: 14 mins before; 6 mins after Issue-ID: CPS-1423 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: Ia3a86a0dc88677323e2f386253a99022a7f02603
Diffstat (limited to 'cps-service/src/test/groovy/org')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy22
1 files changed, 22 insertions, 0 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
index 2bb0e63ab2..615d3af35a 100644
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
@@ -167,6 +167,28 @@ class CpsModuleServiceImplSpec extends Specification {
return anchors
}
+ def 'Delete multiple schema-sets when cascade is allowed.'() {
+ given: '#numberOfAnchors anchors are associated with each schemaset'
+ mockCpsAdminService.getAnchors('my-dataspace', 'my-schemaset1') >> createAnchors(numberOfAnchors)
+ mockCpsAdminService.getAnchors('my-dataspace', 'my-schemaset2') >> createAnchors(numberOfAnchors)
+ when: 'schema set deletion is requested with cascade allowed'
+ objectUnderTest.deleteSchemaSetsWithCascade('my-dataspace', ['my-schemaset1', 'my-schemaset2'])
+ then: 'anchor deletion is called 2 * #numberOfAnchors times'
+ (2 * numberOfAnchors) * mockCpsAdminService.deleteAnchor('my-dataspace', _)
+ and: 'persistence service method is invoked with same parameters'
+ mockCpsModulePersistenceService.deleteSchemaSets('my-dataspace', _)
+ and: 'schema sets will be removed from the cache'
+ 2 * mockYangTextSchemaSourceSetCache.removeFromCache('my-dataspace', _)
+ and: 'orphan yang resources are deleted'
+ 1 * mockCpsModulePersistenceService.deleteUnusedYangResourceModules()
+ and: 'the CpsValidator is called on the dataspaceName'
+ 1 * mockCpsValidator.validateNameCharacters('my-dataspace')
+ and: 'the CpsValidator is called on the schemaSetNames'
+ 1 * mockCpsValidator.validateNameCharacters(_)
+ where: 'following parameters are used'
+ numberOfAnchors << [0, 3]
+ }
+
def 'Get all yang resources module references.'() {
given: 'an already present module reference'
def moduleReferences = [new ModuleReference('some module name','some revision name')]