diff options
Diffstat (limited to 'integration-test/src')
-rw-r--r-- | integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy index 91a4c8ac0e..92fbdaaa25 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy @@ -24,6 +24,7 @@ import org.onap.cps.api.CpsAdminService import org.onap.cps.integration.base.CpsIntegrationSpecBase import org.onap.cps.spi.exceptions.AlreadyDefinedException import org.onap.cps.spi.exceptions.AnchorNotFoundException +import org.onap.cps.spi.exceptions.DataspaceInUseException import org.onap.cps.spi.exceptions.DataspaceNotFoundException class CpsAdminServiceIntegrationSpec extends CpsIntegrationSpecBase { @@ -49,6 +50,27 @@ class CpsAdminServiceIntegrationSpec extends CpsIntegrationSpecBase { assert thrown instanceof DataspaceNotFoundException } + def 'Delete dataspace with error; #scenario.'() { + setup: 'add some anchors if needed' + numberOfAnchors.times { + objectUnderTest.createAnchor(GENERAL_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, 'anchor' + it) + } + when: 'attempt to delete dataspace' + objectUnderTest.deleteDataspace(dataspaceName) + then: 'the correct exception is thrown with the relevant details' + def thrownException = thrown(expectedException) + thrownException.details.contains(expectedMessageDetails) + cleanup: + numberOfAnchors.times { + objectUnderTest.deleteAnchor(GENERAL_TEST_DATASPACE, 'anchor' + it) + } + where: 'the following data is used' + scenario | dataspaceName | numberOfAnchors || expectedException | expectedMessageDetails + 'dataspace name does not exist' | 'unknown' | 0 || DataspaceNotFoundException | 'unknown does not exist' + 'dataspace contains schemasets' | GENERAL_TEST_DATASPACE | 0 || DataspaceInUseException | 'contains 1 schemaset(s)' + 'dataspace contains anchors' | GENERAL_TEST_DATASPACE | 2 || DataspaceInUseException | 'contains 2 anchor(s)' + } + def 'Retrieve all dataspaces (depends on total test suite).'() { given: 'two addtional dataspaces are created' objectUnderTest.createDataspace('dataspace1') @@ -68,7 +90,7 @@ class CpsAdminServiceIntegrationSpec extends CpsIntegrationSpecBase { } def 'Anchor CRUD operations.'() { - when: 'a anchor is created' + when: 'an anchor is created' objectUnderTest.createAnchor(GENERAL_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, 'newAnchor') then: 'the anchor be read' assert objectUnderTest.getAnchor(GENERAL_TEST_DATASPACE, 'newAnchor').name == 'newAnchor' @@ -107,4 +129,26 @@ class CpsAdminServiceIntegrationSpec extends CpsIntegrationSpecBase { assert objectUnderTest.queryAnchorNames(GENERAL_TEST_DATASPACE, ['stores', 'unused-model']).size() == 0 } + def 'Duplicate anchors.'() { + given: 'an anchor is created' + objectUnderTest.createAnchor(GENERAL_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, 'newAnchor') + when: 'attempt to create another anchor with the same name' + objectUnderTest.createAnchor(GENERAL_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, 'newAnchor') + then: 'an exception is thrown that the anchor already is defined' + thrown(AlreadyDefinedException) + cleanup: + objectUnderTest.deleteAnchor(GENERAL_TEST_DATASPACE, 'newAnchor') + } + + def 'Query anchors without any known modules and #scenario'() { + when: 'querying for anchors with #scenario' + def result = objectUnderTest.queryAnchorNames(dataspaceName, ['unknownModule']) + then: 'an empty result is returned (no error)' + assert result == [] + where: + scenario | dataspaceName + 'non existing database' | 'nonExistingDataspace' + 'just unknown module(s)' | GENERAL_TEST_DATASPACE + } + } |