summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test/groovy/org/onap
diff options
context:
space:
mode:
authorhalil.cakal <halil.cakal@est.tech>2024-01-23 10:05:36 +0000
committerhalil.cakal <halil.cakal@est.tech>2024-02-01 16:41:39 +0000
commit04280e2f93bbf30e8654c411bb1e107d275c22bb (patch)
treefaf4ac9ae4d80617f6b11cb0d78174e0c12452db /cps-service/src/test/groovy/org/onap
parent0f6a966b363e5347de2d44b1527d19b4cf2825a6 (diff)
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 <halil.cakal@est.tech>
Diffstat (limited to 'cps-service/src/test/groovy/org/onap')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy18
1 files changed, 14 insertions, 4 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
index d909e27abf..0bad0de6ac 100644
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020-2023 Nordix Foundation
+ * Copyright (C) 2020-2024 Nordix Foundation
* Modifications Copyright (C) 2020-2021 Pantheon.tech
* Modifications Copyright (C) 2020-2022 Bell Canada.
* Modifications Copyright (C) 2022 TechMahindra Ltd.
@@ -238,15 +238,25 @@ class CpsModuleServiceImplSpec extends Specification {
1 * mockCpsModulePersistenceService.identifyNewModuleReferences(moduleReferencesToCheck)
}
- def 'Getting module definitions.'() {
- given: 'the module persistence service returns a collection of module definitions'
+ def 'Getting module definitions with module name'() {
+ given: 'module persistence service returns module definitions for module name'
+ def moduleDefinitionsFromPersistenceService = [ new ModuleDefinition('name', 'revision', 'content' ) ]
+ mockCpsModulePersistenceService.getYangResourceDefinitionsByAnchorAndModule('some-dataspace-name', 'some-anchor-name', 'some-module', '2024-01-01') >> moduleDefinitionsFromPersistenceService
+ when: 'get module definitions method is called with anchor and module name'
+ def result = objectUnderTest.getModuleDefinitionsByAnchorAndModule('some-dataspace-name', 'some-anchor-name', 'some-module', '2024-01-01')
+ then: 'the result is the same collection returned by the persistence service'
+ assert result == moduleDefinitionsFromPersistenceService
+ }
+
+ def 'Getting module definitions with anchor name'() {
+ given: 'the module persistence service returns module definitions for cm handle id'
def moduleDefinitionsFromPersistenceService = [ new ModuleDefinition('name', 'revision', 'content' ) ]
mockCpsModulePersistenceService.getYangResourceDefinitions('some-dataspace-name', 'some-anchor-name') >> moduleDefinitionsFromPersistenceService
when: 'get module definitions method is called with a valid dataspace and anchor name'
def result = objectUnderTest.getModuleDefinitionsByAnchorName('some-dataspace-name', 'some-anchor-name')
then: 'the result is the same collection returned by the persistence service'
assert result == moduleDefinitionsFromPersistenceService
- and: 'the CpsValidator is called on the dataspaceName and schemaSetName'
+ and: 'cps validator is called on the dataspace and anchor name'
1 * mockCpsValidator.validateNameCharacters('some-dataspace-name', 'some-anchor-name')
}