diff options
author | sourabh_sourabh <sourabh.sourabh@est.tech> | 2024-07-10 12:51:31 +0100 |
---|---|---|
committer | Sourabh Sourabh <sourabh.sourabh@est.tech> | 2024-07-10 12:52:20 +0000 |
commit | 7422844ab0d1e6a9b0b761dea05337e91f7bec51 (patch) | |
tree | 51244b57b2a741570d2cafeed412fcba7ae3b69b /cps-ncmp-service/src/test | |
parent | 4962922401c1c779c6b7d1161a995942750566ed (diff) |
NCMP inventory cm handle search should support cps path query
- Added cps path query conditions for inventory search api
Issue-ID: CPS-2289
Change-Id: I0bcc9a45af65ad9d41c4d4cf79b35bfb95f50cff
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/test')
2 files changed, 18 insertions, 7 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy index dfd549e63e..013bace04d 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy @@ -57,6 +57,19 @@ class ParameterizedCmHandleQueryServiceSpec extends Specification { assert result == ['some-cmhandle-id'] as Set } + def 'Query cm handle where cps path itself is ancestor axis.'() { + given: 'a cmHandleWithCpsPath condition property' + def cmHandleQueryParameters = new CmHandleQueryServiceParameters() + def conditionProperties = createConditionProperties('cmHandleWithCpsPath', [['cpsPath' : '/some/cps/path']]) + cmHandleQueryParameters.setCmHandleQueryParameters([conditionProperties]) + and: 'the query get the cm handle data nodes excluding all descendants returns a datanode' + cmHandleQueries.queryCmHandleAncestorsByCpsPath('/some/cps/path', FetchDescendantsOption.OMIT_DESCENDANTS) >> [new DataNode(leaves: ['id':'some-cmhandle-id'])] + when: 'the query is executed for cm handle ids' + def result = objectUnderTest.queryCmHandleIdsForInventory(cmHandleQueryParameters) + then: 'the correct expected cm handles ids are returned' + assert result == ['some-cmhandle-id'] as Set + } + def 'Cm handle ids query with error: #scenario.'() { given: 'a cmHandleWithCpsPath condition property' def cmHandleQueryParameters = new CmHandleQueryServiceParameters() diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/models/InventoryQueryConditionsSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/models/InventoryQueryConditionsSpec.groovy index 51c1f4bb13..2e7122268f 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/models/InventoryQueryConditionsSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/models/InventoryQueryConditionsSpec.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================== - * Copyright (c) 2022 Nordix Foundation. + * Copyright (c) 2022-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,18 +20,16 @@ package org.onap.cps.ncmp.impl.inventory.models - import spock.lang.Specification class InventoryQueryConditionsSpec extends Specification { def 'Inventory query condition names.'() { - expect: '3 conditions with the correct names' - assert InventoryQueryConditions.ALL_CONDITION_NAMES.size() == 3 + expect: '4 conditions with the correct names' + assert InventoryQueryConditions.ALL_CONDITION_NAMES.size() == 4 assert InventoryQueryConditions.ALL_CONDITION_NAMES.containsAll('hasAllProperties', 'hasAllAdditionalProperties', - 'cmHandleWithDmiPlugin') + 'cmHandleWithDmiPlugin', + 'cmHandleWithCpsPath') } - - } |