diff options
author | 2021-01-13 16:45:29 +0200 | |
---|---|---|
committer | 2021-01-13 16:46:11 +0200 | |
commit | e08a5ca5c9edcb15a72235bdfd935ff3a3ced8d2 (patch) | |
tree | 6735c031d9861c6786c039d4b2dd02d140d3feff /cps-ri/src/test | |
parent | 49fe075361e4f0f3b2a1a561bc01f831983a3efb (diff) |
Rename entity artifacts, remove obsolete entities
Issue-ID: CPS-162
Change-Id: I10604e12a01f22930278118830eed53f5a2b159c
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 | 14 | ||||
-rw-r--r-- | cps-ri/src/test/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceTest.java | 36 |
2 files changed, 25 insertions, 25 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 e5aac1eea..02487078d 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 77c8003a1..e813d26bf 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<YangResource> yangResources = schemaSet.getYangResources(); - assertNotNull(yangResources); - assertEquals(1, yangResources.size()); + final Set<YangResourceEntity> 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<String, String> toMap(final String key, final String value) { return ImmutableMap.<String, String>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(); } } |