- def 'Attempting to register a cmhandle with an already cached id.'() {
- given: 'a registration of a cmhandle with an alternate id'
- def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: 'my-server')
- dmiPluginRegistration.createdCmHandles = [new NcmpServiceCmHandle(cmHandleId: 'ch-1', alternateId: 'my alternate id')]
- and: 'one of the ids are duplicated'
- mockCmHandleIdMapper.isDuplicateId('ch-1', 'my alternate id') >> true
- when: 'registration is attempted'
- def response = objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
- then: 'a response is received'
- assert response != null
- and: 'the cmhandle has a failed state with the appropriate NCMP response status'
- assert Status.FAILURE == response.createdCmHandles[0].status
- assert NcmpResponseStatus.ALTERNATE_ID_ALREADY_ASSOCIATED == response.createdCmHandles[0].ncmpResponseStatus
- }
-