From a9a35ef425b899ab6d700dc1f3af8055779188f7 Mon Sep 17 00:00:00 2001 From: ToineSiebelink Date: Thu, 8 Jan 2026 11:16:34 +0000 Subject: [PATCH] Fix bug for Patch errors; badOp populated incorrectly Issue-ID: CPS-2826 Change-Id: I34ac7f26c9b081c77bfbb2ba2fc18edf583e3d7d Signed-off-by: ToineSiebelink --- .../main/java/org/onap/cps/ncmp/rest/controller/ProvMnSController.java | 3 +-- .../org/onap/cps/ncmp/rest/controller/ProvMnSControllerSpec.groovy | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) 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"') } -- 2.16.6