summaryrefslogtreecommitdiffstats
path: root/src/test/groovy/org
diff options
context:
space:
mode:
authorsourabh_sourabh <sourabh.sourabh@est.tech>2022-03-03 14:50:45 +0530
committersourabh_sourabh <sourabh.sourabh@est.tech>2022-03-10 18:57:40 +0530
commit3074e4021776adabe07e933605db48ea69b9d00f (patch)
tree212ec754a29d868b208764c94a2be2f8ef70ff76 /src/test/groovy/org
parent6b35430235490031b7c8cfa9294a475199acd906 (diff)
Refactor dmi plugin code and fix comments
- Used UriComponentBuilder is populate urls. - Removed incorrect import of StringUtils Issue-ID: CPS-569 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I11c6ad2fec528f9792c05405a7242128c0a6d4e2
Diffstat (limited to 'src/test/groovy/org')
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/service/operation/SdncOperationsSpec.groovy25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/service/operation/SdncOperationsSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/service/operation/SdncOperationsSpec.groovy
index 49cdc205..98add77b 100644
--- a/src/test/groovy/org/onap/cps/ncmp/dmi/service/operation/SdncOperationsSpec.groovy
+++ b/src/test/groovy/org/onap/cps/ncmp/dmi/service/operation/SdncOperationsSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation
+ * Copyright (C) 2021-2022 Nordix Foundation
* Modifications Copyright (C) 2021 Bell Canada
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -144,27 +144,28 @@ class SdncOperationsSpec extends Specification {
def 'build query param list for SDNC where options contains a #scenario'() {
when: 'build query param list is called with #scenario'
- def result = objectUnderTest.buildQueryParamList(optionsParamInQuery, 'd=4')
+ def result = objectUnderTest.buildQueryParamMap(optionsParamInQuery, 'd=4')
+ .toSingleValueMap().toString()
then: 'result equals to expected result'
result == expectedResult
where: 'following parameters are used'
scenario | optionsParamInQuery || expectedResult
- 'single key-value pair' | '(a=x)' || ['a=x', 'd=4']
- 'multiple key-value pairs' | '(a=x,b=y,c=z)' || ['a=x', 'b=y', 'c=z', 'd=4']
- '/ as special char' | '(a=x,b=y,c=t/z)' || ['a=x', 'b=y', 'c=t/z', 'd=4']
- '" as special char' | '(a=x,b=y,c="z")' || ['a=x', 'b=y', 'c="z"', 'd=4']
- '[] as special char' | '(a=x,b=y,c=[z])' || ['a=x', 'b=y', 'c=[z]', 'd=4']
- '= in value' | '(a=(x=y),b=x=y)' || ['a=(x=y)', 'b=x=y', 'd=4']
+ 'single key-value pair' | '(a=x)' || '[a:x, d:4]'
+ 'multiple key-value pairs' | '(a=x,b=y,c=z)' || '[a:x, b:y, c:z, d:4]'
+ '/ as special char' | '(a=x,b=y,c=t/z)' || '[a:x, b:y, c:t/z, d:4]'
+ '" as special char' | '(a=x,b=y,c="z")' || '[a:x, b:y, c:"z", d:4]'
+ '[] as special char' | '(a=x,b=y,c=[z])' || '[a:x, b:y, c:[z], d:4]'
+ '= in value' | '(a=(x=y),b=x=y)' || '[a:(x=y), b:x=y, d:4]'
}
def 'options parameters contains a comma #scenario'() {
// https://jira.onap.org/browse/CPS-719
when: 'build query param list is called with #scenario'
- def result = objectUnderTest.buildQueryParamList(optionsParamInQuery, 'd=4')
- then: 'expect 2 elements from options +1 from content query param (2+1) = 3 elements'
+ def result = objectUnderTest.buildQueryParamMap(optionsParamInQuery, 'd=4').toSingleValueMap()
+ then: 'expect 2 elements from options where we are ignoring empty query param value +1 from content query param (2+1) = 3 elements'
def expectedNoOfElements = 3
- and: 'results contains more elements than expected'
- result.size() > expectedNoOfElements
+ and: 'results contains equal elements as expected'
+ result.size() == expectedNoOfElements
where: 'following parameters are used'
scenario | optionsParamInQuery
'"," in value' | '(a=(x,y),b=y)'