diff options
author | seanbeirne <sean.beirne@est.tech> | 2024-08-26 10:48:20 +0100 |
---|---|---|
committer | Priyank Maheshwari <priyank.maheshwari@est.tech> | 2024-09-04 08:32:12 +0000 |
commit | 196fc1208e74ac8950c6598a53a225c8951cceea (patch) | |
tree | b711fa6b8e9f230d41ed847a8afc64d7a0900d54 /cps-ncmp-service/src | |
parent | 7045c11f9b7a49c9b711a2a61b299bf886dc0836 (diff) |
Support Alternate-id for CPS-E05 module search
Issue-ID: CPS-2370
Change-Id: I0ca3a1df232ad9fd9f76695cd6ea21d36919130d
Signed-off-by: seanbeirne <sean.beirne@est.tech>
Diffstat (limited to 'cps-ncmp-service/src')
2 files changed, 13 insertions, 7 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java index cd3c00cc16..5db6e96076 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java @@ -101,12 +101,13 @@ public class NetworkCmProxyInventoryFacade { /** - * Retrieve module references for the given cm handle. + * Retrieve module references for the given cm handle reference. * - * @param cmHandleId cm handle identifier + * @param cmHandleReference cm handle or alternate id identifier * @return a collection of modules names and revisions */ - public Collection<ModuleReference> getYangResourcesModuleReferences(final String cmHandleId) { + public Collection<ModuleReference> getYangResourcesModuleReferences(final String cmHandleReference) { + final String cmHandleId = alternateIdMatcher.getCmHandleId(cmHandleReference); return inventoryPersistence.getYangResourcesModuleReferences(cmHandleId); } diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy index 3352c264a2..be2bf87df0 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy @@ -51,7 +51,6 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification { def mockTrustLevelManager = Mock(TrustLevelManager) def mockAlternateIdMatcher = Mock(AlternateIdMatcher) def objectUnderTest = new NetworkCmProxyInventoryFacade(mockCmHandleRegistrationService, mockCmHandleQueryService, mockParameterizedCmHandleQueryService, mockInventoryPersistence, spiedJsonObjectMapper, mockTrustLevelManager, mockAlternateIdMatcher) - def trustLevelPerCmHandle = [:] def 'Update DMI Registration'() { given: 'an (updated) dmi plugin registration' @@ -90,11 +89,17 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification { assert result.containsAll('cm-handle-1','cm-handle-2') } - def 'Getting Yang Resources.'() { + def 'Getting Yang Resources for a given #scenario'() { when: 'yang resources is called' - objectUnderTest.getYangResourcesModuleReferences('some-cm-handle') - then: 'CPS module services is invoked for the correct dataspace and cm handle' + objectUnderTest.getYangResourcesModuleReferences(cmHandleRef) + then: 'alternate id matcher is called' + mockAlternateIdMatcher.getCmHandleId(cmHandleRef) >> 'some-cm-handle' + and: 'CPS module services is invoked for the correct cm handle' 1 * mockInventoryPersistence.getYangResourcesModuleReferences('some-cm-handle') + where: 'following cm handle reference is used' + scenario | cmHandleRef + 'Cm Handle Reference as cm handle-id' | 'some-cm-handle' + 'Cm Handle Reference as alternate-id' | 'some-alternate-id' } def 'Get a cm handle.'() { |