summaryrefslogtreecommitdiffstats
path: root/cps-ri/src/test
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-ri/src/test
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-ri/src/test')
-rw-r--r--cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceIntegrationSpec.groovy13
-rw-r--r--cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy20
2 files changed, 30 insertions, 3 deletions
diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceIntegrationSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceIntegrationSpec.groovy
index 4c67f7e972..864b3e3b61 100644
--- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceIntegrationSpec.groovy
+++ b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceIntegrationSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation
+ * Copyright (C) 2021-2023 Nordix Foundation
* Modifications Copyright (C) 2021-2022 Bell Canada.
* Modifications Copyright (C) 2022 TechMahindra Ltd.
* ================================================================================
@@ -223,7 +223,16 @@ class CpsModulePersistenceServiceIntegrationSpec extends CpsPersistenceSpecBase
when: 'a schema set is deleted with cascade-prohibited option'
objectUnderTest.deleteSchemaSet(DATASPACE_NAME, SCHEMA_SET_NAME_NO_ANCHORS)
then: 'the schema set has been deleted'
- schemaSetRepository.findByDataspaceAndName(dataspaceEntity, SCHEMA_SET_NAME_NO_ANCHORS).isPresent() == false
+ !schemaSetRepository.findByDataspaceAndName(dataspaceEntity, SCHEMA_SET_NAME_NO_ANCHORS).isPresent()
+ }
+
+ @Sql([CLEAR_DATA, SET_DATA])
+ def 'Delete schema sets'() {
+ when: 'schema sets are deleted'
+ objectUnderTest.deleteSchemaSets(DATASPACE_NAME, ['SCHEMA-SET-001', 'SCHEMA-SET-002'])
+ then: 'the schema sets have been deleted'
+ !schemaSetRepository.findByDataspaceAndName(dataspaceEntity, 'SCHEMA-SET-001').isPresent()
+ !schemaSetRepository.findByDataspaceAndName(dataspaceEntity, 'SCHEMA-SET-002').isPresent()
}
@Sql([CLEAR_DATA, SET_DATA])
diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy
index ae2ff16bc1..345089c931 100644
--- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy
+++ b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation
+ * Copyright (C) 2022-2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,4 +46,22 @@ class CpsValidatorSpec extends Specification {
'position 5' | 'name with spaces' || 'name with spaces invalid token encountered at position 5'
'position 9' | 'nameWith Space' || 'nameWith Space invalid token encountered at position 9'
}
+
+ def 'Validating a list of valid names.'() {
+ given: 'a list of valid names'
+ def names = ['valid-name', 'another-valid-name']
+ when: 'a list of strings is validated'
+ objectUnderTest.validateNameCharacters(names)
+ then: 'no exception is thrown'
+ noExceptionThrown()
+ }
+
+ def 'Validating a list of names with invalid names.'() {
+ given: 'a list of names with an invalid name'
+ def names = ['valid-name', 'name with spaces']
+ when: 'a list of strings is validated'
+ objectUnderTest.validateNameCharacters(names)
+ then: 'a data validation exception is thrown'
+ thrown(DataValidationException)
+ }
}