diff options
Diffstat (limited to 'src/test/groovy/org/onap')
3 files changed, 12 insertions, 8 deletions
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/config/DmiConfigurationSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/config/DmiConfigurationSpec.groovy index 1798c9f2..9d80b71f 100644 --- a/src/test/groovy/org/onap/cps/ncmp/dmi/config/DmiConfigurationSpec.groovy +++ b/src/test/groovy/org/onap/cps/ncmp/dmi/config/DmiConfigurationSpec.groovy @@ -56,7 +56,7 @@ class DmiConfigurationSpec extends Specification { given: 'a DMI configuration' DmiConfiguration objectUnderTest = new DmiConfiguration() and: 'a rest template builder' - RestTemplateBuilder mockRestTemplateBuilder = Mock(RestTemplateBuilder) + RestTemplateBuilder mockRestTemplateBuilder = Spy(RestTemplateBuilder) when: 'rest template method is invoked' objectUnderTest.restTemplate(mockRestTemplateBuilder) then: 'DMI configuration uses the build method on the template builder' 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 221603c2..ac632bb2 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 @@ -44,6 +44,7 @@ import org.springframework.test.web.servlet.MockMvc import spock.lang.Specification import static org.onap.cps.ncmp.dmi.model.DataAccessRequest.OperationEnum.DELETE +import static org.onap.cps.ncmp.dmi.model.DataAccessRequest.OperationEnum.PATCH import static org.onap.cps.ncmp.dmi.model.DataAccessRequest.OperationEnum.READ import static org.springframework.http.HttpStatus.BAD_REQUEST import static org.springframework.http.HttpStatus.NO_CONTENT @@ -211,14 +212,14 @@ class DmiRestControllerSpec extends Specification { 0 * mockDmiService.getResourceData(*_) } - def 'write data with #scenario operation using passthrough running.'() { + def 'data with #scenario operation using passthrough running.'() { given: 'write data for passthrough running url and jsonData' def writeDataForPassthroughRunning = "${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:passthrough-running" + "?resourceIdentifier=some-resourceIdentifier" def jsonData = TestUtils.getResourceFileContent(requestBodyFile) and: 'dmi service is called' mockDmiService.writeData(operationEnum, 'some-cmHandle', - 'some-resourceIdentifier', 'application/json', + 'some-resourceIdentifier', dataType, 'normal request body' ) >> '{some-json}' when: 'write data for passthrough running post api is invoked with json data' def response = mvc.perform( @@ -230,11 +231,12 @@ class DmiRestControllerSpec extends Specification { and: 'the data in the request body is as expected' response.getContentAsString() == expectedJsonResponse where: 'given request body and data' - scenario | requestBodyFile | operationEnum || expectedResponseStatus | expectedJsonResponse - 'Create' | 'createDataWithNormalChar.json' | CREATE || CREATED.value() | '{some-json}' - 'Update' | 'updateData.json' | UPDATE || OK.value() | '{some-json}' - 'Delete' | 'deleteData.json' | DELETE || NO_CONTENT.value() | '{some-json}' - 'Read' | 'readData.json' | READ || OK.value() | '' + scenario | requestBodyFile | operationEnum | dataType || expectedResponseStatus | expectedJsonResponse + 'Create' | 'createDataWithNormalChar.json' | CREATE | 'application/json' || CREATED.value() | '{some-json}' + 'Update' | 'updateData.json' | UPDATE | 'application/json' || OK.value() | '{some-json}' + 'Delete' | 'deleteData.json' | DELETE | 'application/json' || NO_CONTENT.value() | '{some-json}' + 'Read' | 'readData.json' | READ | 'application/json' || OK.value() | '' + 'Patch' | 'patchData.json' | PATCH | 'application/yang.patch+json' || OK.value() | '{some-json}' } def 'Create data using passthrough for special characters.'(){ 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 5079ada7..49cdc205 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 @@ -37,6 +37,7 @@ import spock.lang.Specification import static org.onap.cps.ncmp.dmi.model.DataAccessRequest.OperationEnum.CREATE import static org.onap.cps.ncmp.dmi.model.DataAccessRequest.OperationEnum.DELETE +import static org.onap.cps.ncmp.dmi.model.DataAccessRequest.OperationEnum.PATCH import static org.onap.cps.ncmp.dmi.model.DataAccessRequest.OperationEnum.UPDATE import static org.onap.cps.ncmp.dmi.model.DataAccessRequest.OperationEnum.READ @@ -138,6 +139,7 @@ class SdncOperationsSpec extends Specification { 'Update' | UPDATE || HttpMethod.PUT 'Read' | READ || HttpMethod.GET 'Delete' | DELETE || HttpMethod.DELETE + 'Patch' | PATCH || HttpMethod.PATCH } def 'build query param list for SDNC where options contains a #scenario'() { |