diff options
author | egernug <gerard.nugent@est.tech> | 2024-05-29 10:22:59 +0100 |
---|---|---|
committer | egernug <gerard.nugent@est.tech> | 2024-05-30 15:28:58 +0100 |
commit | daf2ba8f11d98b26e871961d1c6bd1b4c5c89aab (patch) | |
tree | 59ce0ae8b2e17d90197914802a2ed95157446896 /src/test/groovy | |
parent | 190c30c687cb5506fed6e27bfa623fa2747386bb (diff) |
Implement ACK in DMI Plugin
Implementing a response in DMI Plugin to indicate that the datajobs API is not implemented
Issue-ID: CPS-2243
Change-Id: I5215d634006a2031638110e3dc159c66ad4e7d86
Signed-off-by: egernug <gerard.nugent@est.tech>
Diffstat (limited to 'src/test/groovy')
-rw-r--r-- | src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy new file mode 100644 index 00000000..c55f53c1 --- /dev/null +++ b/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.ncmp.dmi.datajobs.rest.controller + +import org.onap.cps.ncmp.dmi.config.WebSecurityConfig +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.beans.factory.annotation.Value +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest +import org.springframework.context.annotation.Import +import org.springframework.http.HttpStatus +import org.springframework.security.test.context.support.WithMockUser +import org.springframework.test.web.servlet.MockMvc +import spock.lang.Specification + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post + +@Import(WebSecurityConfig) +@WebMvcTest(DmiDatajobsRestController.class) +@WithMockUser +class DmiDatajobsRestControllerSpec extends Specification{ + + @Autowired + private MockMvc mvc + + @Value('${rest.api.dmi-base-path}/v1') + def basePathV1 + + def 'write request should return 501 HTTP Status' () { + given: 'URL to write a data job' + def getModuleUrl = "${basePathV1}/writeJob/001" + when: 'the request is posted' + def response = mvc.perform( + post(getModuleUrl) + .contentType('application/3gpp-json-patch+json') + ).andReturn().response + then: 'response value is Not Implemented' + response.status == HttpStatus.NOT_IMPLEMENTED.value() + } + + def 'read request should return 501 HTTP Status' () { + given: 'URL to write a data job' + def getModuleUrl = "${basePathV1}/readJob/001" + when: 'the request is posted' + def response = mvc.perform( + post(getModuleUrl) + .contentType('application/3gpp-json-patch+json') + ).andReturn().response + then: 'response value is Not Implemented' + response.status == HttpStatus.NOT_IMPLEMENTED.value() + } +} |