From e08a5ca5c9edcb15a72235bdfd935ff3a3ced8d2 Mon Sep 17 00:00:00 2001 From: Ruslan Kashapov Date: Wed, 13 Jan 2021 16:45:29 +0200 Subject: Rename entity artifacts, remove obsolete entities Issue-ID: CPS-162 Change-Id: I10604e12a01f22930278118830eed53f5a2b159c Signed-off-by: Ruslan Kashapov --- .../spi/impl/CpsAdminPersistenceServiceTest.java | 14 ++++----- .../spi/impl/CpsModulePersistenceServiceTest.java | 36 +++++++++++----------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'cps-ri/src/test/java/org') 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 e5aac1eea8..02487078d0 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 @@ -30,7 +30,7 @@ import org.junit.runner.RunWith; import org.onap.cps.DatabaseTestContainer; import org.onap.cps.spi.CpsAdminPersistenceService; import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.Dataspace; +import org.onap.cps.spi.entities.DataspaceEntity; import org.onap.cps.spi.exceptions.AnchorAlreadyDefinedException; import org.onap.cps.spi.exceptions.DataspaceAlreadyDefinedException; import org.onap.cps.spi.exceptions.DataspaceNotFoundException; @@ -83,10 +83,10 @@ public class CpsAdminPersistenceServiceTest { final String dataspaceName = "DATASPACE-NEW"; cpsAdminPersistenceService.createDataspace(dataspaceName); - final Dataspace dataspace = dataspaceRepository.findByName(dataspaceName).orElseThrow(); - assertNotNull(dataspace); - assertNotNull(dataspace.getId()); - assertEquals(dataspaceName, dataspace.getName()); + final DataspaceEntity dataspaceEntity = dataspaceRepository.findByName(dataspaceName).orElseThrow(); + assertNotNull(dataspaceEntity); + assertNotNull(dataspaceEntity.getId()); + assertEquals(dataspaceName, dataspaceEntity.getName()); } @Test(expected = DataspaceAlreadyDefinedException.class) @@ -101,9 +101,9 @@ public class CpsAdminPersistenceServiceTest { cpsAdminPersistenceService.createAnchor(DATASPACE_NAME, SCHEMA_SET_NAME2, ANCHOR_NAME_NEW); // validate anchor persisted - final Dataspace dataspace = dataspaceRepository.findByName(DATASPACE_NAME).orElseThrow(); + final DataspaceEntity dataspaceEntity = dataspaceRepository.findByName(DATASPACE_NAME).orElseThrow(); final AnchorEntity anchorEntity = - anchorRepository.findByDataspaceAndName(dataspace, ANCHOR_NAME_NEW).orElseThrow(); + anchorRepository.findByDataspaceAndName(dataspaceEntity, ANCHOR_NAME_NEW).orElseThrow(); assertNotNull(anchorEntity.getId()); assertEquals(ANCHOR_NAME_NEW, anchorEntity.getName()); diff --git a/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceTest.java b/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceTest.java index 77c8003a17..e813d26bf5 100644 --- a/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceTest.java +++ b/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceTest.java @@ -30,9 +30,9 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.onap.cps.DatabaseTestContainer; import org.onap.cps.spi.CpsModulePersistenceService; -import org.onap.cps.spi.entities.Dataspace; -import org.onap.cps.spi.entities.SchemaSet; -import org.onap.cps.spi.entities.YangResource; +import org.onap.cps.spi.entities.DataspaceEntity; +import org.onap.cps.spi.entities.SchemaSetEntity; +import org.onap.cps.spi.entities.YangResourceEntity; import org.onap.cps.spi.exceptions.DataspaceNotFoundException; import org.onap.cps.spi.exceptions.SchemaSetAlreadyDefinedException; import org.onap.cps.spi.repository.DataspaceRepository; @@ -124,33 +124,33 @@ public class CpsModulePersistenceServiceTest { final String expectedYangResourceChecksum) { // assert the schema set is persisted - final SchemaSet schemaSet = getSchemaSetFromDatabase(expectedDataspaceName, expectedSchemaSetName); - assertEquals(expectedDataspaceName, schemaSet.getDataspace().getName()); - assertEquals(expectedSchemaSetName, schemaSet.getName()); + final SchemaSetEntity schemaSetEntity = getSchemaSetFromDatabase(expectedDataspaceName, expectedSchemaSetName); + assertEquals(expectedDataspaceName, schemaSetEntity.getDataspace().getName()); + assertEquals(expectedSchemaSetName, schemaSetEntity.getName()); // assert the attached yang resource is persisted - final Set yangResources = schemaSet.getYangResources(); - assertNotNull(yangResources); - assertEquals(1, yangResources.size()); + final Set yangResourceEntities = schemaSetEntity.getYangResources(); + assertNotNull(yangResourceEntities); + assertEquals(1, yangResourceEntities.size()); // assert the attached yang resource content - final YangResource yangResource = yangResources.iterator().next(); - assertNotNull(yangResource.getId()); + final YangResourceEntity yangResourceEntity = yangResourceEntities.iterator().next(); + assertNotNull(yangResourceEntity.getId()); if (expectedYangResourceId != NEW_RESOURCE_ABSTRACT_ID) { // existing resource with known id - assertEquals(expectedYangResourceId, yangResource.getId()); + assertEquals(expectedYangResourceId, yangResourceEntity.getId()); } - assertEquals(expectedYangResourceName, yangResource.getName()); - assertEquals(expectedYangResourceContent, yangResource.getContent()); - assertEquals(expectedYangResourceChecksum, yangResource.getChecksum()); + assertEquals(expectedYangResourceName, yangResourceEntity.getName()); + assertEquals(expectedYangResourceContent, yangResourceEntity.getContent()); + assertEquals(expectedYangResourceChecksum, yangResourceEntity.getChecksum()); } private static Map toMap(final String key, final String value) { return ImmutableMap.builder().put(key, value).build(); } - private SchemaSet getSchemaSetFromDatabase(final String dataspaceName, final String schemaSetName) { - final Dataspace dataspace = dataspaceRepository.findByName(dataspaceName).orElseThrow(); - return schemaSetRepository.findByDataspaceAndName(dataspace, schemaSetName).orElseThrow(); + private SchemaSetEntity getSchemaSetFromDatabase(final String dataspaceName, final String schemaSetName) { + final DataspaceEntity dataspaceEntity = dataspaceRepository.findByName(dataspaceName).orElseThrow(); + return schemaSetRepository.findByDataspaceAndName(dataspaceEntity, schemaSetName).orElseThrow(); } } -- cgit 1.2.3-korg