diff options
author | 2020-12-10 10:49:59 +0200 | |
---|---|---|
committer | 2021-01-06 15:03:59 +0200 | |
commit | 5a8718b84dbd3c6fa78aa644a4695274a0a1ab5d (patch) | |
tree | 4dbd96f90aee895053036d5616a00b9912dcde82 /cps-ri/src/test | |
parent | ec3e17505d12785586fc2418438c3d45b63d7dbd (diff) |
Create dataspace
Issue-ID: CPS-134
Change-Id: Ie7f00f9c322a12a6c2a71c1407f6970a7dd24d2d
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Diffstat (limited to 'cps-ri/src/test')
-rw-r--r-- | cps-ri/src/test/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceTest.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceTest.java b/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceTest.java index 455369d2c..7497526f9 100644 --- a/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceTest.java +++ b/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceTest.java @@ -32,6 +32,7 @@ import org.onap.cps.spi.CpsAdminPersistenceService; import org.onap.cps.spi.entities.Dataspace; import org.onap.cps.spi.entities.Fragment; import org.onap.cps.spi.exceptions.AnchorAlreadyDefinedException; +import org.onap.cps.spi.exceptions.DataspaceAlreadyDefinedException; import org.onap.cps.spi.exceptions.DataspaceNotFoundException; import org.onap.cps.spi.exceptions.SchemaSetNotFoundException; import org.onap.cps.spi.model.Anchor; @@ -78,6 +79,24 @@ public class CpsAdminPersistenceServiceTest { @Test @SqlGroup({@Sql(CLEAR_DATA), @Sql(SET_DATA)}) + public void testCreateDataspace() { + final String dataspaceName = "DATASPACE-NEW"; + cpsAdminPersistenceService.createDataspace(dataspaceName); + + final Dataspace dataspace = dataspaceRepository.findByName(dataspaceName).orElseThrow(); + assertNotNull(dataspace); + assertNotNull(dataspace.getId()); + assertEquals(dataspaceName, dataspace.getName()); + } + + @Test(expected = DataspaceAlreadyDefinedException.class) + @SqlGroup({@Sql(CLEAR_DATA), @Sql(SET_DATA)}) + public void testCreateDataspaceWithNameAlreadyDefined() { + cpsAdminPersistenceService.createDataspace(DATASPACE_NAME); + } + + @Test + @SqlGroup({@Sql(CLEAR_DATA), @Sql(SET_DATA)}) public void testCreateAnchor() { cpsAdminPersistenceService.createAnchor(DATASPACE_NAME, SCHEMA_SET_NAME2, ANCHOR_NAME_NEW); |