- scenario | listNodeXpaths || expectedException
- 'list parent node does not exist' | '/unknown/unknown' || DataNodeNotFoundException
- 'list child nodes do not exist' | '/parent-200/unknown' || DataNodeNotFoundException
- 'list child nodes with key does not exist' | '/parent-200/unknown[@key="C"]' || DataNodeNotFoundException
- 'list grandchild nodes parent does not exist' | '/parent-200/unknown/unknown' || DataNodeNotFoundException
- 'non-existing parent with existing list-node' | '/unknown/child-204' || DataNodeNotFoundException
- 'non-existing parent with existing list-node & key' | '/unknown/child-204[@key="A"]' || DataNodeNotFoundException
- 'valid with non existing key' | '/parent-200/child-202/grand-child-202[@key="A"]' || DataNodeNotFoundException
- 'child list node without key' | '/parent-200/child-204/grand-child-204' || DataNodeNotFoundException
- 'valid list node with invalid key' | '/parent-203/child-204[@key="C"]' || DataNodeNotFoundException
+ scenario | targetXpaths
+ 'whole list, parent node does not exist' | '/unknown/some-child'
+ 'list element, parent node does not exist' | '/unknown/child-204[@key="A"]'
+ 'whole list does not exist' | '/parent-200/unknown'
+ 'list element, list does not exist' | '/parent-200/unknown[@key="C"]'
+ 'list element, element does not exist' | '/parent-203/child-204[@key="C"]'
+ 'valid datanode but not a list' | '/parent-200/child-202'
+ }
+
+ @Sql([CLEAR_DATA, SET_DATA])
+ def 'Confirm deletion of #scenario.'() {
+ given: 'a valid data node'
+ def dataNode
+ def dataNodeXpath
+ when: 'data nodes are deleted'
+ objectUnderTest.deleteDataNode(DATASPACE_NAME, ANCHOR_NAME3, xpathForDeletion)
+ then: 'verify data nodes are removed'
+ try {
+ dataNode = objectUnderTest.getDataNode(DATASPACE_NAME, ANCHOR_NAME3, getDataNodesXpaths, INCLUDE_ALL_DESCENDANTS)
+ dataNodeXpath = dataNode.getXpath()
+ assert dataNodeXpath == expectedXpaths
+ } catch (DataNodeNotFoundException) {
+ assert dataNodeXpath == expectedXpaths
+ }
+ where: 'following parameters were used'
+ scenario | xpathForDeletion | getDataNodesXpaths || expectedXpaths
+ 'child of target' | '/parent-206/child-206' | '/parent-206/child-206' || null
+ 'child data node, parent still exists' | '/parent-206/child-206' | '/parent-206' || '/parent-206'
+ 'list element' | '/parent-206/child-206/grand-child-206[@key="A"]' | '/parent-206/child-206/grand-child-206[@key="A"]' || null
+ 'list element, sibling still exists' | '/parent-206/child-206/grand-child-206[@key="A"]' | '/parent-206/child-206/grand-child-206[@key="X"]' || '/parent-206/child-206/grand-child-206[@key="X"]'
+ }