-
Bug
-
Resolution: Done
-
Medium
-
Jakarta Release
-
None
-
Personal local environment running cps from latest master `b5a9ec3`
Steps to reproduce:
- Start CPS and NCP application
- Send a request to create some cm handles:
curl -X POST 'http://localhost:8080/ncmpInventory/v1/ch' \ -H 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' \ -H 'Content-Type: application/json' \ -H 'Cookie: JSESSIONID=node01g3jijb3xorh9a4gb5rgxnocr0.node0' \ --data-raw '{ "dmiPlugin": "http://localhost:8080", "createdCmHandles": [ { "cmHandle": "cmHandleId1" }, { "cmHandle": "cmHandleId2" }, { "cmHandle": "cmHandleId3" } ] }'
3. Send another request to create the same cm handles again:
curl -X POST 'http://localhost:8080/ncmpInventory/v1/ch' \ -H 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' \ -H 'Content-Type: application/json' \ -H 'Cookie: JSESSIONID=node01g3jijb3xorh9a4gb5rgxnocr0.node0' \ --data-raw '{ "dmiPlugin": "http://localhost:8080", "createdCmHandles": [ { "cmHandle": "cmHandleId1" }, { "cmHandle": "cmHandleId2" }, { "cmHandle": "cmHandleId3" } ] }'
Current behaviour:
HTTP request response code is `500 Internal Server Error` with body:
{ "status": "500 INTERNAL_SERVER_ERROR", "message": "Already defined exception", "details": "Data node with name (one or more) of [/dmi-registry/cm-handles[@id='cmHandleId3'], /dmi-registry/cm-handles[@id='cmHandleId2'], /dmi-registry/cm-handles[@id='cmHandleId1']] already exists for ncmp-dmi-registry." }
and server logs: error.log
Expected behaviour:
HTTP response code is `400 Bad Request` (with the same unchanged message and details in the body)
NCMP Inventory #8 - POST /v1/ch: "Invalid requests should return 400"