- def 'Saving multicontainer json data.'() {
- given: 'schema set for given anchor and dataspace references test-tree model'
- setupSchemaSetMocks('multipleDataTree.yang')
- when: 'save data method is invoked with test-tree json data'
- def jsonData = TestUtils.getResourceFileContent('multiple-object-data.json')
- objectUnderTest.saveData(dataspaceName, anchorName, jsonData, observedTimestamp)
- then: 'the persistence service method is invoked with correct parameters'
- 1 * mockCpsDataPersistenceService.storeDataNodes(dataspaceName, anchorName,
- { dataNode -> dataNode.xpath[index] == xpath })
- and: 'the CpsValidator is called on the dataspaceName and AnchorName'
- 1 * mockCpsValidator.validateNameCharacters(dataspaceName, anchorName)
- and: 'data updated event is sent to notification service'
- 1 * mockNotificationService.processDataUpdatedEvent(anchor, '/', Operation.CREATE, observedTimestamp)
- where:
- index | xpath
- 0 | '/first-container'
- 1 | '/last-container'
-
- }
-