From aea4b371e4c06a7d5b4191ab8a602e99abd1f140 Mon Sep 17 00:00:00 2001 From: tragait Date: Fri, 10 Sep 2021 10:45:31 +0100 Subject: revert cps:634 postpone this bug to jakarta This commit also have fix in application yaml for correct ncmp api path for registration url. Issue-ID: CPS-634 Issue-ID: CPS-617 Signed-off-by: tragait Change-Id: I465991492a01092e28b97583f84ed959c54ffaa6 --- .../onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy | 2 +- .../groovy/org/onap/cps/ncmp/dmi/service/DmiServiceImplSpec.groovy | 2 +- .../org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy | 5 +++-- .../onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/test/groovy') diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy index c32608c0..e08870fd 100644 --- a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy +++ b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy @@ -212,7 +212,7 @@ class DmiRestControllerSpec extends Specification { def writeDataforCmHandlePassthroughRunning = "${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:passthrough-running/some-resourceIdentifier" def jsonData = TestUtils.getResourceFileContent('WriteDataForCmHandle.json') and: 'dmi service is called' - mockDmiService.writeResourceDataPassthroughForCmHandle('some-cmHandle', 'some-resourceIdentifier', 'application/json', '{ some data }') >> '{some-json}' + mockDmiService.writeResourceDataPassthroughForCmHandle('some-cmHandle', 'some-resourceIdentifier', 'application/json', ['some-data': 'some-value']) >> '{some-json}' when: 'write cmHandle passthrough running post api is invoked with json data' def response = mvc.perform( post(writeDataforCmHandlePassthroughRunning).contentType(MediaType.APPLICATION_JSON) diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/service/DmiServiceImplSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/service/DmiServiceImplSpec.groovy index 7891450d..1d2cf7f3 100644 --- a/src/test/groovy/org/onap/cps/ncmp/dmi/service/DmiServiceImplSpec.groovy +++ b/src/test/groovy/org/onap/cps/ncmp/dmi/service/DmiServiceImplSpec.groovy @@ -266,7 +266,7 @@ class DmiServiceImplSpec extends Specification { mockObjectMapper.writeValueAsString(_) >> jsonString when: 'write resource data for pass through method is invoked' objectUnderTest.writeResourceDataPassthroughForCmHandle('some-cmHandle', - 'some-resourceIdentifier', 'some-dataType', 'some-json-data') + 'some-resourceIdentifier', 'some-dataType', new Object()) then: 'a dmi exception is thrown' thrown(DmiException.class) where: 'the following combinations are tested' diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy index f5c059c7..32df97b6 100644 --- a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy +++ b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy @@ -21,6 +21,7 @@ package org.onap.cps.ncmp.dmi.service.client import org.onap.cps.ncmp.dmi.config.DmiConfiguration +import org.springframework.http.HttpMethod import org.springframework.http.ResponseEntity import org.springframework.web.client.RestTemplate import spock.lang.Specification @@ -48,8 +49,8 @@ class NcmpRestClientSpec extends Specification { when: 'register cm-handle with ncmp is invoked' def result = objectUnderTest.registerCmHandlesWithNcmp(jsonData) then: 'the rest template is called with the correct uri and json in the body' - 1 * mockRestTemplate.postForEntity({ it.toString() == 'http://some-uri/some-url' }, - { it.body.contains(jsonData) }, String.class) >> mockResponseEntity + 1 * mockRestTemplate.exchange({ it.toString() == 'http://some-uri/some-url' }, + HttpMethod.POST, { it.body.contains(jsonData) }, String.class) >> mockResponseEntity and: 'the output of the method is equal to the output from the test template' result == mockResponseEntity } diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy index b550480d..2184c7e7 100644 --- a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy +++ b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy @@ -61,8 +61,8 @@ class SdncRestconfClientSpec extends Specification { when: 'get module resources is invoked' def result = objectUnderTest.postOperationWithJsonData(getModuleResourceUrl, jsonData, new HttpHeaders()) then: 'the rest template is called with the correct uri and json in the body' - 1 * mockRestTemplate.postForEntity({ it.toString() == 'http://some-uri/getModuleResourceUrl' }, - { it.body.contains(jsonData) }, String.class) >> mockResponseEntity + 1 * mockRestTemplate.exchange({ it.toString() == 'http://some-uri/getModuleResourceUrl' }, + HttpMethod.POST, { it.body.contains(jsonData) }, String.class) >> mockResponseEntity and: 'the output of the method is the same as the output from the test template' result == mockResponseEntity } -- cgit 1.2.3-korg