...
Wherein the test values are:
Code Block | ||
---|---|---|
| ||
INSERT INTO FRAGMENT (ID, DATASPACE_ID, ANCHOR_ID, PARENT_ID, XPATH, ATTRIBUTES) VALUES (21, 1001, 1003, 1, '/dmi-registry', '{}'), (22, 1001, 1003, 9, '/dmi-registry/cm-handles[@id="PNFDemo"]', '{"id": "PNFDemo","dmi-service-name": "http://172.18.192.19:8783","dmi-data-service-name": "","dmi-model-service-name": ""}'), (23, 1001, 1003, 10,'/dmi-registry/cm-handles[@id="sampleId_1"]/additional-properties[@name="Book1"]', '{"name": "Book1", "value": "Romance Book"}'), (24, 1001, 1003, 9, '/dmi-registry/cm-handles[@id="sampleId_2"]', '{"id": "sampleId_2","dmi-service-name": "http://172.18.192.19:8783","state": "ADVISED"}'), (25, 1001, 1003, 9, '/dmi-registry/cm-handles[@id="sampleId_3"]', '{"id": "sampleId_3","dmi-service-name": "http://172.18.192.19:8783","state": "READY"}'), (26, 1001, 1003, 9, '/dmi-registry/cm-handles[@id="sampleId_4"]', '{"id": "sampleId_4","dmi-service-name": "http://172.18.192.19:8783","state": "ADVISED"}'); |
and the groovy test:
Code Block | collapse | true
---|
@Sql([CLEAR_DATA, SET_DATA]) def 'SAMPLE: Cps Path query to determine nodes with #scenario'() { when: 'a query is executed to get a data node by the given cps path' def result = objectUnderTest.queryDataNodes(DATASPACE_NAME, ANCHOR_FOR_SHOP_EXAMPLE, cpsPath, OMIT_DESCENDANTS) then: 'the correct number of data nodes are retrieved' result.size() == expectedXPaths.size() and: 'xpaths of the retrieved data nodes are as expected' for (int i = 0; i < result.size(); i++) { assert result[i].getXpath() == expectedXPaths[i] } where: 'the following data is used' scenario | cpsPath || expectedXPaths ' ' | '//cm-handles[@id="PNFDemo"]' || ['/dmi-registry/cm-handles[@id="PNFDemo"]'] ' ' | '//additional-properties[@value="Romance Book"]' || ['/dmi-registry/cm-handles[@id="sampleId_1"]/additional-properties[@name="Book1"]'] ' ' | '//cm-handles[@state="ADVISED"]' || ['/dmi-registry/cm-handles[@id="sampleId_2"]','/dmi-registry/cm-handles[@id="sampleId_4"]'] |
...