From 04280e2f93bbf30e8654c411bb1e107d275c22bb Mon Sep 17 00:00:00 2001 From: "halil.cakal" Date: Tue, 23 Jan 2024 10:05:36 +0000 Subject: Extend API: Get Module Definitions - add query parameters: module-name and revision to OpenAPI - extend the controller method to hande the new parameters - add the new method stack to the service layer - extend the SQL query to support the new parameters - add unit and integration testwares Issue-ID: CPS-1135 Change-Id: I089ad2ad71effb58ac0ba809e9f441d6cdb59c4f Signed-off-by: halil.cakal --- .../functional/CpsModuleServiceIntegrationSpec.groovy | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'integration-test') diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsModuleServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsModuleServiceIntegrationSpec.groovy index cf0e0b594..8029ae042 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsModuleServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsModuleServiceIntegrationSpec.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2023 Nordix Foundation + * Copyright (C) 2023-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. @@ -21,7 +21,6 @@ package org.onap.cps.integration.functional import org.onap.cps.api.CpsModuleService -import org.onap.cps.api.impl.CpsModuleServiceImpl import org.onap.cps.integration.base.FunctionalSpecBase import org.onap.cps.spi.CascadeDeleteAllowed import org.onap.cps.spi.exceptions.AlreadyDefinedException @@ -153,6 +152,17 @@ class CpsModuleServiceIntegrationSpec extends FunctionalSpecBase { result == [new ModuleDefinition('stores','2020-09-15','')] } + def 'Retrieving module definitions: #scenarios'() { + when: 'module definitions for module name are retrieved' + def result = objectUnderTest.getModuleDefinitionsByAnchorAndModule(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, moduleName, moduleRevision) + then: 'the correct module definitions are returned' + result == [new ModuleDefinition('stores','2020-09-15','')] + where: 'following parameters are used' + scenarios | moduleName | moduleRevision + 'both specified' | 'stores' | '2020-09-15' + 'module name specified' | 'stores' | null + } + def 'Retrieving yang resource module references by anchor.'() { when: 'the yang resource module references for an anchor are retrieved' def result = objectUnderTest.getYangResourcesModuleReferences(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1) -- cgit 1.2.3-korg