+ def 'Update list-element data node with : #scenario.'() {
+ given: 'schema set for given anchor and dataspace references bookstore model'
+ setupSchemaSetMocks('bookstore.yang')
+ when: 'update data method is invoked with json data #jsonData and parent node xpath'
+ objectUnderTest.updateNodeLeaves(dataspaceName, anchorName, '/bookstore/categories[@code=2]',
+ jsonData, observedTimestamp)
+ then: 'the persistence service method is invoked with correct parameters'
+ thrown(DataValidationException)
+ where: 'following parameters were used'
+ scenario | jsonData
+ 'multiple expectedLeaves' | '{"code": "01","name": "some-name"}'
+ 'one leaf' | '{"name": "some-name"}'
+ }
+
+ def 'Update cm-handle properties' () {
+ given: 'a dmi registry model'
+ setupSchemaSetMocks('dmi-registry.yang')
+ and: 'the expected json string'
+ def jsonData = '{"cm-handles":[{"id":"cmHandle001", "additional-properties":[{"name":"P1"}]}]}'
+ when: 'update data method is invoked with json data and parent node xpath'
+ objectUnderTest.updateNodeLeavesAndExistingDescendantLeaves(dataspaceName, anchorName,
+ '/dmi-registry', jsonData, observedTimestamp)
+ then: 'the persistence service method is invoked with correct parameters'
+ 1 * mockCpsDataPersistenceService.updateDataLeaves(dataspaceName, anchorName,
+ "/dmi-registry/cm-handles[@id='cmHandle001']", ['id': 'cmHandle001'])
+ and: 'the data updated event is sent to the notification service'
+ 1 * mockNotificationService.processDataUpdatedEvent(dataspaceName, anchorName, observedTimestamp, '/dmi-registry', Operation.UPDATE)
+ }
+