Ensure delete has target MO in resource identifier, not the parent 32/142932/1
authorToineSiebelink <toine.siebelink@est.tech>
Thu, 15 Jan 2026 09:27:27 +0000 (09:27 +0000)
committerToineSiebelink <toine.siebelink@est.tech>
Thu, 15 Jan 2026 09:27:27 +0000 (09:27 +0000)
Issue-ID: CPS-3130
Change-Id: Ie343a0221d2daee9b8ea46eb4c2df80e9721aa97
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/ProvMnSControllerSpec.groovy
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/policyexecutor/OperationDetailsFactory.java

index e956410..cd5318b 100644 (file)
@@ -297,7 +297,7 @@ class ProvMnSControllerSpec extends Specification {
             mockAlternateIdMatcher.getCmHandleIdByLongestMatchingAlternateId('/managedElement=1/myClass=id1', "/") >> 'ch-1'
         and: 'persistence service returns valid yangModelCmHandle'
             mockInventoryPersistence.getYangModelCmHandle('ch-1') >> validCmHandle
-            def expectedResourceIdentifier = '/myClass=id1/childClass=1'
+            def expectedResourceIdentifier = '/myClass=id1/childClass=1/grandchildClass=1'
         when: 'patch data resource request is performed'
             def response = mvc.perform(patch(url)
                 .header('Authorization', 'my authorization')
@@ -436,7 +436,7 @@ class ProvMnSControllerSpec extends Specification {
         and: 'the content is whatever the DMI returned'
             assert response.contentAsString == responseContentFromDmi
         and: 'Policy Executor was invoked with correct resource identifier and almost empty operation details (not used for delete!)'
-            1 * mockPolicyExecutor.checkPermission(_, OperationType.DELETE, 'my authorization', '/myClass=id1/childClass=1', expectedDeleteChangeRequest)
+            1 * mockPolicyExecutor.checkPermission(_, OperationType.DELETE, 'my authorization', '/myClass=id1/childClass=1/grandChildClass=2', expectedDeleteChangeRequest)
         where: 'following responses returned by DMI'
             scenario         | responseStatusFromDmi | responseContentFromDmi
             'happy flow'     | OK                    | 'content from DMI'
index 22b3097..2169bf5 100644 (file)
@@ -105,8 +105,7 @@ public class OperationDetailsFactory {
      * @return OperationDetails object
      */
     public OperationDetails buildOperationDetailsForDelete(final String fdn) {
-        final String parentFdn = ParameterHelper.extractParentFdn(fdn);
-        return new OperationDetails(OperationType.DELETE, parentFdn, "", emptyList());
+        return new OperationDetails(OperationType.DELETE, fdn, "", emptyList());
     }
 
     /**