diff options
author | Sourabh Sourabh <sourabh.sourabh@est.tech> | 2022-11-21 13:26:49 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-11-21 13:26:49 +0000 |
commit | 35b7b02cc26cc4fac4d2d2f15a6d38774fba1fe6 (patch) | |
tree | 9c65c50c663eb3404324dba5c17851bfcdb48c44 /cps-ri/src/test | |
parent | 17cbd7b1b51f8d961ad6a908d12c767497afceb9 (diff) | |
parent | cec0cb7254ede8a790ec6f70ad5e31d10e2d32d7 (diff) |
Merge "Added get APIs for dataspace."
Diffstat (limited to 'cps-ri/src/test')
-rw-r--r-- | cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsAdminPersistenceServiceSpec.groovy | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsAdminPersistenceServiceSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsAdminPersistenceServiceSpec.groovy index cdb3e6c735..99d44aac89 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsAdminPersistenceServiceSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsAdminPersistenceServiceSpec.groovy @@ -3,6 +3,7 @@ * Copyright (C) 2021-2022 Nordix Foundation * Modifications Copyright (C) 2021 Pantheon.tech * Modifications Copyright (C) 2022 Bell Canada + * Modifications Copyright (C) 2022 TechMahindra Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +31,7 @@ import org.onap.cps.spi.exceptions.DataspaceInUseException import org.onap.cps.spi.exceptions.DataspaceNotFoundException import org.onap.cps.spi.exceptions.SchemaSetNotFoundException import org.onap.cps.spi.model.Anchor +import org.onap.cps.spi.model.Dataspace import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.jdbc.Sql import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper @@ -68,6 +70,32 @@ class CpsAdminPersistenceServiceSpec extends CpsPersistenceSpecBase { } @Sql([CLEAR_DATA, SET_DATA]) + def 'Get a dataspace.'() { + when: 'dataspace is retrieved' + def dataspace = objectUnderTest.getDataspace(DATASPACE_NAME) + then: ' the response contains expected dataspace' + assert dataspace.getName().equals(DATASPACE_NAME); + } + + @Sql([CLEAR_DATA, SET_DATA]) + def 'Get all dataspaces.'() { + when: 'all dataspaces are retrieved' + def dataspaces = objectUnderTest.getAllDataspaces() + then: 'the response contains expected dataspaces' + def expectedDataspaces = Set.of(new Dataspace(name: 'DATASPACE-001'), new Dataspace(name: 'DATASPACE-002-NO-DATA'), + new Dataspace(name: 'DATASPACE-003')) + assert dataspaces == expectedDataspaces + } + + @Sql([CLEAR_DATA, SET_DATA]) + def 'Get non existing dataspace.'() { + when: 'attempting to retrieve a non-existing dataspace' + def dataspace = objectUnderTest.getDataspace('non_existing_dataspace') + then: 'an DataspaceNotFoundException is thrown' + thrown(DataspaceNotFoundException) + } + + @Sql([CLEAR_DATA, SET_DATA]) def 'Create and retrieve a new anchor.'() { when: 'a new anchor is created' def newAnchorName = 'my-new-anchor' |