474a480a43027d6362d3faf1114c0bd17659c451
[cps.git] /
1 /*
2  *  ============LICENSE_START=======================================================
3  *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
4  *  ================================================================================
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  *  SPDX-License-Identifier: Apache-2.0
18  *  ============LICENSE_END=========================================================
19  */
20
21 package org.onap.cps.integration.functional.ncmp.provmns
22
23 import org.onap.cps.integration.base.CpsIntegrationSpecBase
24 import org.onap.cps.ncmp.rest.provmns.model.ResourceOneOf
25 import org.springframework.http.MediaType
26
27 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete
28 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
29 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch
30 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put
31 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
32
33 @SuppressWarnings('SpellCheckingInspection')
34 class ProvMnSRestApiSpec extends CpsIntegrationSpecBase{
35
36     def 'Get Resource Data from provmns interface.'() {
37         expect: 'not implemented response on GET endpoint'
38             mvc.perform(get("/ProvMnS/v1/A=1/B=2/C=3"))
39                     .andExpect(status().isNotImplemented())
40     }
41
42     def 'Put Resource Data from provmns interface.'() {
43         given: 'an example resource json body'
44             def jsonBody = jsonObjectMapper.asJsonString(new ResourceOneOf('test'))
45         expect: 'not implemented response on PUT endpoint'
46             mvc.perform(put("/ProvMnS/v1/A=1/B=2/C=3")
47                     .contentType(MediaType.APPLICATION_JSON)
48                     .content(jsonBody))
49                     .andExpect(status().isNotImplemented())
50     }
51
52     def 'Patch Resource Data from provmns interface.'() {
53         given: 'an example resource json body'
54             def jsonBody = jsonObjectMapper.asJsonString(new ResourceOneOf('test'))
55         expect: 'not implemented response on PATCH endpoint'
56             mvc.perform(patch("/ProvMnS/v1/A=1/B=2/C=3")
57                     .contentType(new MediaType('application', 'json-patch+json'))
58                     .content(jsonBody))
59                     .andExpect(status().isNotImplemented())
60     }
61
62     def 'Delete Resource Data from provmns interface.'() {
63         expect: 'not implemented response on DELETE endpoint'
64             mvc.perform(delete("/ProvMnS/v1/A=1/B=2/C=3"))
65                     .andExpect(status().isNotImplemented())
66     }
67 }