Merge "Remove CpsDataService dependency from DeltaReportExecutor" master
authorPriyank Maheshwari <priyank.maheshwari@est.tech>
Wed, 17 Sep 2025 14:08:45 +0000 (14:08 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 17 Sep 2025 14:08:45 +0000 (14:08 +0000)
1  2 
cps-service/src/test/groovy/org/onap/cps/impl/CpsDeltaServiceImplSpec.groovy
cps-service/src/test/groovy/org/onap/cps/utils/deltareport/DeltaReportExecutorSpec.groovy

@@@ -151,7 -191,22 +191,22 @@@ class DeltaReportExecutorSpec extends S
          def mockYangTextSchemaSourceSet = Mock(YangTextSchemaSourceSet)
          mockYangTextSchemaSourceSetCache.get(dataspaceName, schemaSetName) >> mockYangTextSchemaSourceSet
          def yangResourceNameToContent = TestUtils.getYangResourcesAsMap(yangResources)
 -        def schemaContext = YangTextSchemaSourceSetBuilder.of(yangResourceNameToContent).getSchemaContext()
 -        mockYangTextSchemaSourceSet.getSchemaContext() >> schemaContext
 +        def schemaContext = YangTextSchemaSourceSetBuilder.of(yangResourceNameToContent).schemaContext()
 +        mockYangTextSchemaSourceSet.schemaContext() >> schemaContext
      }
+     def setupTestData(scenario) {
+         if (scenario == 'xpath') {
+             return [
+                 deltaReportJson: '[{"action":"create","xpath":"/bookstore","targetData":{"categories":[{"code":"1","name":"Children"}]}}]',
+                 deltaReport: new DeltaReportBuilder().actionCreate().withXpath('/bookstore').withTargetData(['categories': [['code': '1', 'name': 'Children']]]).build(),
+                 dataNodes: [new DataNode(xpath: '/bookstore/categories[@code=\'1\']', leaves: ['code': '1', 'name': 'Children'])]
+             ]
+         }
+         return [
+             deltaReportJson: '[{"action":"create","xpath":"/bookstore/categories[@code=\'1\']","targetData":{"books":[{"price":20,"title":"Matilda"}]}}]',
+             deltaReport: new DeltaReportBuilder().actionCreate().withXpath('/bookstore/categories[@code=\'1\']').withTargetData(['books': [['price': 20, 'title': 'Matilda']]]).build(),
+             dataNodes: [new DataNode(xpath: '/bookstore/categories[@code=\'1\']/books[@title=\'Matilda\']', leaves: ['price':20, 'title':'Matilda'])]
+         ]
+     }
  }