From c62dbd7d3538392c6b72e73631f026fef198715c Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Wed, 5 Apr 2023 17:33:05 +0100 Subject: Migrate query tests to integration-test module #4 Issue-ID: CPS-1597 Signed-off-by: danielhanrahan Change-Id: Id3b4a3829b6f9aec1a649ed0001d7c11db91ccfe --- .../CpsDataPersistenceQueryDataNodeSpec.groovy | 33 ---------------------- 1 file changed, 33 deletions(-) (limited to 'cps-ri/src') diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy index 60aaa8114..9df20f721 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy @@ -147,39 +147,6 @@ class CpsDataPersistenceQueryDataNodeSpec extends CpsPersistenceSpecBase { 'mix of partial key and non key leaf' | '//author[@FirstName="Joe" and @title="Dune"]' || ["/shops/shop[@id='1']/categories[@code='1']/book/author[@FirstName='Joe' and @Surname='Bloggs']"] } - @Sql([CLEAR_DATA, SET_DATA]) - def 'Query for attribute by cps path of type ancestor with #scenario.'() { - when: 'the given cps path is parsed' - def result = objectUnderTest.queryDataNodes(DATASPACE_NAME, ANCHOR_FOR_SHOP_EXAMPLE, cpsPath, INCLUDE_ALL_DESCENDANTS) - then: 'the xpaths of the retrieved data nodes are as expected' - result.size() == expectedXPaths.size() - if (result.size() > 0) { - def resultXpaths = result.stream().map(it -> it.xpath).collect(Collectors.toSet()) - resultXpaths.containsAll(expectedXPaths) - result.each { - assert it.childDataNodes.size() == expectedNumberOfChildren - } - } - where: 'the following data is used' - scenario | cpsPath || expectedXPaths || expectedNumberOfChildren - 'multiple list-ancestors' | '//book/ancestor::categories' || ["/shops/shop[@id='1']/categories[@code='2']", "/shops/shop[@id='1']/categories[@code='1']"] || 1 - 'one ancestor with list value' | '//book/ancestor::categories[@code=1]' || ["/shops/shop[@id='1']/categories[@code='1']"] || 1 - 'top ancestor' | '//shop[@id=1]/ancestor::shops' || ['/shops'] || 5 - 'list with index value in the xpath prefix' | '//categories[@code=1]/book/ancestor::shop[@id=1]' || ["/shops/shop[@id='1']"] || 3 - 'ancestor with parent list' | '//book/ancestor::shop[@id=1]/categories[@code=2]' || ["/shops/shop[@id='1']/categories[@code='2']"] || 1 - 'ancestor with parent' | '//phonenumbers[@type="mob"]/ancestor::info/contact' || ["/shops/shop[@id='3']/info/contact"] || 3 - 'ancestor combined with text condition' | '//book/title[text()="Dune"]/ancestor::shop' || ["/shops/shop[@id='1']"] || 3 - 'ancestor with parent that does not exist' | '//book/ancestor::parentDoesNoExist/categories' || [] || null - 'ancestor does not exist' | '//book/ancestor::ancestorDoesNotExist' || [] || null - } - - def 'Cps Path query with syntax error throws a CPS Path Exception.'() { - when: 'trying to execute a query with a syntax (parsing) error' - objectUnderTest.queryDataNodes(DATASPACE_NAME, ANCHOR_FOR_SHOP_EXAMPLE, 'cpsPath that cannot be parsed' , OMIT_DESCENDANTS) - then: 'a cps path exception is thrown' - thrown(CpsPathException) - } - @Sql([CLEAR_DATA, SET_DATA]) def 'Cps Path query across anchors for leaf value(s) with : #scenario.'() { when: 'a query is executed to get a data node by the given cps path' -- cgit 1.2.3-korg