summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test
diff options
context:
space:
mode:
authorLee Anjella Macabuhay <lee.anjella.macabuhay@est.tech>2023-12-11 10:10:58 +0000
committerGerrit Code Review <gerrit@onap.org>2023-12-11 10:10:58 +0000
commit5b213f912d028e486b305f2502100bf693937469 (patch)
tree13d88d1ffbf7d6bd4c1e747ecd59c2294e231004 /cps-ncmp-service/src/test
parent5fc0b52702b598b3d5b343092f0c3c3a8ad5e00c (diff)
parent41727e5dd167c71a63fb8b8f4e3136867b0e65b3 (diff)
Merge "[BUG] Dminame to valid topic suffix"
Diffstat (limited to 'cps-ncmp-service/src/test')
-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)])
}