summaryrefslogtreecommitdiffstats
path: root/integration-test/src
diff options
context:
space:
mode:
authorToineSiebelink <toine.siebelink@est.tech>2023-05-15 17:32:28 +0100
committerSourabh Sourabh <sourabh.sourabh@est.tech>2023-05-17 08:41:28 +0000
commit872a5a063378c878ec49e50c23e50df7a370cd1a (patch)
treef03d9d621a80f3fafe86201cabc4dcc0eb5d5aa9 /integration-test/src
parent592c0f64ad1d1b2ed708ea9e352c8763459bde25 (diff)
Move integration test for adminService
- finalized moving of admin service interation test (just some scenarios were missing) - deleted old test class (code coverage in RI module dropped) - line/branch coverage now 100/100 (was 97/91) - small refactoring; renaming and removed unnecessary check Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: Ic683548ea5e1e4e252f257c0f1034c5cf76e498d
Diffstat (limited to 'integration-test/src')
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy46
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
+ }
+
}