Remove compulsory body from delete passthrough request
- yaml spec (please note how order of parameter changed!)
- Updated CSIT test
- Slight improvement of cist setup script to prevent double download
Issue-ID: CPS-836
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Change-Id: Ic3510c9dfe28a3be09f5239ab5c8c4797d4f4792
diff --git a/cps-ncmp-rest/docs/openapi/ncmp.yml b/cps-ncmp-rest/docs/openapi/ncmp.yml
index ece3c3a..7845a34 100755
--- a/cps-ncmp-rest/docs/openapi/ncmp.yml
+++ b/cps-ncmp-rest/docs/openapi/ncmp.yml
@@ -368,15 +368,6 @@
- $ref: 'components.yaml#/components/parameters/cmHandleInPath'
- $ref: 'components.yaml#/components/parameters/resourceIdentifierInQuery'
- $ref: 'components.yaml#/components/parameters/contentParamInHeader'
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- examples:
- dataSampleRequest:
- $ref: 'components.yaml#/components/examples/dataSampleRequest'
responses:
204:
$ref: 'components.yaml#/components/responses/NoContent'
@@ -442,4 +433,4 @@
401:
$ref: 'components.yaml#/components/responses/Unauthorized'
403:
- $ref: 'components.yaml#/components/responses/Forbidden'
\ No newline at end of file
+ $ref: 'components.yaml#/components/responses/Forbidden'
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
index 0ad30f1..e3c457e 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
@@ -62,6 +62,7 @@
public class NetworkCmProxyController implements NetworkCmProxyApi {
private static final Gson GSON = new GsonBuilder().create();
+ private static final String NO_BODY = null;
private final ModelMapper modelMapper = new ModelMapper();
private final NetworkCmProxyDataService networkCmProxyDataService;
@@ -250,18 +251,15 @@
*
* @param resourceIdentifier resource identifier
* @param cmHandle cm handle identifier
- * @param requestBody the request body
* @param contentType content type of the body
* @return response entity no content if request is successful
*/
@Override
- public ResponseEntity<Void> deleteResourceDataRunningForCmHandle(final String resourceIdentifier,
- final String cmHandle,
- final Object requestBody,
+ public ResponseEntity<Void> deleteResourceDataRunningForCmHandle(final String cmHandle,
+ final String resourceIdentifier,
final String contentType) {
-
networkCmProxyDataService.writeResourceDataPassThroughRunningForCmHandle(cmHandle,
- resourceIdentifier, DELETE, GSON.toJson(requestBody), contentType);
+ resourceIdentifier, DELETE, NO_BODY, contentType);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
index c75418c..a3d8afa 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
@@ -318,11 +318,10 @@
"?resourceIdentifier=parent/child"
when: 'delete data resource request is performed'
def response = mvc.perform(
- delete(url).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)
- .content(jsonString)).andReturn().response
- then: 'the ncmp service method to delete resource is called'
+ delete(url).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)).andReturn().response
+ then: 'the ncmp service method to delete resource is called (with null as body)'
1 * mockNetworkCmProxyDataService.writeResourceDataPassThroughRunningForCmHandle('testCmHandle',
- 'parent/child', DELETE, jsonString, 'application/json;charset=UTF-8')
+ 'parent/child', DELETE, null, 'application/json;charset=UTF-8')
and: 'the response is No Content'
response.status == HttpStatus.NO_CONTENT.value()
}
diff --git a/csit/plans/cps/setup.sh b/csit/plans/cps/setup.sh
index 5b3fd96..6ef4c9a 100755
--- a/csit/plans/cps/setup.sh
+++ b/csit/plans/cps/setup.sh
@@ -75,8 +75,8 @@
cat $WORKSPACE/archives/ncmp-dmi-plugin/docker-compose/docker-compose.yml
cp $WORKSPACE/archives/ncmp-dmi-plugin/docker-compose/*.yml $WORKSPACE/archives/dc-dmi
cd $WORKSPACE/archives/dc-dmi
-# download docker-compose of a required version (1.25.0 supports configuration of version 3.7)
-curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > docker-compose
+# copy docker-compose (downloaded already for cps)
+cp $WORKSPACE/archives/dc-cps/docker-compose .
chmod +x docker-compose
./docker-compose up -d
diff --git a/csit/tests/ncmp-passthrough/ncmp-passthrough.robot b/csit/tests/ncmp-passthrough/ncmp-passthrough.robot
index 1673baa..36350ad 100644
--- a/csit/tests/ncmp-passthrough/ncmp-passthrough.robot
+++ b/csit/tests/ncmp-passthrough/ncmp-passthrough.robot
@@ -100,7 +100,7 @@
Delete Bookstore using passthrough-running for Category 01
${uri}= Set Variable ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=01
${headers}= Create Dictionary Content-Type=application/json Authorization=${auth}
- ${response}= DELETE On Session CPS_URL ${uri} headers=${headers} data={}
+ ${response}= DELETE On Session CPS_URL ${uri} headers=${headers}
Should Be Equal As Strings ${response.status_code} 204
Verify delete to bookstore using passthrough-running removed only category 01