+ def 'Add CM-Handle to trustLevelPerCmHandle Successfully with: #scenario.'() {
+ given: 'a registration with trustLevel and populated cache'
+ def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: 'my-server')
+ dmiPluginRegistration.createdCmHandles = [new NcmpServiceCmHandle(cmHandleId: 'ch-1', registrationTrustLevel: TrustLevel.NONE),
+ new NcmpServiceCmHandle(cmHandleId: cmHandleId, registrationTrustLevel: registrationTrustLevel)]
+ when: 'registration is updated'
+ def response = objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
+ then: 'a successful response is received'
+ assert response.createdCmHandles.size() == expectedNumberOfCreatedCmHandles
+ and: 'trustLevel is set for the created cm-handle'
+ assert trustLevelPerCmHandle.get(cmHandleId) == expectedTrustLevel
+ where:
+ scenario | cmHandleId | registrationTrustLevel || expectedNumberOfCreatedCmHandles | expectedTrustLevel
+ 'new cmHandleId and trustLevel' | 'ch-new' | TrustLevel.COMPLETE || 2 | TrustLevel.COMPLETE
+ 'existing cmHandleId with null trustLevel' | 'ch-1' | null || 1 | TrustLevel.NONE
+ 'cmHandleId with null trustLevel' | 'ch-new' | null || 2 | TrustLevel.COMPLETE
+ }
+