[TECHDEBT] Remove deprecated API methods related to NCMP
[cps.git] / cps-ncmp-service / src / test / groovy / org / onap / cps / ncmp / api / impl / NetworkCmProxyDataServiceImplRegistrationSpec.groovy
index 4108454..90fcbfc 100644 (file)
@@ -126,6 +126,19 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
             noExceptionThrown()
     }
 
+    def 'Register a DMI Plugin for the given cm-handle(s) with no schema set found during delete process.'() {
+        given: 'a registration'
+            def objectUnderTest = getObjectUnderTestWithModelSyncDisabled()
+            def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin:'my-server')
+            dmiPluginRegistration.removedCmHandles = cmHandlesArray
+        and: 'an exception occurs during delete schema set process'
+            mockCpsModuleService.deleteSchemaSet(_,_,_) >>  { throw (new Exception('')) }
+        when: 'registration is updated and modules are synced'
+            objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
+        then: 'delete list or list element is still called'
+            1 * mockCpsDataService.deleteListOrListElement(_,_,_,_)
+    }
+
     def 'Dmi plugin registration with #scenario'() {
         given: 'a registration '
             def objectUnderTest = getObjectUnderTestWithModelSyncDisabled()
@@ -157,16 +170,20 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
         and: 'registration is not called'
             0 * objectUnderTest.parseAndCreateCmHandlesInDmiRegistrationAndSyncModules(dmiPluginRegistration)
         where:
-            scenario              | dmiPlugin  | dmiModelPlugin | dmiDataPlugin || expectedMessageDetails
-            'no DMI plugin'       | ''         | ''             | ''            || 'No DMI plugin service names'
-            'all DMI plugins'     | 'service1' | 'service2'     | 'service3'    || 'Invalid combination of plugin service names'
-            'no model DMI plugin' | 'service1' | ''             | 'service2'    || 'Invalid combination of plugin service names'
-            'no data DMI plugin'  | 'service1' | 'service2'     | ''            || 'Invalid combination of plugin service names'
+            scenario                        | dmiPlugin  | dmiModelPlugin | dmiDataPlugin || expectedMessageDetails
+            'empty DMI plugins'             | ''         | ''             | ''            || 'No DMI plugin service names'
+            'blank DMI plugins'             | ' '        | ' '            | ' '           || 'No DMI plugin service names'
+            'null DMI plugins'              | null       | null           | null          || 'No DMI plugin service names'
+            'all DMI plugins'               | 'service1' | 'service2'     | 'service3'    || 'Cannot register combined plugin service name and other service names'
+            '(combined)DMI and Data Plugin' | 'service1' | ''             | 'service2'    || 'Cannot register combined plugin service name and other service names'
+            '(combined)DMI and model Plugin'| 'service1' | 'service2'     | ''            || 'Cannot register combined plugin service name and other service names'
+            'only model DMI plugin'         | ''         | 'service1'     | ''            || 'Cannot register just a Data or Model plugin service name'
+            'only data DMI plugin'          | ''         | ''             | 'service1'    || 'Cannot register just a Data or Model plugin service name'
     }
 
     def getObjectUnderTestWithModelSyncDisabled() {
         def objectUnderTest = Spy(new NetworkCmProxyDataServiceImpl(null, null, mockCpsModuleService,
-                mockCpsDataService, null, null, spyObjectMapper))
+                mockCpsDataService, null, spyObjectMapper))
         objectUnderTest.syncModulesAndCreateAnchor(*_) >> null
         return objectUnderTest
     }