Fix bug for Patch errors; badOp populated incorrectly 70/142870/1
authorToineSiebelink <toine.siebelink@est.tech>
Thu, 8 Jan 2026 11:16:34 +0000 (11:16 +0000)
committerToineSiebelink <toine.siebelink@est.tech>
Thu, 8 Jan 2026 11:16:34 +0000 (11:16 +0000)
Issue-ID: CPS-2826
Change-Id: I34ac7f26c9b081c77bfbb2ba2fc18edf583e3d7d
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/ProvMnSController.java
cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/ProvMnSControllerSpec.groovy

index d387b35..128ad92 100644 (file)
@@ -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());
             }
         }
     }
index d997e02..3c30932 100644 (file)
@@ -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"')
     }