summaryrefslogtreecommitdiffstats
path: root/cps-ri/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ri/src/test')
-rw-r--r--cps-ri/src/test/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceTest.java18
-rw-r--r--cps-ri/src/test/resources/data/anchor.sql6
-rw-r--r--cps-ri/src/test/resources/data/clear-all.sql7
3 files changed, 16 insertions, 15 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 7497526f9a..e5aac1eea8 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
@@ -29,15 +29,15 @@ import org.junit.Test;
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.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;
+import org.onap.cps.spi.repository.AnchorRepository;
import org.onap.cps.spi.repository.DataspaceRepository;
-import org.onap.cps.spi.repository.FragmentRepository;
import org.onap.cps.spi.repository.SchemaSetRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -69,7 +69,7 @@ public class CpsAdminPersistenceServiceTest {
private CpsAdminPersistenceService cpsAdminPersistenceService;
@Autowired
- private FragmentRepository fragmentRepository;
+ private AnchorRepository anchorRepository;
@Autowired
private DataspaceRepository dataspaceRepository;
@@ -102,13 +102,13 @@ public class CpsAdminPersistenceServiceTest {
// validate anchor persisted
final Dataspace dataspace = dataspaceRepository.findByName(DATASPACE_NAME).orElseThrow();
- final Fragment anchor =
- fragmentRepository.findByDataspaceAndAnchorName(dataspace, ANCHOR_NAME_NEW).orElseThrow();
+ final AnchorEntity anchorEntity =
+ anchorRepository.findByDataspaceAndName(dataspace, ANCHOR_NAME_NEW).orElseThrow();
- assertNotNull(anchor.getId());
- assertEquals(ANCHOR_NAME_NEW, anchor.getAnchorName());
- assertEquals(DATASPACE_NAME, anchor.getDataspace().getName());
- assertEquals(SCHEMA_SET_NAME2, anchor.getSchemaSet().getName());
+ assertNotNull(anchorEntity.getId());
+ assertEquals(ANCHOR_NAME_NEW, anchorEntity.getName());
+ assertEquals(DATASPACE_NAME, anchorEntity.getDataspace().getName());
+ assertEquals(SCHEMA_SET_NAME2, anchorEntity.getSchemaSet().getName());
}
@Test(expected = DataspaceNotFoundException.class)
diff --git a/cps-ri/src/test/resources/data/anchor.sql b/cps-ri/src/test/resources/data/anchor.sql
index 55075596be..1d9b4b1ecb 100644
--- a/cps-ri/src/test/resources/data/anchor.sql
+++ b/cps-ri/src/test/resources/data/anchor.sql
@@ -4,6 +4,6 @@ INSERT INTO DATASPACE (ID, NAME) VALUES
INSERT INTO SCHEMA_SET (ID, NAME, DATASPACE_ID) VALUES
(2001, 'SCHEMA-SET-001', 1001), (2002, 'SCHEMA-SET-002', 1001);
-INSERT INTO FRAGMENT (ID, XPATH, ANCHOR_NAME, DATASPACE_ID, SCHEMA_SET_ID) VALUES
- (3001, 'ANCHOR-001', 'ANCHOR-001', 1001, 2001),
- (3002, 'ANCHOR-002', 'ANCHOR-002', 1001, 2002); \ No newline at end of file
+INSERT INTO ANCHOR (ID, NAME, DATASPACE_ID, SCHEMA_SET_ID) VALUES
+ (3001, 'ANCHOR-001', 1001, 2001),
+ (3002, 'ANCHOR-002', 1001, 2002); \ No newline at end of file
diff --git a/cps-ri/src/test/resources/data/clear-all.sql b/cps-ri/src/test/resources/data/clear-all.sql
index 522f9e617e..9aee604a31 100644
--- a/cps-ri/src/test/resources/data/clear-all.sql
+++ b/cps-ri/src/test/resources/data/clear-all.sql
@@ -1,6 +1,7 @@
DELETE FROM FRAGMENT;
--- clear all via dataspace table cleanup
--- all other data will be removed by cascade
+DELETE FROM ANCHOR;
DELETE FROM DATASPACE;
--- explicit clear
+-- following tables are cleared by CASCADE constraint:
+-- SCHEMA_SET
+-- SCHEMA_SET_YANG_RESOURCES
DELETE FROM YANG_RESOURCE;