summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-service/src/test/groovy')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy8
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/InventoryPersistenceImplSpec.groovy11
2 files changed, 15 insertions, 4 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy
index cf3454991a..272030b11e 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy
@@ -249,14 +249,14 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: 'my-server',
removedCmHandles: ['cmhandle'])
and: '#scenario'
- mockCpsModuleService.deleteSchemaSet(_, 'cmhandle', CASCADE_DELETE_ALLOWED) >>
+ mockCpsModuleService.deleteSchemaSetsWithCascade(_, ['cmhandle']) >>
{ if (!schemaSetExist) { throw new SchemaSetNotFoundException("", "") } }
when: 'registration is updated to delete cmhandle'
def response = objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
then: 'the cmHandle state is updated to "DELETING"'
1 * mockLcmEventsCmHandleStateHandler.updateCmHandleStateBatch(_)
and: 'method to delete relevant schema set is called once'
- 1 * mockInventoryPersistence.deleteSchemaSetWithCascade(_)
+ 1 * mockInventoryPersistence.deleteSchemaSetsWithCascade(_)
and: 'method to delete relevant list/list element is called once'
1 * mockInventoryPersistence.deleteDataNodes(_)
and: 'successful response is received'
@@ -322,7 +322,9 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
addPersistedYangModelCmHandles(['cmhandle'])
def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: 'my-server',
removedCmHandles: ['cmhandle'])
- and: 'schema set deletion failed with unknown error'
+ and: 'schema set batch deletion failed with unknown error'
+ mockInventoryPersistence.deleteSchemaSetsWithCascade(_) >> { throw new RuntimeException('Failed') }
+ and: 'schema set single deletion failed with unknown error'
mockInventoryPersistence.deleteSchemaSetWithCascade(_) >> { throw new RuntimeException('Failed') }
when: 'registration is updated to delete cmhandle'
def response = objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/InventoryPersistenceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/InventoryPersistenceImplSpec.groovy
index 929ea84e36..d01df3abf1 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/InventoryPersistenceImplSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/InventoryPersistenceImplSpec.groovy
@@ -243,10 +243,19 @@ class InventoryPersistenceImplSpec extends Specification {
objectUnderTest.deleteSchemaSetWithCascade('validSchemaSetName')
then: 'the module service to delete schemaSet is invoked once'
1 * mockCpsModuleService.deleteSchemaSet('NFP-Operational', 'validSchemaSetName', CascadeDeleteAllowed.CASCADE_DELETE_ALLOWED)
- and: 'the CM Handle ID is validated'
+ and: 'the schema set name is validated'
1 * mockCpsValidator.validateNameCharacters('validSchemaSetName')
}
+ def 'Delete multiple schema sets with valid schema set names'() {
+ when: 'the method to delete schema sets is called with valid schema set names'
+ objectUnderTest.deleteSchemaSetsWithCascade(['validSchemaSetName1', 'validSchemaSetName2'])
+ then: 'the module service to delete schema sets is invoked once'
+ 1 * mockCpsModuleService.deleteSchemaSetsWithCascade('NFP-Operational', ['validSchemaSetName1', 'validSchemaSetName2'])
+ and: 'the schema set names are validated'
+ 1 * mockCpsValidator.validateNameCharacters(['validSchemaSetName1', 'validSchemaSetName2'])
+ }
+
def 'Get data node via xPath'() {
when: 'the method to get data nodes is called'
objectUnderTest.getDataNode('sample xPath')