From: ToineSiebelink Date: Thu, 8 Jan 2026 11:16:34 +0000 (+0000) Subject: Fix bug for Patch errors; badOp populated incorrectly X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=a9a35ef425b899ab6d700dc1f3af8055779188f7;p=cps.git Fix bug for Patch errors; badOp populated incorrectly Issue-ID: CPS-2826 Change-Id: I34ac7f26c9b081c77bfbb2ba2fc18edf583e3d7d Signed-off-by: ToineSiebelink --- diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/ProvMnSController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/ProvMnSController.java index d387b354a0..128ad92c63 100644 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/ProvMnSController.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/ProvMnSController.java @@ -206,8 +206,7 @@ public class ProvMnSController implements ProvMnS { checkPermission(yangModelCmHandle, requestParameters.toTargetFdn(), operationDetails); } catch (final Exception exception) { final String httpMethodName = "PATCH"; - final OperationType operationType = OperationType.fromOperationName(operationDetails.operation()); - throw toProvMnSException(httpMethodName, exception, operationType.name()); + throw toProvMnSException(httpMethodName, exception, patchItem.getOp().getValue()); } } } diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/ProvMnSControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/ProvMnSControllerSpec.groovy index d997e02984..3c30932143 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/ProvMnSControllerSpec.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/ProvMnSControllerSpec.groovy @@ -268,6 +268,8 @@ class ProvMnSControllerSpec extends Specification { assert response.status == CONFLICT.value() and: 'response contains the correct type' assert response.contentAsString.contains('"type":"APPLICATION_LAYER_ERROR"') + and: 'response contains the bad operation' + assert response.contentAsString.contains('"badOp":"replace"') and: 'response contains the message from Policy Executor (as title)' assert response.contentAsString.contains('"title":"denied for test"') }