From 6f25d3a2ae84aff3f22b50d10592c5321a7c98ce Mon Sep 17 00:00:00 2001
From: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Date: Mon, 11 Jan 2021 15:34:10 +0200
Subject: Delete schema set - persistence layer

Issue-ID: CPS-121
Change-Id: I6fc8343969971b76d7f78ad202dd8ec1058c03fb
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
---
 cps-ri/src/test/resources/data/schemaset.sql | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

(limited to 'cps-ri/src/test/resources/data/schemaset.sql')

diff --git a/cps-ri/src/test/resources/data/schemaset.sql b/cps-ri/src/test/resources/data/schemaset.sql
index e3fc69b08..0ec1ec3a0 100644
--- a/cps-ri/src/test/resources/data/schemaset.sql
+++ b/cps-ri/src/test/resources/data/schemaset.sql
@@ -2,13 +2,26 @@ INSERT INTO DATASPACE (ID, NAME) VALUES
     (1001, 'DATASPACE-001'), (1002, 'DATASPACE-002');
 
 INSERT INTO SCHEMA_SET (ID, NAME, DATASPACE_ID) VALUES
-    (2001, 'SCHEMA-SET-001', 1001), (2002, 'SCHEMA-SET-002', 1001);
+    (2001, 'SCHEMA-SET-001', 1001), (2002, 'SCHEMA-SET-002', 1001),
+    (2100, 'SCHEMA-SET-100', 1001), -- for removal, not referenced by anchors
+    (2101, 'SCHEMA-SET-101', 1001); -- for removal, having anchor and data associated
 
 INSERT INTO YANG_RESOURCE (ID, NAME, CONTENT, CHECKSUM) VALUES
     (3001, 'module1@2020-02-02.yang', 'CONTENT-001', '877e65a9f36d54e7702c3f073f6bc42b'),
     (3002, 'module2@2020-02-02.yang', 'CONTENT-002', '88892586b1f23fe8c1595759784a18f8'),
     (3003, 'module3@2020-02-02.yang', 'CONTENT-003', 'fc5740499a09a48e0c95d6fc45d4bde8'),
-    (3004, 'module4@2020-02-02.yang', 'CONTENT-004', '3801280fe532f5cbf535695cf6122026');
+    (3004, 'module4@2020-02-02.yang', 'CONTENT-004', '3801280fe532f5cbf535695cf6122026'),
+    (3100, 'orphan@2020-02-02.yang', 'ORPHAN', 'checksum'); -- for auto-removal as orphan
 
 INSERT INTO SCHEMA_SET_YANG_RESOURCES (SCHEMA_SET_ID, YANG_RESOURCE_ID) VALUES
-    (2001, 3001), (2001, 3002), (2002, 3003), (2002, 3004);
+    (2001, 3001), (2001, 3002),
+    (2002, 3003), (2002, 3004),
+    (2100, 3003), (2100, 3100), -- orphan removal case
+    (2101, 3003), (2101, 3004);
+
+INSERT INTO ANCHOR (ID, NAME, DATASPACE_ID, SCHEMA_SET_ID) VALUES -- anchors for removal
+    (6001, 'ANCHOR1', 1001, 2101),
+    (6002, 'ANCHOR2', 1001, 2101);
+
+INSERT INTO FRAGMENT (ID, XPATH, ANCHOR_ID, DATASPACE_ID) VALUES
+    (7001, '/XPATH', 6001, 1001);
-- 
cgit 1.2.3-korg

