aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-service/src/test')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminerSpec.groovy16
1 files changed, 16 insertions, 0 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminerSpec.groovy
index 84eb78b751..47b57669ca 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminerSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminerSpec.groovy
@@ -3,6 +3,8 @@ package org.onap.cps.ncmp.impl.datajobs
import org.onap.cps.ncmp.api.datajobs.models.DataJobWriteRequest
import org.onap.cps.ncmp.api.datajobs.models.WriteOperation
+import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle
+import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher
import org.onap.cps.spi.model.DataNode
import spock.lang.Specification
@@ -60,4 +62,18 @@ class WriteRequestExaminerSpec extends Specification {
then: 'we get the operation ids in the expected order.'
assert dmiWriteOperations.operationId == ['1', '2', '3']
}
+
+ def 'Validate the creation of a ProducerKey with correct dmiservicename.'() {
+ given: 'yangModelCmHandles with service name: "#dmiServiceName" and data service name: "#dataServiceName"'
+ def yangModelCmHandle = YangModelCmHandle.toYangModelCmHandle(dmiServiceName, dataServiceName, '', new NcmpServiceCmHandle(cmHandleId: 'cm-handle-id-1'), '', '', 'dpi1')
+ when: 'the ProducerKey is created'
+ def result = objectUnderTest.createProducerKey(yangModelCmHandle).toString()
+ then: 'we get the ProducerKey with the correct service name'
+ assert result == expectedProducerKey
+ where: 'the following services are registered'
+ dmiServiceName | dataServiceName || expectedProducerKey
+ 'dmi-service-name' | '' || 'dmi-service-name#dpi1'
+ '' | 'dmi-data-service-name' || 'dmi-data-service-name#dpi1'
+ 'dmi-service-name' | 'dmi-data-service-name' || 'dmi-service-name#dpi1'
+ }
}