aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy/org
diff options
context:
space:
mode:
authormpriyank <priyank.maheshwari@est.tech>2023-12-04 18:01:07 +0000
committermpriyank <priyank.maheshwari@est.tech>2023-12-06 12:21:39 +0000
commit41727e5dd167c71a63fb8b8f4e3136867b0e65b3 (patch)
tree5c5b6dc6a6f46185e20aa9bc9e4d604d314f48aa /cps-ncmp-service/src/test/groovy/org
parent4d1b233782d28789ede02b1bad5cda1923a8f650 (diff)
[BUG] Dminame to valid topic suffix
- dmi name can be in the form of URL , and we are using dmi-name as topic suffix , which results in the invalid topic name. - fix to extract out domain name excluding port from the url - test case for the same - updated the documentation - fix only supports ipv4 addresses at the moment Issue-ID: CPS-1979 Change-Id: I9c6ea113afae816f727b45a30c94070af013a16d Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionNcmpInEventForwarderSpec.groovy16
1 files changed, 16 insertions, 0 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionNcmpInEventForwarderSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionNcmpInEventForwarderSpec.groovy
index 1edfa58f9a..ce117eef57 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionNcmpInEventForwarderSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionNcmpInEventForwarderSpec.groovy
@@ -179,6 +179,22 @@ class CmSubscriptionNcmpInEventForwarderSpec extends MessagingBaseSpec {
1 * mockCmSubscriptionNcmpOutEventPublisher.sendResponse(_, 'subscriptionCreatedStatus')
}
+ def 'Extract domain name from URL for #scenario'() {
+ when: 'a valid dmi name is provided'
+ def domainName = objectUnderTest.toValidTopicSuffix(dmiName)
+ then: 'domain name is as expected with no port information'
+ assert domainName == expectedDomainName
+ where: ''
+ scenario | dmiName || expectedDomainName
+ 'insecure http url with port' | 'http://www.onap-dmi:8080/xyz=123' || 'onap-dmi'
+ 'insecure http url without port' | 'http://www.onap-dmi/xyz=123' || 'onap-dmi'
+ 'secure https url with port' | 'https://127.0.0.1:8080/xyz=123' || '127.0.0.1'
+ 'secure https url without port' | 'https://127.0.0.1/xyz=123' || '127.0.0.1'
+ 'servername without protocol and port' | 'dminame1' || 'dminame1'
+ 'servername without protocol' | 'www.onap-dmi:8080/xyz=123' || 'www.onap-dmi:8080/xyz=123'
+
+ }
+
static def createYangModelCmHandleWithDmiProperty(id, dmiId, propertyName, propertyValue) {
return new YangModelCmHandle(id: "CMHandle" + id, dmiDataServiceName: "DMIName" + dmiId, dmiProperties: [new YangModelCmHandle.Property(propertyName, propertyValue)])
}