summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test
diff options
context:
space:
mode:
authorRuslan Kashapov <ruslan.kashapov@pantheon.tech>2021-01-11 15:34:10 +0200
committerRuslan Kashapov <ruslan.kashapov@pantheon.tech>2021-01-19 14:08:37 +0200
commitdce4e316da66ede214977491c712b0a4ab457644 (patch)
tree992a172ed47557717468afff2628691b71f1eb5c /cps-service/src/test
parent6f25d3a2ae84aff3f22b50d10592c5321a7c98ce (diff)
Delete schema set - REST and service layers
Issue-ID: CPS-121 Change-Id: I0fe885c79f98c994a8ac25a59b77b99eee4b3076 Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Diffstat (limited to 'cps-service/src/test')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy19
1 files changed, 18 insertions, 1 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 ebe4fe7bce..f380d106c7 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
@@ -21,10 +21,15 @@
package org.onap.cps.api.impl
import org.onap.cps.TestUtils
+import org.onap.cps.spi.CascadeDeleteAllowed
import org.onap.cps.spi.CpsModulePersistenceService;
import org.onap.cps.spi.exceptions.ModelValidationException
import org.onap.cps.spi.model.ModuleReference
import spock.lang.Specification
+import spock.lang.Unroll
+
+import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_ALLOWED
+import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED
class CpsModuleServiceImplSpec extends Specification {
def mockModuleStoreService = Mock(CpsModulePersistenceService)
@@ -52,7 +57,7 @@ class CpsModuleServiceImplSpec extends Specification {
thrown(ModelValidationException.class)
}
- def 'Get schema set by name and namespace.'() {
+ def 'Get schema set by name and dataspace.'() {
given: 'an already present schema set'
def yangResourcesNameToContentMap = TestUtils.getYangResourcesAsMap('bookstore.yang')
mockModuleStoreService.getYangSchemaResources('someDataspace', 'someSchemaSet') >> yangResourcesNameToContentMap
@@ -63,4 +68,16 @@ class CpsModuleServiceImplSpec extends Specification {
result.getDataspaceName().contains('someDataspace')
result.getModuleReferences().contains(new ModuleReference('stores', 'org:onap:ccsdk:sample', '2020-09-15'))
}
+
+ @Unroll
+ def 'Delete set by name and dataspace with #cascadeDeleteOption.'(){
+ when: 'schema set deletion is requested'
+ objectUnderTest.deleteSchemaSet(dataspaceName, schemaSetname, cascadeDeleteOption)
+ then: 'persistence service method is invoked with same parameters'
+ mockModuleStoreService.deleteSchemaSet(dataspaceName, schemaSetname, cascadeDeleteOption)
+ where: 'following parameters are used'
+ dataspaceName | schemaSetname | cascadeDeleteOption
+ 'dataspace-1' | 'schemas-set-1' | CASCADE_DELETE_ALLOWED
+ 'dataspace-2' | 'schemas-set-2' | CASCADE_DELETE_PROHIBITED
+ }
}