From 3d2864445664c14c073e6001bbab0c216bc56831 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Thu, 13 Nov 2025 09:32:33 +0100 Subject: [PATCH 01/28] remove data migrations from src/test/resources/test/db --- .../db/migration/V0001.1__dev-data-users.sql | 61 --- .../migration/V0001.2__dev-data-schemas.sql | 505 ------------------ .../db/migration/V0001.3__dev-data-rds.sql | 68 --- .../V0001.4__dev-data-membership.sql | 43 -- .../db/migration/V0001.5__dev-settings.sql | 73 --- .../db/migration/V0001.6__test-schemas.sql | 161 ------ 6 files changed, 911 deletions(-) delete mode 100644 src/test/resources/test/db/migration/V0001.1__dev-data-users.sql delete mode 100644 src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql delete mode 100644 src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql delete mode 100644 src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql delete mode 100644 src/test/resources/test/db/migration/V0001.5__dev-settings.sql delete mode 100644 src/test/resources/test/db/migration/V0001.6__test-schemas.sql diff --git a/src/test/resources/test/db/migration/V0001.1__dev-data-users.sql b/src/test/resources/test/db/migration/V0001.1__dev-data-users.sql deleted file mode 100644 index cd8e0a967..000000000 --- a/src/test/resources/test/db/migration/V0001.1__dev-data-users.sql +++ /dev/null @@ -1,61 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - --- User Accounts -INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) -VALUES ('95589e50-d261-492b-8852-9324e9a66a42', 'Admin', 'von Universe', 'admin@example.com', '$2a$10$L.0OZ8QjV3yLhoCDvU04gu.WP1wGQih41MsBdvtQOshJJntaugBxe', 'ADMIN', NOW(), NOW()); - -INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) -VALUES ('7e64818d-6276-46fb-8bb1-732e6e09f7e9', 'Albert', 'Einstein', 'albert.einstein@example.com', '$2a$10$hZF1abbZ48Tf.3RndC9W6OlDt6gnBoD/2HbzJayTs6be7d.5DbpnW', 'USER', NOW(), NOW()); - -INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) -VALUES ('b5b92c69-5ed9-4054-954d-0121c29b6800', 'Nikola', 'Tesla', 'nikola.tesla@example.com', '$2a$10$tMbZUZg9AbYL514R.hZ0tuzvfZJR5NQhSVeJPTQhNwPf6gv/cvrna', 'USER', NOW(), NOW()); - -INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) -VALUES ('8d1a4c06-bb0e-4d03-a01f-14fa49bbc152', 'Isaac', 'Newton', 'isaac.newton@example.com', '$2a$10$DLkI7NAZDzWVaKG1lVtloeoPNLPoAgDDBqQKQiSAYDZXrf2QKkuHC', 'USER', NOW(), NOW()); - --- API Keys -INSERT INTO public.api_key (uuid, token, user_account_id, created_at, updated_at) -VALUES ('a1c00673-24c5-4e0a-bdbe-22e961ee7548', 'a274793046e34a219fd0ea6362fcca61a001500b71724f4c973a017031653c20', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', NOW(), NOW()); - -INSERT INTO public.api_key (uuid, token, user_account_id, created_at, updated_at) -VALUES ('62657760-21fe-488c-a0ea-f612a70493da', 'dd5dc3b53b6145cfa9f6c58b72ebad21cd2f860ace62451ba4e3c74a0e63540a', 'b5b92c69-5ed9-4054-954d-0121c29b6800', NOW(), NOW()); - --- Saved Search Queries -INSERT INTO public.search_saved_query (uuid, name, description, type, var_prefixes, var_graph_pattern, var_ordering, user_account_id, created_at, updated_at) -VALUES ('d31e3da1-2cfa-4b55-a8cb-71d1acf01aef', 'All datasets', 'Quickly query all datasets (DCAT)', 'PUBLIC', - 'PREFIX dcat: ', '?entity rdf:type dcat:Dataset .', 'ASC(?title)', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', - NOW(), NOW()); - -INSERT INTO public.search_saved_query (uuid, name, description, type, var_prefixes, var_graph_pattern, var_ordering, user_account_id, created_at, updated_at) -VALUES ('c7d0b6a0-5b0a-4b0e-9b0a-9b0a9b0a9b0a', 'All distributions', 'Quickly query all distributions (DCAT)', 'INTERNAL', - 'PREFIX dcat: ', '?entity rdf:type dcat:Distribution .', 'ASC(?title)', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', - NOW(), NOW()); - -INSERT INTO public.search_saved_query (uuid, name, description, type, var_prefixes, var_graph_pattern, var_ordering, user_account_id, created_at, updated_at) -VALUES ('97da9119-834e-4687-8321-3df157547178', 'Things with data', 'This is private query of Nikola Tesla!', 'PRIVATE', - 'PREFIX dcat: ', -'?entity ?relationPredicate ?relationObject . -FILTER isLiteral(?relationObject) -FILTER CONTAINS(LCASE(str(?relationObject)), LCASE("data"))', - 'ASC(?title)', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', NOW(), NOW()); diff --git a/src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql b/src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql deleted file mode 100644 index 310c8377f..000000000 --- a/src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql +++ /dev/null @@ -1,505 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - --- Resource -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('6a668323-3936-4b53-8380-a4fd2ed082ee', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('71d77460-f919-4f72-b265-ed26567fe361', - '6a668323-3936-4b53-8380-a4fd2ed082ee', - NULL, - '1.0.0', - 'Resource', - '', - '@prefix : . - @prefix dash: . - @prefix dcat: . - @prefix dct: . - @prefix foaf: . - @prefix sh: . - @prefix xsd: . - - :ResourceShape a sh:NodeShape ; - sh:targetClass dcat:Resource ; - sh:property [ - sh:path dct:title ; - sh:nodeKind sh:Literal ; - sh:minCount 1 ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - sh:order 1 ; - ], [ - sh:path dct:description ; - sh:nodeKind sh:Literal ; - sh:maxCount 1 ; - dash:editor dash:TextAreaEditor ; - sh:order 2 ; - ], [ - sh:path dct:publisher ; - sh:node :AgentShape ; - sh:minCount 1 ; - sh:maxCount 1 ; - dash:editor dash:BlankNodeEditor ; - sh:order 3 ; - ], [ - sh:path dcat:version ; - sh:name "version" ; - sh:nodeKind sh:Literal ; - sh:minCount 1 ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 4 ; - ], [ - sh:path dct:language ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:defaultValue ; - sh:order 5 ; - ], [ - sh:path dct:license ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:defaultValue ; - sh:order 6 ; - ], [ - sh:path dct:rights ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 7 ; - ] . - - :AgentShape a sh:NodeShape ; - sh:targetClass foaf:Agent ; - sh:property [ - sh:path foaf:name ; - sh:nodeKind sh:Literal ; - sh:minCount 1 ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - ] . - ', - ARRAY ['http://www.w3.org/ns/dcat#Resource'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - TRUE, - NULL, - NULL, - NOW(), - NOW()); - --- Data Service -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('89d94c1b-f6ff-4545-ba9b-120b2d1921d0', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('9111d436-fe58-4bd5-97ae-e6f86bc2997a', - '89d94c1b-f6ff-4545-ba9b-120b2d1921d0', - NULL, - '1.0.0', - 'Data Service', - '', - '@prefix : . -@prefix dash: . -@prefix dcat: . -@prefix dct: . -@prefix sh: . -@prefix xsd: . - -:DataServiceShape a sh:NodeShape ; - sh:targetClass dcat:DataService ; - sh:property [ - sh:path dcat:endpointURL ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - sh:order 20 ; - ] , [ - sh:path dcat:endpointDescription ; - sh:nodeKind sh:Literal ; - sh:maxCount 1 ; - dash:editor dash:TextAreaEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 21 ; -] . -', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#DataService'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('2efc8366-541d-493f-8661-69ad8f72dfa1', '9111d436-fe58-4bd5-97ae-e6f86bc2997a', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); - --- Metadata Service -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('6f7a5a76-6185-4bd0-9fe9-62ecc90c9bad', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('36b22b70-6203-4dd2-9fb6-b39a776bf467', - '6f7a5a76-6185-4bd0-9fe9-62ecc90c9bad', - NULL, - '1.0.0', - 'Metadata Service', - '', - '@prefix : . -@prefix fdp: . -@prefix sh: . - -:MetadataServiceShape a sh:NodeShape ; - sh:targetClass fdp:MetadataService . -', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#DataService', 'https://w3id.org/fdp/fdp-o#MetadataService'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('8742361b-cd00-4167-b859-e45fa36d0cb7', '36b22b70-6203-4dd2-9fb6-b39a776bf467', '89d94c1b-f6ff-4545-ba9b-120b2d1921d0', 0); - --- FAIR Data Point -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('a92958ab-a414-47e6-8e17-68ba96ba3a2b', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('4e64208d-f102-45a0-96e3-17b002e6213e', - 'a92958ab-a414-47e6-8e17-68ba96ba3a2b', - NULL, - '1.0.0', - 'FAIR Data Point', - '', - '@prefix : . -@prefix dash: . -@prefix dct: . -@prefix fdp: . -@prefix sh: . -@prefix xsd: . - -:FDPShape a sh:NodeShape ; - sh:targetClass fdp:FAIRDataPoint ; - sh:property [ - sh:path fdp:startDate ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 40 ; - ] , [ - sh:path fdp:endDate ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 41 ; - ] , [ - sh:path fdp:uiLanguage ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - sh:defaultValue ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 42 ; - ] , [ - sh:path fdp:metadataIdentifier ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 43 ; - ] , [ - sh:path fdp:metadataIssued ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:viewer dash:LiteralViewer ; - sh:order 44 ; - ] , [ - sh:path fdp:metadataModified ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:viewer dash:LiteralViewer ; - sh:order 45 ; - ] . - ', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#DataService', 'https://w3id.org/fdp/fdp-o#MetadataService', 'https://w3id.org/fdp/fdp-o#FAIRDataPoint'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('afebd441-8aa5-464d-bc3c-033f175449b4', '4e64208d-f102-45a0-96e3-17b002e6213e', '6f7a5a76-6185-4bd0-9fe9-62ecc90c9bad', 0); - --- Catalog -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('c9640671-945d-4114-88fb-e81314cb7ab2', - '2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660', - NULL, - '1.0.0', - 'Catalog', - '', - '@prefix : . -@prefix dash: . -@prefix dcat: . -@prefix dct: . -@prefix foaf: . -@prefix sh: . -@prefix xsd: . - -:CatalogShape a sh:NodeShape ; - sh:targetClass dcat:Catalog ; - sh:property [ - sh:path dct:issued ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:viewer dash:LiteralViewer ; - sh:order 20 ; - ], [ - sh:path dct:modified ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:viewer dash:LiteralViewer ; - sh:order 21 ; - ], [ - sh:path foaf:homePage ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 22 ; - ], [ - sh:path dcat:themeTaxonomy ; - sh:nodeKind sh:IRI ; - dash:viewer dash:LabelViewer ; - sh:order 23 ; - ] . -', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#Catalog'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('e75cb601-318d-41ea-9a8b-32e0749c80a7', 'c9640671-945d-4114-88fb-e81314cb7ab2', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); - --- Dataset -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('866d7fb8-5982-4215-9c7c-18d0ed1bd5f3', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('9cc3c89a-76cf-4639-a71f-652627af51db', - '866d7fb8-5982-4215-9c7c-18d0ed1bd5f3', - NULL, - '1.0.0', - 'Dataset', - '', - '@prefix : . -@prefix dash: . -@prefix dcat: . -@prefix dct: . -@prefix sh: . -@prefix xsd: . - -:DatasetShape a sh:NodeShape ; - sh:targetClass dcat:Dataset ; - sh:property [ - sh:path dct:issued ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 20 ; - ], [ - sh:path dct:modified ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 21 ; - ], [ - sh:path dcat:theme ; - sh:nodeKind sh:IRI ; - sh:minCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 22 ; - ], [ - sh:path dcat:contactPoint ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 23 ; - ], [ - sh:path dcat:keyword ; - sh:nodeKind sh:Literal ; - dash:editor dash:TextFieldEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 24 ; - ], [ - sh:path dcat:landingPage ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 25 ; - ] . -', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#Dataset'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('da13ba37-09f8-4937-9055-e3ee3aefc57c', '9cc3c89a-76cf-4639-a71f-652627af51db', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); - --- Distribution -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('ebacbf83-cd4f-4113-8738-d73c0735b0ab', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('3cda8cd3-b08b-4797-822d-d3f3e83c466a', - 'ebacbf83-cd4f-4113-8738-d73c0735b0ab', - NULL, - '1.0.0', - 'Distribution', - '', - '@prefix : . -@prefix dash: . -@prefix dcat: . -@prefix dct: . -@prefix sh: . -@prefix xsd: . - -:DistributionShape a sh:NodeShape ; - sh:targetClass dcat:Distribution ; - sh:property [ - sh:path dct:issued ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 20 ; - ] , [ - sh:path dct:modified ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 21 ; - ] , [ - sh:path dcat:accessURL ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - sh:order 22 ; - ] , [ - sh:path dcat:downloadURL ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - sh:order 23 ; - ] , [ - sh:path dcat:mediaType ; - sh:nodeKind sh:Literal ; - sh:minCount 1 ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 24 ; - ] , [ - sh:path dcat:format ; - sh:nodeKind sh:Literal ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 25 ; - ] , [ - sh:path dcat:byteSize ; - sh:nodeKind sh:Literal ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 26 ; - ] . -', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#Distribution'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('a3b16a4e-cac7-4b71-a3de-94bb86714b5b', '3cda8cd3-b08b-4797-822d-d3f3e83c466a', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); diff --git a/src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql b/src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql deleted file mode 100644 index ed4f047ff..000000000 --- a/src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql +++ /dev/null @@ -1,68 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - --- Distribution -INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) -VALUES ('02c649de-c579-43bb-b470-306abdc808c7', 'Distribution', 'distribution', now(), now()); - -INSERT INTO resource_definition_link (uuid, resource_definition_id, title, property_uri, order_priority, created_at, updated_at) -VALUES ('660a1821-a5d2-48d0-a26b-0c6d5bac3de4', '02c649de-c579-43bb-b470-306abdc808c7', 'Access online', 'http://www.w3.org/ns/dcat#accessURL', 1, now(), now()); - -INSERT INTO resource_definition_link (uuid, resource_definition_id, title, property_uri, order_priority, created_at, updated_at) -VALUES ('c2eaebb8-4d8d-469d-8736-269adeded996', '02c649de-c579-43bb-b470-306abdc808c7', 'Download', 'http://www.w3.org/ns/dcat#downloadURL', 2, now(), now()); - -INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) -VALUES ('bbf4ecb3-c529-4c02-955c-7160755debf5', '02c649de-c579-43bb-b470-306abdc808c7', 'ebacbf83-cd4f-4113-8738-d73c0735b0ab', 1); - --- Dataset -INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) -VALUES ('2f08228e-1789-40f8-84cd-28e3288c3604', 'Dataset', 'dataset', now(), now()); - -INSERT INTO resource_definition_child (uuid, source_resource_definition_id, target_resource_definition_id, relation_uri, title, tags_uri, order_priority, created_at, updated_at) -VALUES ('9f138a13-9d45-4371-b763-0a3b9e0ec912', '2f08228e-1789-40f8-84cd-28e3288c3604', '02c649de-c579-43bb-b470-306abdc808c7', 'http://www.w3.org/ns/dcat#distribution', 'Distributions', NULL, 1, now(), now()); - -INSERT INTO resource_definition_child_metadata (uuid, resource_definition_child_id, title, property_uri, order_priority, created_at, updated_at) -VALUES ('723e95d3-1696-45e2-9429-f6e98e3fb893', '9f138a13-9d45-4371-b763-0a3b9e0ec912', 'Media Type', 'http://www.w3.org/ns/dcat#mediaType', 1, now(), now()); - -INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) -VALUES ('b8a0ed37-42a1-487e-8842-09fe082c4cc6', '2f08228e-1789-40f8-84cd-28e3288c3604', '866d7fb8-5982-4215-9c7c-18d0ed1bd5f3', 1); - --- Catalog -INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) -VALUES ('a0949e72-4466-4d53-8900-9436d1049a4b', 'Catalog', 'catalog', now(), now()); - -INSERT INTO resource_definition_child (uuid, source_resource_definition_id, target_resource_definition_id, relation_uri, title, tags_uri, order_priority, created_at, updated_at) -VALUES ('e9f0f5d3-2a93-4aa3-9dd0-acb1d76f54fc', 'a0949e72-4466-4d53-8900-9436d1049a4b', '2f08228e-1789-40f8-84cd-28e3288c3604', 'http://www.w3.org/ns/dcat#dataset', 'Datasets', 'http://www.w3.org/ns/dcat#theme', 1, now(), now()); - -INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) -VALUES ('e4df9510-a3ad-4e3b-a1a9-5fc330d8b1f0', 'a0949e72-4466-4d53-8900-9436d1049a4b', '2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660', 1); - --- FAIR Data Point -INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) -VALUES ('77aaad6a-0136-4c6e-88b9-07ffccd0ee4c', 'FAIR Data Point', '', now(), now()); - -INSERT INTO resource_definition_child (uuid, source_resource_definition_id, target_resource_definition_id, relation_uri, title, tags_uri, order_priority, created_at, updated_at) -VALUES ('b8648597-8fbd-4b89-9e30-5eab82675e42', '77aaad6a-0136-4c6e-88b9-07ffccd0ee4c', 'a0949e72-4466-4d53-8900-9436d1049a4b', 'https://w3id.org/fdp/fdp-o#metadataCatalog', 'Catalogs', 'http://www.w3.org/ns/dcat#themeTaxonomy', 1, now(), now()); - -INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) -VALUES ('9b3a32a8-a14c-4eb0-ba02-3aa8e13a8f11', '77aaad6a-0136-4c6e-88b9-07ffccd0ee4c', 'a92958ab-a414-47e6-8e17-68ba96ba3a2b', 1); diff --git a/src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql b/src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql deleted file mode 100644 index 8240e0bfe..000000000 --- a/src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql +++ /dev/null @@ -1,43 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - -INSERT INTO membership (uuid, name, allowed_entities, created_at, updated_at) -VALUES ('49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 'Owner', ARRAY ['a0949e72-4466-4d53-8900-9436d1049a4b', '2f08228e-1789-40f8-84cd-28e3288c3604', '02c649de-c579-43bb-b470-306abdc808c7'], NOW(), NOW()); - -INSERT INTO membership (uuid, name, allowed_entities, created_at, updated_at) -VALUES ('87a2d984-7db2-43f6-805c-6b0040afead5', 'Data Provider', ARRAY ['a0949e72-4466-4d53-8900-9436d1049a4b'], NOW(), NOW()); - -INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) -VALUES ('e0d9f853-637b-4c50-9ad9-07b6349bf76f', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 2, 'W', NOW(), NOW()); - -INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) -VALUES ('de4e4f85-f11d-475b-b6f0-33bdfe5f923a', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 4, 'C', NOW(), NOW()); - -INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) -VALUES ('60bebbf0-210d-4b05-af85-ca1b58546261', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 8, 'D', NOW(), NOW()); - -INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) -VALUES ('36c3b6e9-f2e3-48b7-bae1-4dc3196a3657', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 16, 'A', NOW(), NOW()); - -INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) -VALUES ('589d09d3-1c29-4c6f-97fc-6ea4e007fb85', '87a2d984-7db2-43f6-805c-6b0040afead5', 4, 'C', NOW(), NOW()); diff --git a/src/test/resources/test/db/migration/V0001.5__dev-settings.sql b/src/test/resources/test/db/migration/V0001.5__dev-settings.sql deleted file mode 100644 index 75496e02a..000000000 --- a/src/test/resources/test/db/migration/V0001.5__dev-settings.sql +++ /dev/null @@ -1,73 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - --- Settings -INSERT INTO settings (uuid, app_title, app_subtitle, ping_enabled, ping_endpoints, autocomplete_search_ns, created_at, updated_at) -VALUES ('00000000-0000-0000-0000-000000000000', 'FAIR Data Point', 'FDP Development Instance', False, ARRAY ['https://home.fairdatapoint.org'], True, now(), now()); - --- Autocomplete Sources -INSERT INTO settings_autocomplete_source (uuid, settings_id, rdf_type, sparql_endpoint, sparql_query, order_priority, created_at, updated_at) -VALUES ('d4045a98-dd25-493e-a0b1-d704921c0930', '00000000-0000-0000-0000-000000000000', 'http://www.w3.org/2000/01/rdf-schema#Class', 'http://localhost:3030/ds/query', -'SELECT DISTINCT ?uri ?label -WHERE { ?uri a . -?uri ?label . -FILTER regex(?label, ".*%s.*", "i") } -ORDER BY ?label', - 1, now(), now()); - --- Search Filters: Type -INSERT INTO settings_search_filter (uuid, settings_id, type, label, predicate, query_records, order_priority, created_at, updated_at) -VALUES ('57a98728-ce8c-4e7f-b0f8-94e2668b44d3', '00000000-0000-0000-0000-000000000000', 'IRI', 'Type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', False, 1, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('b48c2c7f-d7fb-47ae-a72c-b1b360e16f6e', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Catalog', 'http://www.w3.org/ns/dcat#Catalog', 1, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('3e1598ac-9d29-47f0-8e7b-3c26ca0134a0', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Dataset', 'http://www.w3.org/ns/dcat#Dataset', 2, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('5697d8d9-f09d-4ebe-b834-b37eb0624c3f', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Distribution', 'http://www.w3.org/ns/dcat#Distribution', 3, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('022c3bc6-0598-408c-8d2e-b486dafb73dd', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Data Service', 'http://www.w3.org/ns/dcat#DataService', 4, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('7cee5591-8620-4fea-b883-a94285012b8d', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Metadata Service', 'https://w3id.org/fdp/fdp-o#MetadataService', 5, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('9d661dca-8017-4dba-b930-cd2834ea59e8', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'FAIR Data Point', 'https://w3id.org/fdp/fdp-o#FAIRDataPoint', 6, now(), now()); - --- Search Filters: License -INSERT INTO settings_search_filter (uuid, settings_id, type, label, predicate, query_records, order_priority, created_at, updated_at) -VALUES ('26913eb3-67dd-45c9-b8ff-4c97e8162a9b', '00000000-0000-0000-0000-000000000000', 'IRI', 'License', 'http://purl.org/dc/terms/license', True, 2, now(), now()); - --- Search Filters: License -INSERT INTO settings_search_filter (uuid, settings_id, type, label, predicate, query_records, order_priority, created_at, updated_at) -VALUES ('cb25afb4-6169-42f8-bde5-181c803773a8', '00000000-0000-0000-0000-000000000000', 'IRI', 'Version', 'http://www.w3.org/ns/dcat#version', True, 3, now(), now()); - --- Metrics -INSERT INTO settings_metric (uuid, settings_id, metric_uri, resource_uri, order_priority, created_at, updated_at) -VALUES ('8435491b-c16c-4457-ae94-e0f4128603d5', '00000000-0000-0000-0000-000000000000', 'https://purl.org/fair-metrics/FM_F1A', 'https://www.ietf.org/rfc/rfc3986.txt', 1, now(), now()); - -INSERT INTO settings_metric (uuid, settings_id, metric_uri, resource_uri, order_priority, created_at, updated_at) -VALUES ('af93d36a-0af0-4054-8c00-2675d460b231', '00000000-0000-0000-0000-000000000000', 'https://purl.org/fair-metrics/FM_A1.1', 'https://www.wikidata.org/wiki/Q8777', 2, now(), now()); diff --git a/src/test/resources/test/db/migration/V0001.6__test-schemas.sql b/src/test/resources/test/db/migration/V0001.6__test-schemas.sql deleted file mode 100644 index b340329e8..000000000 --- a/src/test/resources/test/db/migration/V0001.6__test-schemas.sql +++ /dev/null @@ -1,161 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - --- Custom with one version -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('e8b34158-3858-45c7-8e3e-d1e671dd9929', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('53619e58-2bb0-4baf-afd8-00c5d01ff8a8', 'e8b34158-3858-45c7-8e3e-d1e671dd9929', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', TRUE, FALSE, NULL, - NULL, NOW(), NOW()); - --- Custom with one draft -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('bfa79edf-00b7-4a04-b5a6-a5144f1a77b7', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('cb9f6cd7-97af-45d0-b23d-d0aab23607d8', 'bfa79edf-00b7-4a04-b5a6-a5144f1a77b7', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - - --- Custom with one version INTERNAL -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('fe98adbb-6a2c-4c7a-b2b2-a72db5140c61', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('f0a4b358-69a3-44e6-9436-c68a56a9f2f2', 'fe98adbb-6a2c-4c7a-b2b2-a72db5140c61', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'INTERNAL', NULL, NULL, 'LATEST', TRUE, FALSE, NULL, - NULL, NOW(), NOW()); - --- Custom with multiple versions -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('978e5c1c-268d-4822-b60b-07d3eccc6896', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('d7acec53-5ac9-4502-9bfa-92d1e9f79a24', '978e5c1c-268d-4822-b60b-07d3eccc6896', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('67896adc-b431-431d-8296-f0b80d8de412', '978e5c1c-268d-4822-b60b-07d3eccc6896', 'd7acec53-5ac9-4502-9bfa-92d1e9f79a24', '0.2.0', 'Custom schema', - 'Custom schema V2', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('c62d4a97-baac-40b8-b6ea-e43b06ec78bd', '978e5c1c-268d-4822-b60b-07d3eccc6896', '67896adc-b431-431d-8296-f0b80d8de412', '0.3.0', 'Custom schema', - 'Custom schema V3', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - --- Custom with draft -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('e7078309-cb4c-47b9-9ef8-057487b3da58', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('a17c25ad-e8d3-4338-bb3e-eda76d2fc32c', 'e7078309-cb4c-47b9-9ef8-057487b3da58', NULL, '0.0.0', 'Custom schema', - 'Custom schema draft', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - --- Custom with multiple versions and draft -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('fb24f92b-187f-4d53-b744-73024b537f30', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('6011adfa-f8da-478d-86ea-84bb644b458b', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', 'fb24f92b-187f-4d53-b744-73024b537f30', '0.2.0', 'Custom schema', - 'Custom schema V2', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('6b84ec86-2096-48db-bfc7-23506b8c080c', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', '6011adfa-f8da-478d-86ea-84bb644b458b', '0.0.0', 'Custom schema', - 'Custom schema draft', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - --- Custom with multiple versions and draft and extends -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('7c8b8699-ca9f-4d14-86e2-2299b27c5711', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('4e44fb19-b9e0-46e9-957a-e7aa3adac7bf', '7c8b8699-ca9f-4d14-86e2-2299b27c5711', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '7c8b8699-ca9f-4d14-86e2-2299b27c5711', '4e44fb19-b9e0-46e9-957a-e7aa3adac7bf', '0.2.0', 'Custom schema', - 'Custom schema V2', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('1bdca611-c96e-4304-b1f3-030d282ef529', 'abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('1bdca611-c96e-4304-b1f3-030d282ef530', 'abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', 1); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('a6d609ff-905f-4edd-bdb1-2dce000c9a45', '7c8b8699-ca9f-4d14-86e2-2299b27c5711', 'abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '0.0.0', 'Custom schema', - 'Custom schema draft', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('53e3db46-8fe4-47ce-873e-ed7db94e73b3', 'a6d609ff-905f-4edd-bdb1-2dce000c9a45', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); From 6ab040ddbafc5d60b89e1edd7b69b7442c0302ff Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Thu, 13 Nov 2025 09:33:04 +0100 Subject: [PATCH 02/28] remove reference to test data migrations from test config --- src/test/resources/application-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/application-testing.yml b/src/test/resources/application-testing.yml index 5e9440e60..f6453d199 100644 --- a/src/test/resources/application-testing.yml +++ b/src/test/resources/application-testing.yml @@ -17,7 +17,7 @@ spring: username: ${FDP_POSTGRES_USERNAME:fdp} password: ${FDP_POSTGRES_PASSWORD:fdp} flyway: - locations: classpath:test/db/migration,classpath:db/migration + locations: classpath:db/migration fail-on-missing-locations: true clean-disabled: false From ac0e0ae2c5c898e8aa727318f4f7602f01b86dcb Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Thu, 13 Nov 2025 09:42:58 +0100 Subject: [PATCH 03/28] explicitly enable bootstrap in test config --- src/test/resources/application-testing.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/resources/application-testing.yml b/src/test/resources/application-testing.yml index f6453d199..ab955a459 100644 --- a/src/test/resources/application-testing.yml +++ b/src/test/resources/application-testing.yml @@ -23,3 +23,6 @@ spring: ping: enabled: false + +bootstrap: + enabled: true From d5915b1b37d179aaf6b26ec82700b0c061a6875d Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Thu, 13 Nov 2025 10:24:03 +0100 Subject: [PATCH 04/28] add test-fixtures location to bootstrap config --- src/test/resources/application-testing.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/resources/application-testing.yml b/src/test/resources/application-testing.yml index ab955a459..0e0cc011d 100644 --- a/src/test/resources/application-testing.yml +++ b/src/test/resources/application-testing.yml @@ -26,3 +26,6 @@ ping: bootstrap: enabled: true + db-fixtures-dirs: + - fixtures + - test-fixtures From a86092a78e645676ff90afc47bd03af437146465 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Fri, 14 Nov 2025 16:06:10 +0100 Subject: [PATCH 05/28] rename 'db-fixtures-dirs' property to 'locations' this is more consistent with e.g. the 'locations' option for flyway --- src/main/java/org/fairdatapoint/config/BootstrapConfig.java | 6 +++--- .../config/properties/BootstrapProperties.java | 4 ++-- src/main/resources/application.yml | 2 +- src/test/resources/application-testing.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java index cd1beeb01..0afd4eb61 100644 --- a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java +++ b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java @@ -75,9 +75,9 @@ public Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() { log.info("Bootstrap repository populator enabled"); try { // collect fixture resources - log.info("Looking for db fixtures in the following directories: {}", - String.join(", ", this.bootstrap.getDbFixturesDirs())); - for (String fixturesDir : this.bootstrap.getDbFixturesDirs()) { + log.info("Looking for db fixtures in the following locations: {}", + String.join(", ", this.bootstrap.getLocations())); + for (String fixturesDir : this.bootstrap.getLocations()) { // Path.of() removes trailing slashes, so it is safe to concatenate "/*.json". // Note that Path.of(fixturesDir).resolve("*.json") could work on unix but fails on windows. final String locationPattern = "file:" + Path.of(fixturesDir) + "/*.json"; diff --git a/src/main/java/org/fairdatapoint/config/properties/BootstrapProperties.java b/src/main/java/org/fairdatapoint/config/properties/BootstrapProperties.java index a7dd4810a..c6e383b58 100644 --- a/src/main/java/org/fairdatapoint/config/properties/BootstrapProperties.java +++ b/src/main/java/org/fairdatapoint/config/properties/BootstrapProperties.java @@ -38,6 +38,6 @@ public class BootstrapProperties { // boolean defaults to false private boolean enabled; - // directories relative to project root - private List dbFixturesDirs; + // locations to search for fixtures + private List locations; } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index c58e969cf..f91578bb6 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -114,5 +114,5 @@ server: bootstrap: enabled: true - db-fixtures-dirs: + locations: - "fixtures" diff --git a/src/test/resources/application-testing.yml b/src/test/resources/application-testing.yml index 0e0cc011d..5e5713c23 100644 --- a/src/test/resources/application-testing.yml +++ b/src/test/resources/application-testing.yml @@ -26,6 +26,6 @@ ping: bootstrap: enabled: true - db-fixtures-dirs: + locations: - fixtures - test-fixtures From f5abb80e7231bd2a435802cf64c3063f38cc1ea9 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Fri, 14 Nov 2025 16:09:16 +0100 Subject: [PATCH 06/28] rename fixturesDir loop variable to location --- src/main/java/org/fairdatapoint/config/BootstrapConfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java index 0afd4eb61..f5955aa08 100644 --- a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java +++ b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java @@ -77,10 +77,10 @@ public Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() { // collect fixture resources log.info("Looking for db fixtures in the following locations: {}", String.join(", ", this.bootstrap.getLocations())); - for (String fixturesDir : this.bootstrap.getLocations()) { + for (String location : this.bootstrap.getLocations()) { // Path.of() removes trailing slashes, so it is safe to concatenate "/*.json". - // Note that Path.of(fixturesDir).resolve("*.json") could work on unix but fails on windows. - final String locationPattern = "file:" + Path.of(fixturesDir) + "/*.json"; + // Note that Path.of(location).resolve("*.json") could work on unix but fails on windows. + final String locationPattern = "file:" + Path.of(location) + "/*.json"; resources.addAll(List.of(resourceResolver.getResources(locationPattern))); } // remove resources that have been applied already From 4618d917d44df8d110358e937e6f53f1a1d5f9b4 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Fri, 14 Nov 2025 16:14:26 +0100 Subject: [PATCH 07/28] remove 'file:' prefix from fixture location pattern This allows us to include the prefix in the config, which is more flexible. For example, we can set file:fixtures for the default fixtures, which need to be overridable in the docker container, and we can set classpath:test-fixtures for the test fixtures, which can then be included in the test/resources dir. Moreover, this approach is similar to the way flyway.locations are specified. --- src/main/java/org/fairdatapoint/config/BootstrapConfig.java | 3 +-- .../fairdatapoint/config/properties/BootstrapProperties.java | 3 ++- src/main/resources/application.yml | 2 +- src/test/resources/application-testing.yml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java index f5955aa08..f86a25d43 100644 --- a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java +++ b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java @@ -80,8 +80,7 @@ public Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() { for (String location : this.bootstrap.getLocations()) { // Path.of() removes trailing slashes, so it is safe to concatenate "/*.json". // Note that Path.of(location).resolve("*.json") could work on unix but fails on windows. - final String locationPattern = "file:" + Path.of(location) + "/*.json"; - resources.addAll(List.of(resourceResolver.getResources(locationPattern))); + resources.addAll(List.of(resourceResolver.getResources(Path.of(location) + "/*.json"))); } // remove resources that have been applied already final List appliedFixtures = fixtureHistoryRepository.findAll().stream() diff --git a/src/main/java/org/fairdatapoint/config/properties/BootstrapProperties.java b/src/main/java/org/fairdatapoint/config/properties/BootstrapProperties.java index c6e383b58..ded768b2d 100644 --- a/src/main/java/org/fairdatapoint/config/properties/BootstrapProperties.java +++ b/src/main/java/org/fairdatapoint/config/properties/BootstrapProperties.java @@ -38,6 +38,7 @@ public class BootstrapProperties { // boolean defaults to false private boolean enabled; - // locations to search for fixtures + // locations to search for fixtures, for example, file:fixtures, relative to project root, + // or classpath:fixtures (see PathMatchingResourcePatternResolver docs for valid patterns) private List locations; } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index f91578bb6..ed84c0b13 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -115,4 +115,4 @@ server: bootstrap: enabled: true locations: - - "fixtures" + - file:fixtures diff --git a/src/test/resources/application-testing.yml b/src/test/resources/application-testing.yml index 5e5713c23..24e2b209a 100644 --- a/src/test/resources/application-testing.yml +++ b/src/test/resources/application-testing.yml @@ -27,5 +27,5 @@ ping: bootstrap: enabled: true locations: - - fixtures - - test-fixtures + - file:fixtures + - classpath:test-fixtures From e647d94d180fae19b292cf22f502ee9ec792a65e Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Fri, 14 Nov 2025 16:27:50 +0100 Subject: [PATCH 08/28] clarify RepositoriesPopulatedEvent log message the populator is done, but that does not necessarily mean any repositories were actually populated --- src/main/java/org/fairdatapoint/config/BootstrapConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java index f86a25d43..d3e2d8c95 100644 --- a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java +++ b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java @@ -110,7 +110,7 @@ public Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() { public class RepositoriesPopulatedEventListener implements ApplicationListener { @Override public void onApplicationEvent(@NotNull RepositoriesPopulatedEvent event) { - log.info("Repositories populated"); + log.info("Repository populator finished."); // Create fixture history records for all resources that have been applied. // Note: This assumes that all items in the resources list have been *successfully* applied. However, I'm // not sure if this can be guaranteed. If it does turn out to be a problem, we could try e.g. extending the From 049eeb20f8d0e86c727d1b27ac074013404152d8 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Fri, 14 Nov 2025 17:01:46 +0100 Subject: [PATCH 09/28] Revert "remove data migrations from src/test/resources/test/db" This reverts commit 1ac2639ae2dad18f3a277bee7da0135b25543eab. --- .../db/migration/V0001.1__dev-data-users.sql | 61 +++ .../migration/V0001.2__dev-data-schemas.sql | 505 ++++++++++++++++++ .../db/migration/V0001.3__dev-data-rds.sql | 68 +++ .../V0001.4__dev-data-membership.sql | 43 ++ .../db/migration/V0001.5__dev-settings.sql | 73 +++ .../db/migration/V0001.6__test-schemas.sql | 161 ++++++ 6 files changed, 911 insertions(+) create mode 100644 src/test/resources/test/db/migration/V0001.1__dev-data-users.sql create mode 100644 src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql create mode 100644 src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql create mode 100644 src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql create mode 100644 src/test/resources/test/db/migration/V0001.5__dev-settings.sql create mode 100644 src/test/resources/test/db/migration/V0001.6__test-schemas.sql diff --git a/src/test/resources/test/db/migration/V0001.1__dev-data-users.sql b/src/test/resources/test/db/migration/V0001.1__dev-data-users.sql new file mode 100644 index 000000000..cd8e0a967 --- /dev/null +++ b/src/test/resources/test/db/migration/V0001.1__dev-data-users.sql @@ -0,0 +1,61 @@ +-- +-- The MIT License +-- Copyright © 2016-2024 FAIR Data Team +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and associated documentation files (the "Software"), to deal +-- in the Software without restriction, including without limitation the rights +-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-- copies of the Software, and to permit persons to whom the Software is +-- furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +-- THE SOFTWARE. +-- + +-- User Accounts +INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) +VALUES ('95589e50-d261-492b-8852-9324e9a66a42', 'Admin', 'von Universe', 'admin@example.com', '$2a$10$L.0OZ8QjV3yLhoCDvU04gu.WP1wGQih41MsBdvtQOshJJntaugBxe', 'ADMIN', NOW(), NOW()); + +INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) +VALUES ('7e64818d-6276-46fb-8bb1-732e6e09f7e9', 'Albert', 'Einstein', 'albert.einstein@example.com', '$2a$10$hZF1abbZ48Tf.3RndC9W6OlDt6gnBoD/2HbzJayTs6be7d.5DbpnW', 'USER', NOW(), NOW()); + +INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) +VALUES ('b5b92c69-5ed9-4054-954d-0121c29b6800', 'Nikola', 'Tesla', 'nikola.tesla@example.com', '$2a$10$tMbZUZg9AbYL514R.hZ0tuzvfZJR5NQhSVeJPTQhNwPf6gv/cvrna', 'USER', NOW(), NOW()); + +INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) +VALUES ('8d1a4c06-bb0e-4d03-a01f-14fa49bbc152', 'Isaac', 'Newton', 'isaac.newton@example.com', '$2a$10$DLkI7NAZDzWVaKG1lVtloeoPNLPoAgDDBqQKQiSAYDZXrf2QKkuHC', 'USER', NOW(), NOW()); + +-- API Keys +INSERT INTO public.api_key (uuid, token, user_account_id, created_at, updated_at) +VALUES ('a1c00673-24c5-4e0a-bdbe-22e961ee7548', 'a274793046e34a219fd0ea6362fcca61a001500b71724f4c973a017031653c20', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', NOW(), NOW()); + +INSERT INTO public.api_key (uuid, token, user_account_id, created_at, updated_at) +VALUES ('62657760-21fe-488c-a0ea-f612a70493da', 'dd5dc3b53b6145cfa9f6c58b72ebad21cd2f860ace62451ba4e3c74a0e63540a', 'b5b92c69-5ed9-4054-954d-0121c29b6800', NOW(), NOW()); + +-- Saved Search Queries +INSERT INTO public.search_saved_query (uuid, name, description, type, var_prefixes, var_graph_pattern, var_ordering, user_account_id, created_at, updated_at) +VALUES ('d31e3da1-2cfa-4b55-a8cb-71d1acf01aef', 'All datasets', 'Quickly query all datasets (DCAT)', 'PUBLIC', + 'PREFIX dcat: ', '?entity rdf:type dcat:Dataset .', 'ASC(?title)', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', + NOW(), NOW()); + +INSERT INTO public.search_saved_query (uuid, name, description, type, var_prefixes, var_graph_pattern, var_ordering, user_account_id, created_at, updated_at) +VALUES ('c7d0b6a0-5b0a-4b0e-9b0a-9b0a9b0a9b0a', 'All distributions', 'Quickly query all distributions (DCAT)', 'INTERNAL', + 'PREFIX dcat: ', '?entity rdf:type dcat:Distribution .', 'ASC(?title)', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', + NOW(), NOW()); + +INSERT INTO public.search_saved_query (uuid, name, description, type, var_prefixes, var_graph_pattern, var_ordering, user_account_id, created_at, updated_at) +VALUES ('97da9119-834e-4687-8321-3df157547178', 'Things with data', 'This is private query of Nikola Tesla!', 'PRIVATE', + 'PREFIX dcat: ', +'?entity ?relationPredicate ?relationObject . +FILTER isLiteral(?relationObject) +FILTER CONTAINS(LCASE(str(?relationObject)), LCASE("data"))', + 'ASC(?title)', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', NOW(), NOW()); diff --git a/src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql b/src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql new file mode 100644 index 000000000..310c8377f --- /dev/null +++ b/src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql @@ -0,0 +1,505 @@ +-- +-- The MIT License +-- Copyright © 2016-2024 FAIR Data Team +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and associated documentation files (the "Software"), to deal +-- in the Software without restriction, including without limitation the rights +-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-- copies of the Software, and to permit persons to whom the Software is +-- furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +-- THE SOFTWARE. +-- + +-- Resource +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('6a668323-3936-4b53-8380-a4fd2ed082ee', NOW(), NOW()); +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('71d77460-f919-4f72-b265-ed26567fe361', + '6a668323-3936-4b53-8380-a4fd2ed082ee', + NULL, + '1.0.0', + 'Resource', + '', + '@prefix : . + @prefix dash: . + @prefix dcat: . + @prefix dct: . + @prefix foaf: . + @prefix sh: . + @prefix xsd: . + + :ResourceShape a sh:NodeShape ; + sh:targetClass dcat:Resource ; + sh:property [ + sh:path dct:title ; + sh:nodeKind sh:Literal ; + sh:minCount 1 ; + sh:maxCount 1 ; + dash:editor dash:TextFieldEditor ; + sh:order 1 ; + ], [ + sh:path dct:description ; + sh:nodeKind sh:Literal ; + sh:maxCount 1 ; + dash:editor dash:TextAreaEditor ; + sh:order 2 ; + ], [ + sh:path dct:publisher ; + sh:node :AgentShape ; + sh:minCount 1 ; + sh:maxCount 1 ; + dash:editor dash:BlankNodeEditor ; + sh:order 3 ; + ], [ + sh:path dcat:version ; + sh:name "version" ; + sh:nodeKind sh:Literal ; + sh:minCount 1 ; + sh:maxCount 1 ; + dash:editor dash:TextFieldEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 4 ; + ], [ + sh:path dct:language ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + dash:editor dash:URIEditor ; + dash:viewer dash:LabelViewer ; + sh:defaultValue ; + sh:order 5 ; + ], [ + sh:path dct:license ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + dash:editor dash:URIEditor ; + dash:viewer dash:LabelViewer ; + sh:defaultValue ; + sh:order 6 ; + ], [ + sh:path dct:rights ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + dash:editor dash:URIEditor ; + dash:viewer dash:LabelViewer ; + sh:order 7 ; + ] . + + :AgentShape a sh:NodeShape ; + sh:targetClass foaf:Agent ; + sh:property [ + sh:path foaf:name ; + sh:nodeKind sh:Literal ; + sh:minCount 1 ; + sh:maxCount 1 ; + dash:editor dash:TextFieldEditor ; + ] . + ', + ARRAY ['http://www.w3.org/ns/dcat#Resource'], + 'INTERNAL', + NULL, + NULL, + 'LATEST', + FALSE, + TRUE, + NULL, + NULL, + NOW(), + NOW()); + +-- Data Service +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('89d94c1b-f6ff-4545-ba9b-120b2d1921d0', NOW(), NOW()); +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('9111d436-fe58-4bd5-97ae-e6f86bc2997a', + '89d94c1b-f6ff-4545-ba9b-120b2d1921d0', + NULL, + '1.0.0', + 'Data Service', + '', + '@prefix : . +@prefix dash: . +@prefix dcat: . +@prefix dct: . +@prefix sh: . +@prefix xsd: . + +:DataServiceShape a sh:NodeShape ; + sh:targetClass dcat:DataService ; + sh:property [ + sh:path dcat:endpointURL ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + sh:order 20 ; + ] , [ + sh:path dcat:endpointDescription ; + sh:nodeKind sh:Literal ; + sh:maxCount 1 ; + dash:editor dash:TextAreaEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 21 ; +] . +', + ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#DataService'], + 'INTERNAL', + NULL, + NULL, + 'LATEST', + FALSE, + FALSE, + NULL, + NULL, + NOW(), + NOW()); +INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) +VALUES ('2efc8366-541d-493f-8661-69ad8f72dfa1', '9111d436-fe58-4bd5-97ae-e6f86bc2997a', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); + +-- Metadata Service +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('6f7a5a76-6185-4bd0-9fe9-62ecc90c9bad', NOW(), NOW()); +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('36b22b70-6203-4dd2-9fb6-b39a776bf467', + '6f7a5a76-6185-4bd0-9fe9-62ecc90c9bad', + NULL, + '1.0.0', + 'Metadata Service', + '', + '@prefix : . +@prefix fdp: . +@prefix sh: . + +:MetadataServiceShape a sh:NodeShape ; + sh:targetClass fdp:MetadataService . +', + ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#DataService', 'https://w3id.org/fdp/fdp-o#MetadataService'], + 'INTERNAL', + NULL, + NULL, + 'LATEST', + FALSE, + FALSE, + NULL, + NULL, + NOW(), + NOW()); +INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) +VALUES ('8742361b-cd00-4167-b859-e45fa36d0cb7', '36b22b70-6203-4dd2-9fb6-b39a776bf467', '89d94c1b-f6ff-4545-ba9b-120b2d1921d0', 0); + +-- FAIR Data Point +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('a92958ab-a414-47e6-8e17-68ba96ba3a2b', NOW(), NOW()); +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('4e64208d-f102-45a0-96e3-17b002e6213e', + 'a92958ab-a414-47e6-8e17-68ba96ba3a2b', + NULL, + '1.0.0', + 'FAIR Data Point', + '', + '@prefix : . +@prefix dash: . +@prefix dct: . +@prefix fdp: . +@prefix sh: . +@prefix xsd: . + +:FDPShape a sh:NodeShape ; + sh:targetClass fdp:FAIRDataPoint ; + sh:property [ + sh:path fdp:startDate ; + sh:datatype xsd:dateTime ; + sh:maxCount 1 ; + dash:editor dash:DatePickerEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 40 ; + ] , [ + sh:path fdp:endDate ; + sh:datatype xsd:dateTime ; + sh:maxCount 1 ; + dash:editor dash:DatePickerEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 41 ; + ] , [ + sh:path fdp:uiLanguage ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + sh:defaultValue ; + dash:editor dash:URIEditor ; + dash:viewer dash:LabelViewer ; + sh:order 42 ; + ] , [ + sh:path fdp:metadataIdentifier ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + dash:editor dash:URIEditor ; + dash:viewer dash:LabelViewer ; + sh:order 43 ; + ] , [ + sh:path fdp:metadataIssued ; + sh:datatype xsd:dateTime ; + sh:maxCount 1 ; + dash:viewer dash:LiteralViewer ; + sh:order 44 ; + ] , [ + sh:path fdp:metadataModified ; + sh:datatype xsd:dateTime ; + sh:maxCount 1 ; + dash:viewer dash:LiteralViewer ; + sh:order 45 ; + ] . + ', + ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#DataService', 'https://w3id.org/fdp/fdp-o#MetadataService', 'https://w3id.org/fdp/fdp-o#FAIRDataPoint'], + 'INTERNAL', + NULL, + NULL, + 'LATEST', + FALSE, + FALSE, + NULL, + NULL, + NOW(), + NOW()); +INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) +VALUES ('afebd441-8aa5-464d-bc3c-033f175449b4', '4e64208d-f102-45a0-96e3-17b002e6213e', '6f7a5a76-6185-4bd0-9fe9-62ecc90c9bad', 0); + +-- Catalog +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660', NOW(), NOW()); +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('c9640671-945d-4114-88fb-e81314cb7ab2', + '2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660', + NULL, + '1.0.0', + 'Catalog', + '', + '@prefix : . +@prefix dash: . +@prefix dcat: . +@prefix dct: . +@prefix foaf: . +@prefix sh: . +@prefix xsd: . + +:CatalogShape a sh:NodeShape ; + sh:targetClass dcat:Catalog ; + sh:property [ + sh:path dct:issued ; + sh:datatype xsd:dateTime ; + sh:maxCount 1 ; + dash:viewer dash:LiteralViewer ; + sh:order 20 ; + ], [ + sh:path dct:modified ; + sh:datatype xsd:dateTime ; + sh:maxCount 1 ; + dash:viewer dash:LiteralViewer ; + sh:order 21 ; + ], [ + sh:path foaf:homePage ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + dash:editor dash:URIEditor ; + dash:viewer dash:LabelViewer ; + sh:order 22 ; + ], [ + sh:path dcat:themeTaxonomy ; + sh:nodeKind sh:IRI ; + dash:viewer dash:LabelViewer ; + sh:order 23 ; + ] . +', + ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#Catalog'], + 'INTERNAL', + NULL, + NULL, + 'LATEST', + FALSE, + FALSE, + NULL, + NULL, + NOW(), + NOW()); +INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) +VALUES ('e75cb601-318d-41ea-9a8b-32e0749c80a7', 'c9640671-945d-4114-88fb-e81314cb7ab2', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); + +-- Dataset +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('866d7fb8-5982-4215-9c7c-18d0ed1bd5f3', NOW(), NOW()); +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('9cc3c89a-76cf-4639-a71f-652627af51db', + '866d7fb8-5982-4215-9c7c-18d0ed1bd5f3', + NULL, + '1.0.0', + 'Dataset', + '', + '@prefix : . +@prefix dash: . +@prefix dcat: . +@prefix dct: . +@prefix sh: . +@prefix xsd: . + +:DatasetShape a sh:NodeShape ; + sh:targetClass dcat:Dataset ; + sh:property [ + sh:path dct:issued ; + sh:datatype xsd:dateTime ; + sh:maxCount 1 ; + dash:editor dash:DatePickerEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 20 ; + ], [ + sh:path dct:modified ; + sh:datatype xsd:dateTime ; + sh:maxCount 1 ; + dash:editor dash:DatePickerEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 21 ; + ], [ + sh:path dcat:theme ; + sh:nodeKind sh:IRI ; + sh:minCount 1 ; + dash:editor dash:URIEditor ; + dash:viewer dash:LabelViewer ; + sh:order 22 ; + ], [ + sh:path dcat:contactPoint ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + dash:editor dash:URIEditor ; + dash:viewer dash:LabelViewer ; + sh:order 23 ; + ], [ + sh:path dcat:keyword ; + sh:nodeKind sh:Literal ; + dash:editor dash:TextFieldEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 24 ; + ], [ + sh:path dcat:landingPage ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + dash:editor dash:URIEditor ; + dash:viewer dash:LabelViewer ; + sh:order 25 ; + ] . +', + ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#Dataset'], + 'INTERNAL', + NULL, + NULL, + 'LATEST', + FALSE, + FALSE, + NULL, + NULL, + NOW(), + NOW()); +INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) +VALUES ('da13ba37-09f8-4937-9055-e3ee3aefc57c', '9cc3c89a-76cf-4639-a71f-652627af51db', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); + +-- Distribution +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('ebacbf83-cd4f-4113-8738-d73c0735b0ab', NOW(), NOW()); +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('3cda8cd3-b08b-4797-822d-d3f3e83c466a', + 'ebacbf83-cd4f-4113-8738-d73c0735b0ab', + NULL, + '1.0.0', + 'Distribution', + '', + '@prefix : . +@prefix dash: . +@prefix dcat: . +@prefix dct: . +@prefix sh: . +@prefix xsd: . + +:DistributionShape a sh:NodeShape ; + sh:targetClass dcat:Distribution ; + sh:property [ + sh:path dct:issued ; + sh:datatype xsd:dateTime ; + sh:maxCount 1 ; + dash:editor dash:DatePickerEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 20 ; + ] , [ + sh:path dct:modified ; + sh:datatype xsd:dateTime ; + sh:maxCount 1 ; + dash:editor dash:DatePickerEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 21 ; + ] , [ + sh:path dcat:accessURL ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + dash:editor dash:URIEditor ; + sh:order 22 ; + ] , [ + sh:path dcat:downloadURL ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + dash:editor dash:URIEditor ; + sh:order 23 ; + ] , [ + sh:path dcat:mediaType ; + sh:nodeKind sh:Literal ; + sh:minCount 1 ; + sh:maxCount 1 ; + dash:editor dash:TextFieldEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 24 ; + ] , [ + sh:path dcat:format ; + sh:nodeKind sh:Literal ; + sh:maxCount 1 ; + dash:editor dash:TextFieldEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 25 ; + ] , [ + sh:path dcat:byteSize ; + sh:nodeKind sh:Literal ; + sh:maxCount 1 ; + dash:editor dash:TextFieldEditor ; + dash:viewer dash:LiteralViewer ; + sh:order 26 ; + ] . +', + ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#Distribution'], + 'INTERNAL', + NULL, + NULL, + 'LATEST', + FALSE, + FALSE, + NULL, + NULL, + NOW(), + NOW()); +INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) +VALUES ('a3b16a4e-cac7-4b71-a3de-94bb86714b5b', '3cda8cd3-b08b-4797-822d-d3f3e83c466a', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); diff --git a/src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql b/src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql new file mode 100644 index 000000000..ed4f047ff --- /dev/null +++ b/src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql @@ -0,0 +1,68 @@ +-- +-- The MIT License +-- Copyright © 2016-2024 FAIR Data Team +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and associated documentation files (the "Software"), to deal +-- in the Software without restriction, including without limitation the rights +-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-- copies of the Software, and to permit persons to whom the Software is +-- furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +-- THE SOFTWARE. +-- + +-- Distribution +INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) +VALUES ('02c649de-c579-43bb-b470-306abdc808c7', 'Distribution', 'distribution', now(), now()); + +INSERT INTO resource_definition_link (uuid, resource_definition_id, title, property_uri, order_priority, created_at, updated_at) +VALUES ('660a1821-a5d2-48d0-a26b-0c6d5bac3de4', '02c649de-c579-43bb-b470-306abdc808c7', 'Access online', 'http://www.w3.org/ns/dcat#accessURL', 1, now(), now()); + +INSERT INTO resource_definition_link (uuid, resource_definition_id, title, property_uri, order_priority, created_at, updated_at) +VALUES ('c2eaebb8-4d8d-469d-8736-269adeded996', '02c649de-c579-43bb-b470-306abdc808c7', 'Download', 'http://www.w3.org/ns/dcat#downloadURL', 2, now(), now()); + +INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) +VALUES ('bbf4ecb3-c529-4c02-955c-7160755debf5', '02c649de-c579-43bb-b470-306abdc808c7', 'ebacbf83-cd4f-4113-8738-d73c0735b0ab', 1); + +-- Dataset +INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) +VALUES ('2f08228e-1789-40f8-84cd-28e3288c3604', 'Dataset', 'dataset', now(), now()); + +INSERT INTO resource_definition_child (uuid, source_resource_definition_id, target_resource_definition_id, relation_uri, title, tags_uri, order_priority, created_at, updated_at) +VALUES ('9f138a13-9d45-4371-b763-0a3b9e0ec912', '2f08228e-1789-40f8-84cd-28e3288c3604', '02c649de-c579-43bb-b470-306abdc808c7', 'http://www.w3.org/ns/dcat#distribution', 'Distributions', NULL, 1, now(), now()); + +INSERT INTO resource_definition_child_metadata (uuid, resource_definition_child_id, title, property_uri, order_priority, created_at, updated_at) +VALUES ('723e95d3-1696-45e2-9429-f6e98e3fb893', '9f138a13-9d45-4371-b763-0a3b9e0ec912', 'Media Type', 'http://www.w3.org/ns/dcat#mediaType', 1, now(), now()); + +INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) +VALUES ('b8a0ed37-42a1-487e-8842-09fe082c4cc6', '2f08228e-1789-40f8-84cd-28e3288c3604', '866d7fb8-5982-4215-9c7c-18d0ed1bd5f3', 1); + +-- Catalog +INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) +VALUES ('a0949e72-4466-4d53-8900-9436d1049a4b', 'Catalog', 'catalog', now(), now()); + +INSERT INTO resource_definition_child (uuid, source_resource_definition_id, target_resource_definition_id, relation_uri, title, tags_uri, order_priority, created_at, updated_at) +VALUES ('e9f0f5d3-2a93-4aa3-9dd0-acb1d76f54fc', 'a0949e72-4466-4d53-8900-9436d1049a4b', '2f08228e-1789-40f8-84cd-28e3288c3604', 'http://www.w3.org/ns/dcat#dataset', 'Datasets', 'http://www.w3.org/ns/dcat#theme', 1, now(), now()); + +INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) +VALUES ('e4df9510-a3ad-4e3b-a1a9-5fc330d8b1f0', 'a0949e72-4466-4d53-8900-9436d1049a4b', '2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660', 1); + +-- FAIR Data Point +INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) +VALUES ('77aaad6a-0136-4c6e-88b9-07ffccd0ee4c', 'FAIR Data Point', '', now(), now()); + +INSERT INTO resource_definition_child (uuid, source_resource_definition_id, target_resource_definition_id, relation_uri, title, tags_uri, order_priority, created_at, updated_at) +VALUES ('b8648597-8fbd-4b89-9e30-5eab82675e42', '77aaad6a-0136-4c6e-88b9-07ffccd0ee4c', 'a0949e72-4466-4d53-8900-9436d1049a4b', 'https://w3id.org/fdp/fdp-o#metadataCatalog', 'Catalogs', 'http://www.w3.org/ns/dcat#themeTaxonomy', 1, now(), now()); + +INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) +VALUES ('9b3a32a8-a14c-4eb0-ba02-3aa8e13a8f11', '77aaad6a-0136-4c6e-88b9-07ffccd0ee4c', 'a92958ab-a414-47e6-8e17-68ba96ba3a2b', 1); diff --git a/src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql b/src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql new file mode 100644 index 000000000..8240e0bfe --- /dev/null +++ b/src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql @@ -0,0 +1,43 @@ +-- +-- The MIT License +-- Copyright © 2016-2024 FAIR Data Team +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and associated documentation files (the "Software"), to deal +-- in the Software without restriction, including without limitation the rights +-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-- copies of the Software, and to permit persons to whom the Software is +-- furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +-- THE SOFTWARE. +-- + +INSERT INTO membership (uuid, name, allowed_entities, created_at, updated_at) +VALUES ('49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 'Owner', ARRAY ['a0949e72-4466-4d53-8900-9436d1049a4b', '2f08228e-1789-40f8-84cd-28e3288c3604', '02c649de-c579-43bb-b470-306abdc808c7'], NOW(), NOW()); + +INSERT INTO membership (uuid, name, allowed_entities, created_at, updated_at) +VALUES ('87a2d984-7db2-43f6-805c-6b0040afead5', 'Data Provider', ARRAY ['a0949e72-4466-4d53-8900-9436d1049a4b'], NOW(), NOW()); + +INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) +VALUES ('e0d9f853-637b-4c50-9ad9-07b6349bf76f', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 2, 'W', NOW(), NOW()); + +INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) +VALUES ('de4e4f85-f11d-475b-b6f0-33bdfe5f923a', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 4, 'C', NOW(), NOW()); + +INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) +VALUES ('60bebbf0-210d-4b05-af85-ca1b58546261', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 8, 'D', NOW(), NOW()); + +INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) +VALUES ('36c3b6e9-f2e3-48b7-bae1-4dc3196a3657', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 16, 'A', NOW(), NOW()); + +INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) +VALUES ('589d09d3-1c29-4c6f-97fc-6ea4e007fb85', '87a2d984-7db2-43f6-805c-6b0040afead5', 4, 'C', NOW(), NOW()); diff --git a/src/test/resources/test/db/migration/V0001.5__dev-settings.sql b/src/test/resources/test/db/migration/V0001.5__dev-settings.sql new file mode 100644 index 000000000..75496e02a --- /dev/null +++ b/src/test/resources/test/db/migration/V0001.5__dev-settings.sql @@ -0,0 +1,73 @@ +-- +-- The MIT License +-- Copyright © 2016-2024 FAIR Data Team +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and associated documentation files (the "Software"), to deal +-- in the Software without restriction, including without limitation the rights +-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-- copies of the Software, and to permit persons to whom the Software is +-- furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +-- THE SOFTWARE. +-- + +-- Settings +INSERT INTO settings (uuid, app_title, app_subtitle, ping_enabled, ping_endpoints, autocomplete_search_ns, created_at, updated_at) +VALUES ('00000000-0000-0000-0000-000000000000', 'FAIR Data Point', 'FDP Development Instance', False, ARRAY ['https://home.fairdatapoint.org'], True, now(), now()); + +-- Autocomplete Sources +INSERT INTO settings_autocomplete_source (uuid, settings_id, rdf_type, sparql_endpoint, sparql_query, order_priority, created_at, updated_at) +VALUES ('d4045a98-dd25-493e-a0b1-d704921c0930', '00000000-0000-0000-0000-000000000000', 'http://www.w3.org/2000/01/rdf-schema#Class', 'http://localhost:3030/ds/query', +'SELECT DISTINCT ?uri ?label +WHERE { ?uri a . +?uri ?label . +FILTER regex(?label, ".*%s.*", "i") } +ORDER BY ?label', + 1, now(), now()); + +-- Search Filters: Type +INSERT INTO settings_search_filter (uuid, settings_id, type, label, predicate, query_records, order_priority, created_at, updated_at) +VALUES ('57a98728-ce8c-4e7f-b0f8-94e2668b44d3', '00000000-0000-0000-0000-000000000000', 'IRI', 'Type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', False, 1, now(), now()); + +INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) +VALUES ('b48c2c7f-d7fb-47ae-a72c-b1b360e16f6e', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Catalog', 'http://www.w3.org/ns/dcat#Catalog', 1, now(), now()); + +INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) +VALUES ('3e1598ac-9d29-47f0-8e7b-3c26ca0134a0', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Dataset', 'http://www.w3.org/ns/dcat#Dataset', 2, now(), now()); + +INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) +VALUES ('5697d8d9-f09d-4ebe-b834-b37eb0624c3f', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Distribution', 'http://www.w3.org/ns/dcat#Distribution', 3, now(), now()); + +INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) +VALUES ('022c3bc6-0598-408c-8d2e-b486dafb73dd', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Data Service', 'http://www.w3.org/ns/dcat#DataService', 4, now(), now()); + +INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) +VALUES ('7cee5591-8620-4fea-b883-a94285012b8d', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Metadata Service', 'https://w3id.org/fdp/fdp-o#MetadataService', 5, now(), now()); + +INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) +VALUES ('9d661dca-8017-4dba-b930-cd2834ea59e8', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'FAIR Data Point', 'https://w3id.org/fdp/fdp-o#FAIRDataPoint', 6, now(), now()); + +-- Search Filters: License +INSERT INTO settings_search_filter (uuid, settings_id, type, label, predicate, query_records, order_priority, created_at, updated_at) +VALUES ('26913eb3-67dd-45c9-b8ff-4c97e8162a9b', '00000000-0000-0000-0000-000000000000', 'IRI', 'License', 'http://purl.org/dc/terms/license', True, 2, now(), now()); + +-- Search Filters: License +INSERT INTO settings_search_filter (uuid, settings_id, type, label, predicate, query_records, order_priority, created_at, updated_at) +VALUES ('cb25afb4-6169-42f8-bde5-181c803773a8', '00000000-0000-0000-0000-000000000000', 'IRI', 'Version', 'http://www.w3.org/ns/dcat#version', True, 3, now(), now()); + +-- Metrics +INSERT INTO settings_metric (uuid, settings_id, metric_uri, resource_uri, order_priority, created_at, updated_at) +VALUES ('8435491b-c16c-4457-ae94-e0f4128603d5', '00000000-0000-0000-0000-000000000000', 'https://purl.org/fair-metrics/FM_F1A', 'https://www.ietf.org/rfc/rfc3986.txt', 1, now(), now()); + +INSERT INTO settings_metric (uuid, settings_id, metric_uri, resource_uri, order_priority, created_at, updated_at) +VALUES ('af93d36a-0af0-4054-8c00-2675d460b231', '00000000-0000-0000-0000-000000000000', 'https://purl.org/fair-metrics/FM_A1.1', 'https://www.wikidata.org/wiki/Q8777', 2, now(), now()); diff --git a/src/test/resources/test/db/migration/V0001.6__test-schemas.sql b/src/test/resources/test/db/migration/V0001.6__test-schemas.sql new file mode 100644 index 000000000..b340329e8 --- /dev/null +++ b/src/test/resources/test/db/migration/V0001.6__test-schemas.sql @@ -0,0 +1,161 @@ +-- +-- The MIT License +-- Copyright © 2016-2024 FAIR Data Team +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and associated documentation files (the "Software"), to deal +-- in the Software without restriction, including without limitation the rights +-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-- copies of the Software, and to permit persons to whom the Software is +-- furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +-- THE SOFTWARE. +-- + +-- Custom with one version +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('e8b34158-3858-45c7-8e3e-d1e671dd9929', NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('53619e58-2bb0-4baf-afd8-00c5d01ff8a8', 'e8b34158-3858-45c7-8e3e-d1e671dd9929', NULL, '0.1.0', 'Custom schema', + 'Custom schema V1', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', TRUE, FALSE, NULL, + NULL, NOW(), NOW()); + +-- Custom with one draft +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('bfa79edf-00b7-4a04-b5a6-a5144f1a77b7', NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('cb9f6cd7-97af-45d0-b23d-d0aab23607d8', 'bfa79edf-00b7-4a04-b5a6-a5144f1a77b7', NULL, '0.1.0', 'Custom schema', + 'Custom schema V1', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, + NULL, NOW(), NOW()); + + +-- Custom with one version INTERNAL +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('fe98adbb-6a2c-4c7a-b2b2-a72db5140c61', NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('f0a4b358-69a3-44e6-9436-c68a56a9f2f2', 'fe98adbb-6a2c-4c7a-b2b2-a72db5140c61', NULL, '0.1.0', 'Custom schema', + 'Custom schema V1', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'INTERNAL', NULL, NULL, 'LATEST', TRUE, FALSE, NULL, + NULL, NOW(), NOW()); + +-- Custom with multiple versions +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('978e5c1c-268d-4822-b60b-07d3eccc6896', NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('d7acec53-5ac9-4502-9bfa-92d1e9f79a24', '978e5c1c-268d-4822-b60b-07d3eccc6896', NULL, '0.1.0', 'Custom schema', + 'Custom schema V1', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, + NULL, NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('67896adc-b431-431d-8296-f0b80d8de412', '978e5c1c-268d-4822-b60b-07d3eccc6896', 'd7acec53-5ac9-4502-9bfa-92d1e9f79a24', '0.2.0', 'Custom schema', + 'Custom schema V2', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, + NULL, NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('c62d4a97-baac-40b8-b6ea-e43b06ec78bd', '978e5c1c-268d-4822-b60b-07d3eccc6896', '67896adc-b431-431d-8296-f0b80d8de412', '0.3.0', 'Custom schema', + 'Custom schema V3', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', FALSE, FALSE, NULL, + NULL, NOW(), NOW()); + +-- Custom with draft +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('e7078309-cb4c-47b9-9ef8-057487b3da58', NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('a17c25ad-e8d3-4338-bb3e-eda76d2fc32c', 'e7078309-cb4c-47b9-9ef8-057487b3da58', NULL, '0.0.0', 'Custom schema', + 'Custom schema draft', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, + NULL, NOW(), NOW()); + +-- Custom with multiple versions and draft +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('fb24f92b-187f-4d53-b744-73024b537f30', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', NULL, '0.1.0', 'Custom schema', + 'Custom schema V1', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, + NULL, NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('6011adfa-f8da-478d-86ea-84bb644b458b', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', 'fb24f92b-187f-4d53-b744-73024b537f30', '0.2.0', 'Custom schema', + 'Custom schema V2', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', FALSE, FALSE, NULL, + NULL, NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('6b84ec86-2096-48db-bfc7-23506b8c080c', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', '6011adfa-f8da-478d-86ea-84bb644b458b', '0.0.0', 'Custom schema', + 'Custom schema draft', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, + NULL, NOW(), NOW()); + +-- Custom with multiple versions and draft and extends +INSERT INTO metadata_schema (uuid, created_at, updated_at) +VALUES ('7c8b8699-ca9f-4d14-86e2-2299b27c5711', NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('4e44fb19-b9e0-46e9-957a-e7aa3adac7bf', '7c8b8699-ca9f-4d14-86e2-2299b27c5711', NULL, '0.1.0', 'Custom schema', + 'Custom schema V1', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, + NULL, NOW(), NOW()); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '7c8b8699-ca9f-4d14-86e2-2299b27c5711', '4e44fb19-b9e0-46e9-957a-e7aa3adac7bf', '0.2.0', 'Custom schema', + 'Custom schema V2', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', FALSE, FALSE, NULL, + NULL, NOW(), NOW()); +INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) +VALUES ('1bdca611-c96e-4304-b1f3-030d282ef529', 'abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); +INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) +VALUES ('1bdca611-c96e-4304-b1f3-030d282ef530', 'abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', 1); + +INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, + definition, target_classes, type, origin, imported_from, state, published, + abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) +VALUES ('a6d609ff-905f-4edd-bdb1-2dce000c9a45', '7c8b8699-ca9f-4d14-86e2-2299b27c5711', 'abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '0.0.0', 'Custom schema', + 'Custom schema draft', + '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, + NULL, NOW(), NOW()); +INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) +VALUES ('53e3db46-8fe4-47ce-873e-ed7db94e73b3', 'a6d609ff-905f-4edd-bdb1-2dce000c9a45', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); From f3e49cbcb5412d4eab515348dcb59214870ea2a6 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Fri, 14 Nov 2025 17:23:13 +0100 Subject: [PATCH 10/28] replace V0001.1__dev-data-users.sql test data migration by json fixture file --- ...users-with-api-keys-and-saved-queries.json | 93 +++++++++++++++++++ .../db/migration/V0001.1__dev-data-users.sql | 61 ------------ 2 files changed, 93 insertions(+), 61 deletions(-) create mode 100644 src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json delete mode 100644 src/test/resources/test/db/migration/V0001.1__dev-data-users.sql diff --git a/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json new file mode 100644 index 000000000..eb1249f67 --- /dev/null +++ b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json @@ -0,0 +1,93 @@ +[ + { + "_class": "org.fairdatapoint.entity.user.UserAccount", + "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9", + "firstName": "Albert", + "lastName": "Einstein", + "email": "albert.einstein@example.org", + "passwordHash": "$2a$10$hZF1abbZ48Tf.3RndC9W6OlDt6gnBoD/2HbzJayTs6be7d.5DbpnW", + "role": "USER" + }, + { + "_class": "org.fairdatapoint.entity.user.UserAccount", + "uuid": "b5b92c69-5ed9-4054-954d-0121c29b6800", + "firstName": "Nikola", + "lastName": "Tesla", + "email": "nikola.tesla@example.org", + "passwordHash": "$2a$10$tMbZUZg9AbYL514R.hZ0tuzvfZJR5NQhSVeJPTQhNwPf6gv/cvrna", + "role": "USER" + }, + { + "_class": "org.fairdatapoint.entity.user.UserAccount", + "uuid": "8d1a4c06-bb0e-4d03-a01f-14fa49bbc152", + "firstName": "Isaac", + "lastName": "Newton", + "email": "isaac.newton@example.org", + "passwordHash": "$2a$10$DLkI7NAZDzWVaKG1lVtloeoPNLPoAgDDBqQKQiSAYDZXrf2QKkuHC", + "role": "USER" + }, + { + "_class": "org.fairdatapoint.entity.user.UserAccount", + "uuid": "95589e50-d261-492b-8852-9324e9a66a42", + "firstName": "Admin", + "lastName": "von Universe", + "email": "admin@example.org", + "passwordHash": "$2a$10$L.0OZ8QjV3yLhoCDvU04gu.WP1wGQih41MsBdvtQOshJJntaugBxe", + "role": "ADMIN" + }, + { + "_class": "org.fairdatapoint.entity.apikey.ApiKey", + "uuid": "a1c00673-24c5-4e0a-bdbe-22e961ee7548", + "token": "a274793046e34a219fd0ea6362fcca61a001500b71724f4c973a017031653c20", + "userAccount": { + "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9" + } + }, + { + "_class": "org.fairdatapoint.entity.apikey.ApiKey", + "uuid": "62657760-21fe-488c-a0ea-f612a70493da", + "token": "dd5dc3b53b6145cfa9f6c58b72ebad21cd2f860ace62451ba4e3c74a0e63540a", + "userAccount": { + "uuid": "b5b92c69-5ed9-4054-954d-0121c29b6800" + } + }, + { + "_class" : "org.fairdatapoint.entity.search.SearchSavedQuery", + "uuid": "d31e3da1-2cfa-4b55-a8cb-71d1acf01aef", + "name": "All datasets", + "description": "Quickly query all datasets (DCAT)", + "type": "PUBLIC", + "varPrefixes": "PREFIX dcat: ", + "varGraphPattern": "?entity rdf:type dcat:Dataset .", + "varOrdering": "ASC(?title)", + "userAccount": { + "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9" + } + }, + { + "_class" : "org.fairdatapoint.entity.search.SearchSavedQuery", + "uuid": "c7d0b6a0-5b0a-4b0e-9b0a-9b0a9b0a9b0a", + "name": "All distributions", + "description": "Quickly query all distributions (DCAT)", + "type": "INTERNAL", + "varPrefixes": "PREFIX dcat: ", + "varGraphPattern": "?entity rdf:type dcat:Distribution .", + "varOrdering": "ASC(?title)", + "userAccount": { + "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9" + } + }, + { + "_class" : "org.fairdatapoint.entity.search.SearchSavedQuery", + "uuid": "97da9119-834e-4687-8321-3df157547178", + "name": "Things with data", + "description": "This is private query of Nikola Tesla!", + "type": "PRIVATE", + "varPrefixes": "PREFIX dcat: ", + "varGraphPattern": "?entity ?relationPredicate ?relationObject .\nFILTER isLiteral(?relationObject)\nFILTER CONTAINS(LCASE(str(?relationObject)), LCASE(\"data\"))", + "varOrdering": "ASC(?title)", + "userAccount": { + "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9" + } + } +] \ No newline at end of file diff --git a/src/test/resources/test/db/migration/V0001.1__dev-data-users.sql b/src/test/resources/test/db/migration/V0001.1__dev-data-users.sql deleted file mode 100644 index cd8e0a967..000000000 --- a/src/test/resources/test/db/migration/V0001.1__dev-data-users.sql +++ /dev/null @@ -1,61 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - --- User Accounts -INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) -VALUES ('95589e50-d261-492b-8852-9324e9a66a42', 'Admin', 'von Universe', 'admin@example.com', '$2a$10$L.0OZ8QjV3yLhoCDvU04gu.WP1wGQih41MsBdvtQOshJJntaugBxe', 'ADMIN', NOW(), NOW()); - -INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) -VALUES ('7e64818d-6276-46fb-8bb1-732e6e09f7e9', 'Albert', 'Einstein', 'albert.einstein@example.com', '$2a$10$hZF1abbZ48Tf.3RndC9W6OlDt6gnBoD/2HbzJayTs6be7d.5DbpnW', 'USER', NOW(), NOW()); - -INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) -VALUES ('b5b92c69-5ed9-4054-954d-0121c29b6800', 'Nikola', 'Tesla', 'nikola.tesla@example.com', '$2a$10$tMbZUZg9AbYL514R.hZ0tuzvfZJR5NQhSVeJPTQhNwPf6gv/cvrna', 'USER', NOW(), NOW()); - -INSERT INTO public.user_account (uuid, first_name, last_name, email, password_hash, user_role, created_at, updated_at) -VALUES ('8d1a4c06-bb0e-4d03-a01f-14fa49bbc152', 'Isaac', 'Newton', 'isaac.newton@example.com', '$2a$10$DLkI7NAZDzWVaKG1lVtloeoPNLPoAgDDBqQKQiSAYDZXrf2QKkuHC', 'USER', NOW(), NOW()); - --- API Keys -INSERT INTO public.api_key (uuid, token, user_account_id, created_at, updated_at) -VALUES ('a1c00673-24c5-4e0a-bdbe-22e961ee7548', 'a274793046e34a219fd0ea6362fcca61a001500b71724f4c973a017031653c20', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', NOW(), NOW()); - -INSERT INTO public.api_key (uuid, token, user_account_id, created_at, updated_at) -VALUES ('62657760-21fe-488c-a0ea-f612a70493da', 'dd5dc3b53b6145cfa9f6c58b72ebad21cd2f860ace62451ba4e3c74a0e63540a', 'b5b92c69-5ed9-4054-954d-0121c29b6800', NOW(), NOW()); - --- Saved Search Queries -INSERT INTO public.search_saved_query (uuid, name, description, type, var_prefixes, var_graph_pattern, var_ordering, user_account_id, created_at, updated_at) -VALUES ('d31e3da1-2cfa-4b55-a8cb-71d1acf01aef', 'All datasets', 'Quickly query all datasets (DCAT)', 'PUBLIC', - 'PREFIX dcat: ', '?entity rdf:type dcat:Dataset .', 'ASC(?title)', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', - NOW(), NOW()); - -INSERT INTO public.search_saved_query (uuid, name, description, type, var_prefixes, var_graph_pattern, var_ordering, user_account_id, created_at, updated_at) -VALUES ('c7d0b6a0-5b0a-4b0e-9b0a-9b0a9b0a9b0a', 'All distributions', 'Quickly query all distributions (DCAT)', 'INTERNAL', - 'PREFIX dcat: ', '?entity rdf:type dcat:Distribution .', 'ASC(?title)', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', - NOW(), NOW()); - -INSERT INTO public.search_saved_query (uuid, name, description, type, var_prefixes, var_graph_pattern, var_ordering, user_account_id, created_at, updated_at) -VALUES ('97da9119-834e-4687-8321-3df157547178', 'Things with data', 'This is private query of Nikola Tesla!', 'PRIVATE', - 'PREFIX dcat: ', -'?entity ?relationPredicate ?relationObject . -FILTER isLiteral(?relationObject) -FILTER CONTAINS(LCASE(str(?relationObject)), LCASE("data"))', - 'ASC(?title)', '7e64818d-6276-46fb-8bb1-732e6e09f7e9', NOW(), NOW()); From caddb3d415be0897239c27f42ab9a519aa790366 Mon Sep 17 00:00:00 2001 From: Dennis <29799340+dennisvang@users.noreply.github.com> Date: Fri, 14 Nov 2025 17:33:24 +0100 Subject: [PATCH 11/28] cherry-pick: Make test logging config easier to use (#806) * include root logger AppenderRef, so we only need to change the log level, when required * rename test logging config file for clarity and conformance to log4j2 best practices --- src/test/resources/{log4j2.xml => log4j2-test.xml} | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) rename src/test/resources/{log4j2.xml => log4j2-test.xml} (60%) diff --git a/src/test/resources/log4j2.xml b/src/test/resources/log4j2-test.xml similarity index 60% rename from src/test/resources/log4j2.xml rename to src/test/resources/log4j2-test.xml index 77fa02165..580d6530a 100644 --- a/src/test/resources/log4j2.xml +++ b/src/test/resources/log4j2-test.xml @@ -6,8 +6,11 @@ - + - + + + + From d14ce0ff50376b23ebff1b34648e00b1abf45f22 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:19:18 +0100 Subject: [PATCH 12/28] adapt bootstrap.locations for DatabaseBootstrapTests --- .../db/repository/bootstrap/DatabaseBootstrapTests.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java b/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java index 0a8cedff4..fa3f78e3d 100644 --- a/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java +++ b/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java @@ -43,12 +43,7 @@ @AutoConfigureTestEntityManager @Transactional -@TestPropertySource( - properties = """ - bootstrap.enabled=true - bootstrap.db-fixtures-dirs=src/test/resources/fixtures - """ -) +@TestPropertySource(properties = "bootstrap.locations[0]=file:src/test/resources/fixtures") public class DatabaseBootstrapTests extends BaseIntegrationTest { @Autowired private UserAccountRepository userAccountRepository; From a1e6c8c801203d4fe8d9429ddd105c2fe922b19d Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:00:16 +0100 Subject: [PATCH 13/28] re-populate db from fixtures after flyway clean in WebIntegrationTest.setup --- .../org/fairdatapoint/WebIntegrationTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/org/fairdatapoint/WebIntegrationTest.java b/src/test/java/org/fairdatapoint/WebIntegrationTest.java index 6fe2e758a..79a357ce8 100644 --- a/src/test/java/org/fairdatapoint/WebIntegrationTest.java +++ b/src/test/java/org/fairdatapoint/WebIntegrationTest.java @@ -30,6 +30,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.context.ApplicationContext; +import org.springframework.data.repository.init.ResourceReaderRepositoryPopulator; +import org.springframework.data.repository.support.Repositories; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -64,10 +67,22 @@ public abstract class WebIntegrationTest { @Autowired protected AclMigration aclMigration; + @Autowired + private ApplicationContext applicationContext; + + @Autowired + private ResourceReaderRepositoryPopulator populator; + @BeforeEach public void setup() { + // drop test database content flyway.clean(); + // re-migrate schemas flyway.migrate(); + // re-populate the database using fixtures + populator.populate(new Repositories(applicationContext)); + // re-migrate acl data + // (TODO: AclMigration is in a subfolder of rdf/migration, but is it even related to rdf? Looks relational...) aclMigration.runMigration(); } } From 636c38cf260e0fc39f0dd80bbe6d0b6f521c73ea Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:09:25 +0100 Subject: [PATCH 14/28] delete V0001.2__dev-data-schemas.sql because it is covered by the default 02xx fixtures --- .../migration/V0001.2__dev-data-schemas.sql | 505 ------------------ 1 file changed, 505 deletions(-) delete mode 100644 src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql diff --git a/src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql b/src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql deleted file mode 100644 index 310c8377f..000000000 --- a/src/test/resources/test/db/migration/V0001.2__dev-data-schemas.sql +++ /dev/null @@ -1,505 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - --- Resource -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('6a668323-3936-4b53-8380-a4fd2ed082ee', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('71d77460-f919-4f72-b265-ed26567fe361', - '6a668323-3936-4b53-8380-a4fd2ed082ee', - NULL, - '1.0.0', - 'Resource', - '', - '@prefix : . - @prefix dash: . - @prefix dcat: . - @prefix dct: . - @prefix foaf: . - @prefix sh: . - @prefix xsd: . - - :ResourceShape a sh:NodeShape ; - sh:targetClass dcat:Resource ; - sh:property [ - sh:path dct:title ; - sh:nodeKind sh:Literal ; - sh:minCount 1 ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - sh:order 1 ; - ], [ - sh:path dct:description ; - sh:nodeKind sh:Literal ; - sh:maxCount 1 ; - dash:editor dash:TextAreaEditor ; - sh:order 2 ; - ], [ - sh:path dct:publisher ; - sh:node :AgentShape ; - sh:minCount 1 ; - sh:maxCount 1 ; - dash:editor dash:BlankNodeEditor ; - sh:order 3 ; - ], [ - sh:path dcat:version ; - sh:name "version" ; - sh:nodeKind sh:Literal ; - sh:minCount 1 ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 4 ; - ], [ - sh:path dct:language ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:defaultValue ; - sh:order 5 ; - ], [ - sh:path dct:license ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:defaultValue ; - sh:order 6 ; - ], [ - sh:path dct:rights ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 7 ; - ] . - - :AgentShape a sh:NodeShape ; - sh:targetClass foaf:Agent ; - sh:property [ - sh:path foaf:name ; - sh:nodeKind sh:Literal ; - sh:minCount 1 ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - ] . - ', - ARRAY ['http://www.w3.org/ns/dcat#Resource'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - TRUE, - NULL, - NULL, - NOW(), - NOW()); - --- Data Service -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('89d94c1b-f6ff-4545-ba9b-120b2d1921d0', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('9111d436-fe58-4bd5-97ae-e6f86bc2997a', - '89d94c1b-f6ff-4545-ba9b-120b2d1921d0', - NULL, - '1.0.0', - 'Data Service', - '', - '@prefix : . -@prefix dash: . -@prefix dcat: . -@prefix dct: . -@prefix sh: . -@prefix xsd: . - -:DataServiceShape a sh:NodeShape ; - sh:targetClass dcat:DataService ; - sh:property [ - sh:path dcat:endpointURL ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - sh:order 20 ; - ] , [ - sh:path dcat:endpointDescription ; - sh:nodeKind sh:Literal ; - sh:maxCount 1 ; - dash:editor dash:TextAreaEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 21 ; -] . -', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#DataService'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('2efc8366-541d-493f-8661-69ad8f72dfa1', '9111d436-fe58-4bd5-97ae-e6f86bc2997a', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); - --- Metadata Service -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('6f7a5a76-6185-4bd0-9fe9-62ecc90c9bad', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('36b22b70-6203-4dd2-9fb6-b39a776bf467', - '6f7a5a76-6185-4bd0-9fe9-62ecc90c9bad', - NULL, - '1.0.0', - 'Metadata Service', - '', - '@prefix : . -@prefix fdp: . -@prefix sh: . - -:MetadataServiceShape a sh:NodeShape ; - sh:targetClass fdp:MetadataService . -', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#DataService', 'https://w3id.org/fdp/fdp-o#MetadataService'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('8742361b-cd00-4167-b859-e45fa36d0cb7', '36b22b70-6203-4dd2-9fb6-b39a776bf467', '89d94c1b-f6ff-4545-ba9b-120b2d1921d0', 0); - --- FAIR Data Point -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('a92958ab-a414-47e6-8e17-68ba96ba3a2b', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('4e64208d-f102-45a0-96e3-17b002e6213e', - 'a92958ab-a414-47e6-8e17-68ba96ba3a2b', - NULL, - '1.0.0', - 'FAIR Data Point', - '', - '@prefix : . -@prefix dash: . -@prefix dct: . -@prefix fdp: . -@prefix sh: . -@prefix xsd: . - -:FDPShape a sh:NodeShape ; - sh:targetClass fdp:FAIRDataPoint ; - sh:property [ - sh:path fdp:startDate ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 40 ; - ] , [ - sh:path fdp:endDate ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 41 ; - ] , [ - sh:path fdp:uiLanguage ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - sh:defaultValue ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 42 ; - ] , [ - sh:path fdp:metadataIdentifier ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 43 ; - ] , [ - sh:path fdp:metadataIssued ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:viewer dash:LiteralViewer ; - sh:order 44 ; - ] , [ - sh:path fdp:metadataModified ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:viewer dash:LiteralViewer ; - sh:order 45 ; - ] . - ', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#DataService', 'https://w3id.org/fdp/fdp-o#MetadataService', 'https://w3id.org/fdp/fdp-o#FAIRDataPoint'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('afebd441-8aa5-464d-bc3c-033f175449b4', '4e64208d-f102-45a0-96e3-17b002e6213e', '6f7a5a76-6185-4bd0-9fe9-62ecc90c9bad', 0); - --- Catalog -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('c9640671-945d-4114-88fb-e81314cb7ab2', - '2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660', - NULL, - '1.0.0', - 'Catalog', - '', - '@prefix : . -@prefix dash: . -@prefix dcat: . -@prefix dct: . -@prefix foaf: . -@prefix sh: . -@prefix xsd: . - -:CatalogShape a sh:NodeShape ; - sh:targetClass dcat:Catalog ; - sh:property [ - sh:path dct:issued ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:viewer dash:LiteralViewer ; - sh:order 20 ; - ], [ - sh:path dct:modified ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:viewer dash:LiteralViewer ; - sh:order 21 ; - ], [ - sh:path foaf:homePage ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 22 ; - ], [ - sh:path dcat:themeTaxonomy ; - sh:nodeKind sh:IRI ; - dash:viewer dash:LabelViewer ; - sh:order 23 ; - ] . -', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#Catalog'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('e75cb601-318d-41ea-9a8b-32e0749c80a7', 'c9640671-945d-4114-88fb-e81314cb7ab2', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); - --- Dataset -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('866d7fb8-5982-4215-9c7c-18d0ed1bd5f3', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('9cc3c89a-76cf-4639-a71f-652627af51db', - '866d7fb8-5982-4215-9c7c-18d0ed1bd5f3', - NULL, - '1.0.0', - 'Dataset', - '', - '@prefix : . -@prefix dash: . -@prefix dcat: . -@prefix dct: . -@prefix sh: . -@prefix xsd: . - -:DatasetShape a sh:NodeShape ; - sh:targetClass dcat:Dataset ; - sh:property [ - sh:path dct:issued ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 20 ; - ], [ - sh:path dct:modified ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 21 ; - ], [ - sh:path dcat:theme ; - sh:nodeKind sh:IRI ; - sh:minCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 22 ; - ], [ - sh:path dcat:contactPoint ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 23 ; - ], [ - sh:path dcat:keyword ; - sh:nodeKind sh:Literal ; - dash:editor dash:TextFieldEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 24 ; - ], [ - sh:path dcat:landingPage ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - dash:viewer dash:LabelViewer ; - sh:order 25 ; - ] . -', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#Dataset'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('da13ba37-09f8-4937-9055-e3ee3aefc57c', '9cc3c89a-76cf-4639-a71f-652627af51db', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); - --- Distribution -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('ebacbf83-cd4f-4113-8738-d73c0735b0ab', NOW(), NOW()); -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('3cda8cd3-b08b-4797-822d-d3f3e83c466a', - 'ebacbf83-cd4f-4113-8738-d73c0735b0ab', - NULL, - '1.0.0', - 'Distribution', - '', - '@prefix : . -@prefix dash: . -@prefix dcat: . -@prefix dct: . -@prefix sh: . -@prefix xsd: . - -:DistributionShape a sh:NodeShape ; - sh:targetClass dcat:Distribution ; - sh:property [ - sh:path dct:issued ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 20 ; - ] , [ - sh:path dct:modified ; - sh:datatype xsd:dateTime ; - sh:maxCount 1 ; - dash:editor dash:DatePickerEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 21 ; - ] , [ - sh:path dcat:accessURL ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - sh:order 22 ; - ] , [ - sh:path dcat:downloadURL ; - sh:nodeKind sh:IRI ; - sh:maxCount 1 ; - dash:editor dash:URIEditor ; - sh:order 23 ; - ] , [ - sh:path dcat:mediaType ; - sh:nodeKind sh:Literal ; - sh:minCount 1 ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 24 ; - ] , [ - sh:path dcat:format ; - sh:nodeKind sh:Literal ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 25 ; - ] , [ - sh:path dcat:byteSize ; - sh:nodeKind sh:Literal ; - sh:maxCount 1 ; - dash:editor dash:TextFieldEditor ; - dash:viewer dash:LiteralViewer ; - sh:order 26 ; - ] . -', - ARRAY ['http://www.w3.org/ns/dcat#Resource', 'http://www.w3.org/ns/dcat#Distribution'], - 'INTERNAL', - NULL, - NULL, - 'LATEST', - FALSE, - FALSE, - NULL, - NULL, - NOW(), - NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('a3b16a4e-cac7-4b71-a3de-94bb86714b5b', '3cda8cd3-b08b-4797-822d-d3f3e83c466a', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); From 1aa0b160d97cc8bce248b31c135b05bf5d9c122b Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:10:43 +0100 Subject: [PATCH 15/28] delete V0001.3__dev-data-rds.sql because it is covered by the 03xx fixtures --- .../db/migration/V0001.3__dev-data-rds.sql | 68 ------------------- 1 file changed, 68 deletions(-) delete mode 100644 src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql diff --git a/src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql b/src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql deleted file mode 100644 index ed4f047ff..000000000 --- a/src/test/resources/test/db/migration/V0001.3__dev-data-rds.sql +++ /dev/null @@ -1,68 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - --- Distribution -INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) -VALUES ('02c649de-c579-43bb-b470-306abdc808c7', 'Distribution', 'distribution', now(), now()); - -INSERT INTO resource_definition_link (uuid, resource_definition_id, title, property_uri, order_priority, created_at, updated_at) -VALUES ('660a1821-a5d2-48d0-a26b-0c6d5bac3de4', '02c649de-c579-43bb-b470-306abdc808c7', 'Access online', 'http://www.w3.org/ns/dcat#accessURL', 1, now(), now()); - -INSERT INTO resource_definition_link (uuid, resource_definition_id, title, property_uri, order_priority, created_at, updated_at) -VALUES ('c2eaebb8-4d8d-469d-8736-269adeded996', '02c649de-c579-43bb-b470-306abdc808c7', 'Download', 'http://www.w3.org/ns/dcat#downloadURL', 2, now(), now()); - -INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) -VALUES ('bbf4ecb3-c529-4c02-955c-7160755debf5', '02c649de-c579-43bb-b470-306abdc808c7', 'ebacbf83-cd4f-4113-8738-d73c0735b0ab', 1); - --- Dataset -INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) -VALUES ('2f08228e-1789-40f8-84cd-28e3288c3604', 'Dataset', 'dataset', now(), now()); - -INSERT INTO resource_definition_child (uuid, source_resource_definition_id, target_resource_definition_id, relation_uri, title, tags_uri, order_priority, created_at, updated_at) -VALUES ('9f138a13-9d45-4371-b763-0a3b9e0ec912', '2f08228e-1789-40f8-84cd-28e3288c3604', '02c649de-c579-43bb-b470-306abdc808c7', 'http://www.w3.org/ns/dcat#distribution', 'Distributions', NULL, 1, now(), now()); - -INSERT INTO resource_definition_child_metadata (uuid, resource_definition_child_id, title, property_uri, order_priority, created_at, updated_at) -VALUES ('723e95d3-1696-45e2-9429-f6e98e3fb893', '9f138a13-9d45-4371-b763-0a3b9e0ec912', 'Media Type', 'http://www.w3.org/ns/dcat#mediaType', 1, now(), now()); - -INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) -VALUES ('b8a0ed37-42a1-487e-8842-09fe082c4cc6', '2f08228e-1789-40f8-84cd-28e3288c3604', '866d7fb8-5982-4215-9c7c-18d0ed1bd5f3', 1); - --- Catalog -INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) -VALUES ('a0949e72-4466-4d53-8900-9436d1049a4b', 'Catalog', 'catalog', now(), now()); - -INSERT INTO resource_definition_child (uuid, source_resource_definition_id, target_resource_definition_id, relation_uri, title, tags_uri, order_priority, created_at, updated_at) -VALUES ('e9f0f5d3-2a93-4aa3-9dd0-acb1d76f54fc', 'a0949e72-4466-4d53-8900-9436d1049a4b', '2f08228e-1789-40f8-84cd-28e3288c3604', 'http://www.w3.org/ns/dcat#dataset', 'Datasets', 'http://www.w3.org/ns/dcat#theme', 1, now(), now()); - -INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) -VALUES ('e4df9510-a3ad-4e3b-a1a9-5fc330d8b1f0', 'a0949e72-4466-4d53-8900-9436d1049a4b', '2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660', 1); - --- FAIR Data Point -INSERT INTO resource_definition (uuid, name, url_prefix, created_at, updated_at) -VALUES ('77aaad6a-0136-4c6e-88b9-07ffccd0ee4c', 'FAIR Data Point', '', now(), now()); - -INSERT INTO resource_definition_child (uuid, source_resource_definition_id, target_resource_definition_id, relation_uri, title, tags_uri, order_priority, created_at, updated_at) -VALUES ('b8648597-8fbd-4b89-9e30-5eab82675e42', '77aaad6a-0136-4c6e-88b9-07ffccd0ee4c', 'a0949e72-4466-4d53-8900-9436d1049a4b', 'https://w3id.org/fdp/fdp-o#metadataCatalog', 'Catalogs', 'http://www.w3.org/ns/dcat#themeTaxonomy', 1, now(), now()); - -INSERT INTO metadata_schema_usage (uuid, resource_definition_id, metadata_schema_id, order_priority) -VALUES ('9b3a32a8-a14c-4eb0-ba02-3aa8e13a8f11', '77aaad6a-0136-4c6e-88b9-07ffccd0ee4c', 'a92958ab-a414-47e6-8e17-68ba96ba3a2b', 1); From 79ec86fd2c9f0e025a9a4ff6b678a7d87fa16c10 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:12:03 +0100 Subject: [PATCH 16/28] delete V0001.4__dev-data-membership.sql because it is covered by the 04xx fixtures --- .../V0001.4__dev-data-membership.sql | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql diff --git a/src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql b/src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql deleted file mode 100644 index 8240e0bfe..000000000 --- a/src/test/resources/test/db/migration/V0001.4__dev-data-membership.sql +++ /dev/null @@ -1,43 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - -INSERT INTO membership (uuid, name, allowed_entities, created_at, updated_at) -VALUES ('49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 'Owner', ARRAY ['a0949e72-4466-4d53-8900-9436d1049a4b', '2f08228e-1789-40f8-84cd-28e3288c3604', '02c649de-c579-43bb-b470-306abdc808c7'], NOW(), NOW()); - -INSERT INTO membership (uuid, name, allowed_entities, created_at, updated_at) -VALUES ('87a2d984-7db2-43f6-805c-6b0040afead5', 'Data Provider', ARRAY ['a0949e72-4466-4d53-8900-9436d1049a4b'], NOW(), NOW()); - -INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) -VALUES ('e0d9f853-637b-4c50-9ad9-07b6349bf76f', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 2, 'W', NOW(), NOW()); - -INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) -VALUES ('de4e4f85-f11d-475b-b6f0-33bdfe5f923a', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 4, 'C', NOW(), NOW()); - -INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) -VALUES ('60bebbf0-210d-4b05-af85-ca1b58546261', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 8, 'D', NOW(), NOW()); - -INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) -VALUES ('36c3b6e9-f2e3-48b7-bae1-4dc3196a3657', '49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8', 16, 'A', NOW(), NOW()); - -INSERT INTO membership_permission (uuid, membership_id, mask, code, created_at, updated_at) -VALUES ('589d09d3-1c29-4c6f-97fc-6ea4e007fb85', '87a2d984-7db2-43f6-805c-6b0040afead5', 4, 'C', NOW(), NOW()); From ec5711ac424171ae617fd7eb01822e2b6484a2ef Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:34:10 +0100 Subject: [PATCH 17/28] replace V0001.5__dev-settings.sql by 0500_test-settings.json --- .../test-fixtures/0500_test-settings.json | 140 ++++++++++++++++++ .../db/migration/V0001.5__dev-settings.sql | 73 --------- 2 files changed, 140 insertions(+), 73 deletions(-) create mode 100644 src/test/resources/test-fixtures/0500_test-settings.json delete mode 100644 src/test/resources/test/db/migration/V0001.5__dev-settings.sql diff --git a/src/test/resources/test-fixtures/0500_test-settings.json b/src/test/resources/test-fixtures/0500_test-settings.json new file mode 100644 index 000000000..18e51cff0 --- /dev/null +++ b/src/test/resources/test-fixtures/0500_test-settings.json @@ -0,0 +1,140 @@ +[ + { + "_class": "org.fairdatapoint.entity.settings.Settings", + "uuid": "00000000-0000-0000-0000-000000000000", + "appTitle": "FAIR Data Point", + "appSubtitle": "FDP Development Instance", + "pingEnabled": false, + "pingEndpoints": [ + "https://home.fairdatapoint.org" + ], + "autocompleteSearchNamespace": true + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsAutocompleteSource", + "uuid": "d4045a98-dd25-493e-a0b1-d704921c0930", + "settings": { + "uuid": "00000000-0000-0000-0000-000000000000" + }, + "rdfType": "http://www.w3.org/2000/01/rdf-schema#Class", + "sparqlEndpoint": "http://localhost:3030/ds/query", + "sparqlQuery": "SELECT DISTINCT ?uri ?label\nWHERE { ?uri a .\n?uri ?label .\nFILTER regex(?label, \".*%s.*\", \"i\") }\nORDER BY ?label", + "orderPriority": 1 + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsMetric", + "uuid": "8435491b-c16c-4457-ae94-e0f4128603d5", + "settings": { + "uuid": "00000000-0000-0000-0000-000000000000" + }, + "metricUri": "https://purl.org/fair-metrics/FM_F1A", + "resourceUri": "https://www.ietf.org/rfc/rfc3986.txt", + "orderPriority": 1 + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsMetric", + "uuid": "af93d36a-0af0-4054-8c00-2675d460b231", + "settings": { + "uuid": "00000000-0000-0000-0000-000000000000" + }, + "metricUri": "https://purl.org/fair-metrics/FM_A1.1", + "resourceUri": "https://www.wikidata.org/wiki/Q8777", + "orderPriority": 2 + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsSearchFilter", + "uuid": "57a98728-ce8c-4e7f-b0f8-94e2668b44d3", + "settings": { + "uuid": "00000000-0000-0000-0000-000000000000" + }, + "type": "IRI", + "label": "Type", + "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + "queryRecords": false, + "orderPriority": 1 + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsSearchFilterItem", + "uuid": "b48c2c7f-d7fb-47ae-a72c-b1b360e16f6e", + "filter": { + "uuid": "57a98728-ce8c-4e7f-b0f8-94e2668b44d3" + }, + "label": "Catalog", + "value": "http://www.w3.org/ns/dcat#Catalog", + "orderPriority": 1 + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsSearchFilterItem", + "uuid": "3e1598ac-9d29-47f0-8e7b-3c26ca0134a0", + "filter": { + "uuid": "57a98728-ce8c-4e7f-b0f8-94e2668b44d3" + }, + "label": "Dataset", + "value": "http://www.w3.org/ns/dcat#Dataset", + "orderPriority": 2 + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsSearchFilterItem", + "uuid": "5697d8d9-f09d-4ebe-b834-b37eb0624c3f", + "filter": { + "uuid": "57a98728-ce8c-4e7f-b0f8-94e2668b44d3" + }, + "label": "Distribution", + "value": "http://www.w3.org/ns/dcat#Distribution", + "orderPriority": 3 + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsSearchFilterItem", + "uuid": "022c3bc6-0598-408c-8d2e-b486dafb73dd", + "filter": { + "uuid": "57a98728-ce8c-4e7f-b0f8-94e2668b44d3" + }, + "label": "Data Service", + "value": "http://www.w3.org/ns/dcat#DataService", + "orderPriority": 4 + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsSearchFilterItem", + "uuid": "7cee5591-8620-4fea-b883-a94285012b8d", + "filter": { + "uuid": "57a98728-ce8c-4e7f-b0f8-94e2668b44d3" + }, + "label": "Metadata Service", + "value": "https://w3id.org/fdp/fdp-o#MetadataService", + "orderPriority": 5 + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsSearchFilterItem", + "uuid": "9d661dca-8017-4dba-b930-cd2834ea59e8", + "filter": { + "uuid": "57a98728-ce8c-4e7f-b0f8-94e2668b44d3" + }, + "label": "FAIR Data Point", + "value": "https://w3id.org/fdp/fdp-o#FAIRDataPoint", + "orderPriority": 6 + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsSearchFilter", + "uuid": "26913eb3-67dd-45c9-b8ff-4c97e8162a9b", + "settings": { + "uuid": "00000000-0000-0000-0000-000000000000" + }, + "type": "IRI", + "label": "License", + "predicate": "http://purl.org/dc/terms/license", + "queryRecords": true, + "orderPriority": 2 + }, + { + "_class": "org.fairdatapoint.entity.settings.SettingsSearchFilter", + "uuid": "cb25afb4-6169-42f8-bde5-181c803773a8", + "settings": { + "uuid": "00000000-0000-0000-0000-000000000000" + }, + "type": "IRI", + "label": "Version", + "predicate": "http://www.w3.org/ns/dcat#version", + "queryRecords": true, + "orderPriority": 3 + } +] diff --git a/src/test/resources/test/db/migration/V0001.5__dev-settings.sql b/src/test/resources/test/db/migration/V0001.5__dev-settings.sql deleted file mode 100644 index 75496e02a..000000000 --- a/src/test/resources/test/db/migration/V0001.5__dev-settings.sql +++ /dev/null @@ -1,73 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - --- Settings -INSERT INTO settings (uuid, app_title, app_subtitle, ping_enabled, ping_endpoints, autocomplete_search_ns, created_at, updated_at) -VALUES ('00000000-0000-0000-0000-000000000000', 'FAIR Data Point', 'FDP Development Instance', False, ARRAY ['https://home.fairdatapoint.org'], True, now(), now()); - --- Autocomplete Sources -INSERT INTO settings_autocomplete_source (uuid, settings_id, rdf_type, sparql_endpoint, sparql_query, order_priority, created_at, updated_at) -VALUES ('d4045a98-dd25-493e-a0b1-d704921c0930', '00000000-0000-0000-0000-000000000000', 'http://www.w3.org/2000/01/rdf-schema#Class', 'http://localhost:3030/ds/query', -'SELECT DISTINCT ?uri ?label -WHERE { ?uri a . -?uri ?label . -FILTER regex(?label, ".*%s.*", "i") } -ORDER BY ?label', - 1, now(), now()); - --- Search Filters: Type -INSERT INTO settings_search_filter (uuid, settings_id, type, label, predicate, query_records, order_priority, created_at, updated_at) -VALUES ('57a98728-ce8c-4e7f-b0f8-94e2668b44d3', '00000000-0000-0000-0000-000000000000', 'IRI', 'Type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', False, 1, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('b48c2c7f-d7fb-47ae-a72c-b1b360e16f6e', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Catalog', 'http://www.w3.org/ns/dcat#Catalog', 1, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('3e1598ac-9d29-47f0-8e7b-3c26ca0134a0', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Dataset', 'http://www.w3.org/ns/dcat#Dataset', 2, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('5697d8d9-f09d-4ebe-b834-b37eb0624c3f', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Distribution', 'http://www.w3.org/ns/dcat#Distribution', 3, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('022c3bc6-0598-408c-8d2e-b486dafb73dd', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Data Service', 'http://www.w3.org/ns/dcat#DataService', 4, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('7cee5591-8620-4fea-b883-a94285012b8d', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'Metadata Service', 'https://w3id.org/fdp/fdp-o#MetadataService', 5, now(), now()); - -INSERT INTO settings_search_filter_item (uuid, filter_id, label, value, order_priority, created_at, updated_at) -VALUES ('9d661dca-8017-4dba-b930-cd2834ea59e8', '57a98728-ce8c-4e7f-b0f8-94e2668b44d3', 'FAIR Data Point', 'https://w3id.org/fdp/fdp-o#FAIRDataPoint', 6, now(), now()); - --- Search Filters: License -INSERT INTO settings_search_filter (uuid, settings_id, type, label, predicate, query_records, order_priority, created_at, updated_at) -VALUES ('26913eb3-67dd-45c9-b8ff-4c97e8162a9b', '00000000-0000-0000-0000-000000000000', 'IRI', 'License', 'http://purl.org/dc/terms/license', True, 2, now(), now()); - --- Search Filters: License -INSERT INTO settings_search_filter (uuid, settings_id, type, label, predicate, query_records, order_priority, created_at, updated_at) -VALUES ('cb25afb4-6169-42f8-bde5-181c803773a8', '00000000-0000-0000-0000-000000000000', 'IRI', 'Version', 'http://www.w3.org/ns/dcat#version', True, 3, now(), now()); - --- Metrics -INSERT INTO settings_metric (uuid, settings_id, metric_uri, resource_uri, order_priority, created_at, updated_at) -VALUES ('8435491b-c16c-4457-ae94-e0f4128603d5', '00000000-0000-0000-0000-000000000000', 'https://purl.org/fair-metrics/FM_F1A', 'https://www.ietf.org/rfc/rfc3986.txt', 1, now(), now()); - -INSERT INTO settings_metric (uuid, settings_id, metric_uri, resource_uri, order_priority, created_at, updated_at) -VALUES ('af93d36a-0af0-4054-8c00-2675d460b231', '00000000-0000-0000-0000-000000000000', 'https://purl.org/fair-metrics/FM_A1.1', 'https://www.wikidata.org/wiki/Q8777', 2, now(), now()); From 883e34152d6b009a7724170e8107a9e90ebe5b0f Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:45:56 +0100 Subject: [PATCH 18/28] replace V0001.6__test-schemas.sql by 0600_test-schemas.json --- .../test-fixtures/0600_test-schemas.json | 271 ++++++++++++++++++ .../db/migration/V0001.6__test-schemas.sql | 161 ----------- 2 files changed, 271 insertions(+), 161 deletions(-) create mode 100644 src/test/resources/test-fixtures/0600_test-schemas.json delete mode 100644 src/test/resources/test/db/migration/V0001.6__test-schemas.sql diff --git a/src/test/resources/test-fixtures/0600_test-schemas.json b/src/test/resources/test-fixtures/0600_test-schemas.json new file mode 100644 index 000000000..75bf756d4 --- /dev/null +++ b/src/test/resources/test-fixtures/0600_test-schemas.json @@ -0,0 +1,271 @@ +[ + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchema", + "uuid": "e8b34158-3858-45c7-8e3e-d1e671dd9929" + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "53619e58-2bb0-4baf-afd8-00c5d01ff8a8", + "schema": { "uuid": "e8b34158-3858-45c7-8e3e-d1e671dd9929" }, + "version": "0.1.0", + "name": "Custom schema", + "description": "Custom schema V1", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "LATEST", + "published": true, + "abstractSchema": false + }, + + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchema", + "uuid": "bfa79edf-00b7-4a04-b5a6-a5144f1a77b7" + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "cb9f6cd7-97af-45d0-b23d-d0aab23607d8", + "schema": { "uuid": "bfa79edf-00b7-4a04-b5a6-a5144f1a77b7" }, + "version": "0.1.0", + "name": "Custom schema", + "description": "Custom schema V1", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "DRAFT", + "published": false, + "abstractSchema": false + }, + + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchema", + "uuid": "fe98adbb-6a2c-4c7a-b2b2-a72db5140c61" + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "f0a4b358-69a3-44e6-9436-c68a56a9f2f2", + "schema": { "uuid": "fe98adbb-6a2c-4c7a-b2b2-a72db5140c61" }, + "version": "0.1.0", + "name": "Custom schema", + "description": "Custom schema V1", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "INTERNAL", + "state": "LATEST", + "published": true, + "abstractSchema": false + }, + + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchema", + "uuid": "978e5c1c-268d-4822-b60b-07d3eccc6896" + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "d7acec53-5ac9-4502-9bfa-92d1e9f79a24", + "schema": { "uuid": "978e5c1c-268d-4822-b60b-07d3eccc6896" }, + "version": "0.1.0", + "name": "Custom schema", + "description": "Custom schema V1", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "LEGACY", + "published": false, + "abstractSchema": false + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "67896adc-b431-431d-8296-f0b80d8de412", + "schema": { "uuid": "978e5c1c-268d-4822-b60b-07d3eccc6896" }, + "previousVersion": { "uuid": "d7acec53-5ac9-4502-9bfa-92d1e9f79a24" }, + "version": "0.2.0", + "name": "Custom schema", + "description": "Custom schema V2", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "LEGACY", + "published": false, + "abstractSchema": false + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "c62d4a97-baac-40b8-b6ea-e43b06ec78bd", + "schema": { "uuid": "978e5c1c-268d-4822-b60b-07d3eccc6896" }, + "previousVersion": { "uuid": "67896adc-b431-431d-8296-f0b80d8de412" }, + "version": "0.3.0", + "name": "Custom schema", + "description": "Custom schema V3", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "LATEST", + "published": false, + "abstractSchema": false + }, + + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchema", + "uuid": "e7078309-cb4c-47b9-9ef8-057487b3da58" + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "a17c25ad-e8d3-4338-bb3e-eda76d2fc32c", + "schema": { "uuid": "e7078309-cb4c-47b9-9ef8-057487b3da58" }, + "version": "0.0.0", + "name": "Custom schema", + "description": "Custom schema draft", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "DRAFT", + "published": false, + "abstractSchema": false + }, + + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchema", + "uuid": "123e48d2-9995-4b44-8b2c-9c81bdbf2dd2" + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "fb24f92b-187f-4d53-b744-73024b537f30", + "schema": { "uuid": "123e48d2-9995-4b44-8b2c-9c81bdbf2dd2" }, + "version": "0.1.0", + "name": "Custom schema", + "description": "Custom schema V1", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "LEGACY", + "published": false, + "abstractSchema": false + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "6011adfa-f8da-478d-86ea-84bb644b458b", + "schema": { "uuid": "123e48d2-9995-4b44-8b2c-9c81bdbf2dd2" }, + "previousVersion": { "uuid": "fb24f92b-187f-4d53-b744-73024b537f30" }, + "version": "0.2.0", + "name": "Custom schema", + "description": "Custom schema V2", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "LATEST", + "published": false, + "abstractSchema": false + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "6b84ec86-2096-48db-bfc7-23506b8c080c", + "schema": { "uuid": "123e48d2-9995-4b44-8b2c-9c81bdbf2dd2" }, + "previousVersion": { "uuid": "6011adfa-f8da-478d-86ea-84bb644b458b" }, + "version": "0.0.0", + "name": "Custom schema", + "description": "Custom schema draft", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "DRAFT", + "published": false, + "abstractSchema": false + }, + + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchema", + "uuid": "7c8b8699-ca9f-4d14-86e2-2299b27c5711" + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "4e44fb19-b9e0-46e9-957a-e7aa3adac7bf", + "schema": { "uuid": "7c8b8699-ca9f-4d14-86e2-2299b27c5711" }, + "version": "0.1.0", + "name": "Custom schema", + "description": "Custom schema V1", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "LEGACY", + "published": false, + "abstractSchema": false + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "abcf3a21-6f9a-45dc-a71a-4dde4440c81a", + "schema": { "uuid": "7c8b8699-ca9f-4d14-86e2-2299b27c5711" }, + "previousVersion": { "uuid": "4e44fb19-b9e0-46e9-957a-e7aa3adac7bf" }, + "version": "0.2.0", + "name": "Custom schema", + "description": "Custom schema V2", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "LATEST", + "published": false, + "abstractSchema": false + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaExtension", + "uuid": "1bdca611-c96e-4304-b1f3-030d282ef529", + "metadataSchemaVersion": { "uuid": "abcf3a21-6f9a-45dc-a71a-4dde4440c81a" }, + "extendedMetadataSchema": { "uuid": "6a668323-3936-4b53-8380-a4fd2ed082ee" }, + "orderPriority": 0 + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaExtension", + "uuid": "1bdca611-c96e-4304-b1f3-030d282ef530", + "metadataSchemaVersion": { "uuid": "abcf3a21-6f9a-45dc-a71a-4dde4440c81a" }, + "extendedMetadataSchema": { "uuid": "123e48d2-9995-4b44-8b2c-9c81bdbf2dd2" }, + "orderPriority": 1 + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaVersion", + "uuid": "a6d609ff-905f-4edd-bdb1-2dce000c9a45", + "schema": { "uuid": "7c8b8699-ca9f-4d14-86e2-2299b27c5711" }, + "previousVersion": { "uuid": "abcf3a21-6f9a-45dc-a71a-4dde4440c81a" }, + "version": "0.0.0", + "name": "Custom schema", + "description": "Custom schema draft", + "definition": "", + "targetClasses": [ + "http://www.w3.org/2000/01/rdf-schema#Class" + ], + "type": "CUSTOM", + "state": "DRAFT", + "published": false, + "abstractSchema": false + }, + { + "_class": "org.fairdatapoint.entity.schema.MetadataSchemaExtension", + "uuid": "53e3db46-8fe4-47ce-873e-ed7db94e73b3", + "metadataSchemaVersion": { "uuid": "a6d609ff-905f-4edd-bdb1-2dce000c9a45" }, + "extendedMetadataSchema": { "uuid": "6a668323-3936-4b53-8380-a4fd2ed082ee" }, + "orderPriority": 0 + } +] diff --git a/src/test/resources/test/db/migration/V0001.6__test-schemas.sql b/src/test/resources/test/db/migration/V0001.6__test-schemas.sql deleted file mode 100644 index b340329e8..000000000 --- a/src/test/resources/test/db/migration/V0001.6__test-schemas.sql +++ /dev/null @@ -1,161 +0,0 @@ --- --- The MIT License --- Copyright © 2016-2024 FAIR Data Team --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. --- - --- Custom with one version -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('e8b34158-3858-45c7-8e3e-d1e671dd9929', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('53619e58-2bb0-4baf-afd8-00c5d01ff8a8', 'e8b34158-3858-45c7-8e3e-d1e671dd9929', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', TRUE, FALSE, NULL, - NULL, NOW(), NOW()); - --- Custom with one draft -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('bfa79edf-00b7-4a04-b5a6-a5144f1a77b7', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('cb9f6cd7-97af-45d0-b23d-d0aab23607d8', 'bfa79edf-00b7-4a04-b5a6-a5144f1a77b7', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - - --- Custom with one version INTERNAL -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('fe98adbb-6a2c-4c7a-b2b2-a72db5140c61', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('f0a4b358-69a3-44e6-9436-c68a56a9f2f2', 'fe98adbb-6a2c-4c7a-b2b2-a72db5140c61', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'INTERNAL', NULL, NULL, 'LATEST', TRUE, FALSE, NULL, - NULL, NOW(), NOW()); - --- Custom with multiple versions -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('978e5c1c-268d-4822-b60b-07d3eccc6896', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('d7acec53-5ac9-4502-9bfa-92d1e9f79a24', '978e5c1c-268d-4822-b60b-07d3eccc6896', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('67896adc-b431-431d-8296-f0b80d8de412', '978e5c1c-268d-4822-b60b-07d3eccc6896', 'd7acec53-5ac9-4502-9bfa-92d1e9f79a24', '0.2.0', 'Custom schema', - 'Custom schema V2', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('c62d4a97-baac-40b8-b6ea-e43b06ec78bd', '978e5c1c-268d-4822-b60b-07d3eccc6896', '67896adc-b431-431d-8296-f0b80d8de412', '0.3.0', 'Custom schema', - 'Custom schema V3', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - --- Custom with draft -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('e7078309-cb4c-47b9-9ef8-057487b3da58', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('a17c25ad-e8d3-4338-bb3e-eda76d2fc32c', 'e7078309-cb4c-47b9-9ef8-057487b3da58', NULL, '0.0.0', 'Custom schema', - 'Custom schema draft', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - --- Custom with multiple versions and draft -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('fb24f92b-187f-4d53-b744-73024b537f30', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('6011adfa-f8da-478d-86ea-84bb644b458b', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', 'fb24f92b-187f-4d53-b744-73024b537f30', '0.2.0', 'Custom schema', - 'Custom schema V2', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('6b84ec86-2096-48db-bfc7-23506b8c080c', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', '6011adfa-f8da-478d-86ea-84bb644b458b', '0.0.0', 'Custom schema', - 'Custom schema draft', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - --- Custom with multiple versions and draft and extends -INSERT INTO metadata_schema (uuid, created_at, updated_at) -VALUES ('7c8b8699-ca9f-4d14-86e2-2299b27c5711', NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('4e44fb19-b9e0-46e9-957a-e7aa3adac7bf', '7c8b8699-ca9f-4d14-86e2-2299b27c5711', NULL, '0.1.0', 'Custom schema', - 'Custom schema V1', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LEGACY', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '7c8b8699-ca9f-4d14-86e2-2299b27c5711', '4e44fb19-b9e0-46e9-957a-e7aa3adac7bf', '0.2.0', 'Custom schema', - 'Custom schema V2', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'LATEST', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('1bdca611-c96e-4304-b1f3-030d282ef529', 'abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('1bdca611-c96e-4304-b1f3-030d282ef530', 'abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '123e48d2-9995-4b44-8b2c-9c81bdbf2dd2', 1); - -INSERT INTO metadata_schema_version (uuid, metadata_schema_id, previous_version_id, version, name, description, - definition, target_classes, type, origin, imported_from, state, published, - abstract, suggested_resource_name, suggested_url_prefix, created_at, updated_at) -VALUES ('a6d609ff-905f-4edd-bdb1-2dce000c9a45', '7c8b8699-ca9f-4d14-86e2-2299b27c5711', 'abcf3a21-6f9a-45dc-a71a-4dde4440c81a', '0.0.0', 'Custom schema', - 'Custom schema draft', - '', ARRAY ['http://www.w3.org/2000/01/rdf-schema#Class'], 'CUSTOM', NULL, NULL, 'DRAFT', FALSE, FALSE, NULL, - NULL, NOW(), NOW()); -INSERT INTO metadata_schema_extension (uuid, metadata_schema_version_id, extended_metadata_schema_id, order_priority) -VALUES ('53e3db46-8fe4-47ce-873e-ed7db94e73b3', 'a6d609ff-905f-4edd-bdb1-2dce000c9a45', '6a668323-3936-4b53-8380-a4fd2ed082ee', 0); From e067b091403ed0bc3fad40cd5ed9e9688f569991 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:08:40 +0100 Subject: [PATCH 19/28] allow full ant-style location patterns for populator resources this enables us to specify simple directories, specific files, filters like 'fixtures/02*.json', and wildcards like 'fixtures/**/*.json' --- .../java/org/fairdatapoint/config/BootstrapConfig.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java index d3e2d8c95..532269130 100644 --- a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java +++ b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java @@ -78,9 +78,11 @@ public Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() { log.info("Looking for db fixtures in the following locations: {}", String.join(", ", this.bootstrap.getLocations())); for (String location : this.bootstrap.getLocations()) { - // Path.of() removes trailing slashes, so it is safe to concatenate "/*.json". - // Note that Path.of(location).resolve("*.json") could work on unix but fails on windows. - resources.addAll(List.of(resourceResolver.getResources(Path.of(location) + "/*.json"))); + // Only look for JSON files. Notes: + // - Path.of() removes trailing slashes, so it is safe to concatenate "/*.json". + // - Path.of(location).resolve("*.json") could work on Unix but fails on Windows. + final String pattern = location.endsWith(".json") ? location : Path.of(location) + "/*.json"; + resources.addAll(List.of(resourceResolver.getResources(pattern))); } // remove resources that have been applied already final List appliedFixtures = fixtureHistoryRepository.findAll().stream() From 10e7a18bd9f450dcc62590e302f3e603c6266cbe Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Tue, 9 Dec 2025 17:12:22 +0100 Subject: [PATCH 20/28] adapt DatabaseBootstrapTests to use the default fixtures --- .../bootstrap/DatabaseBootstrapTests.java | 33 +++++++++++-------- .../fixtures/0100_user-accounts.json | 11 ------- .../resources/fixtures/0110_api-keys.json | 10 ------ .../fixtures/0120_saved-queries.json | 28 ---------------- ...users-with-api-keys-and-saved-queries.json | 28 ++++++++++++++++ 5 files changed, 47 insertions(+), 63 deletions(-) delete mode 100644 src/test/resources/fixtures/0100_user-accounts.json delete mode 100644 src/test/resources/fixtures/0110_api-keys.json delete mode 100644 src/test/resources/fixtures/0120_saved-queries.json diff --git a/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java b/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java index fa3f78e3d..1ec33c133 100644 --- a/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java +++ b/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java @@ -31,19 +31,19 @@ import org.fairdatapoint.entity.apikey.ApiKey; import org.fairdatapoint.entity.search.SearchSavedQuery; import org.fairdatapoint.entity.user.UserAccount; +import org.fairdatapoint.util.KnownUUIDs; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.AutoConfigureTestEntityManager; -import org.springframework.test.context.TestPropertySource; import java.util.Optional; import java.util.UUID; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; @AutoConfigureTestEntityManager @Transactional -@TestPropertySource(properties = "bootstrap.locations[0]=file:src/test/resources/fixtures") public class DatabaseBootstrapTests extends BaseIntegrationTest { @Autowired private UserAccountRepository userAccountRepository; @@ -54,28 +54,33 @@ public class DatabaseBootstrapTests extends BaseIntegrationTest { @Autowired private SearchSavedQueryRepository searchSavedQueryRepository; + private final String einsteinEmail = "albert.einstein@example.org"; + @Test public void testSingleEntityBootstrap() { - final Optional userAccount = userAccountRepository.findByEmail("john.doe@example.org"); - assertEquals(true, userAccount.isPresent()); - assertEquals("John", userAccount.get().getFirstName()); - assertEquals("Doe", userAccount.get().getLastName()); - assertEquals(UUID.fromString("e8f98d8e-0c4f-4a4b-9cc7-dd884f0c75ee"), userAccount.get().getUuid()); + final Optional userAccount = userAccountRepository.findByEmail(einsteinEmail); + assertTrue(userAccount.isPresent()); + assertEquals("Albert", userAccount.get().getFirstName()); + assertEquals("Einstein", userAccount.get().getLastName()); + assertEquals(KnownUUIDs.USER_ALBERT_UUID, userAccount.get().getUuid()); } @Test public void testRelatedEntityBootstrap() { - final Optional apiKey = apiKeyRepository.findByToken("testing-token"); - assertEquals(true, apiKey.isPresent()); - assertEquals("john.doe@example.org", apiKey.get().getUserAccount().getEmail()); - assertEquals(UUID.fromString("9d734008-91bb-47e3-97aa-2f537e67d9e6"), apiKey.get().getUuid()); + final UUID einsteinApiKeyUuid = UUID.fromString("a1c00673-24c5-4e0a-bdbe-22e961ee7548"); + final String einsteinApiKeyToken = "a274793046e34a219fd0ea6362fcca61a001500b71724f4c973a017031653c20"; + final Optional apiKey = apiKeyRepository.findByToken(einsteinApiKeyToken); + assertTrue(apiKey.isPresent()); + assertEquals(einsteinEmail, apiKey.get().getUserAccount().getEmail()); + assertEquals(einsteinApiKeyUuid, apiKey.get().getUuid()); } @Test public void testDuplicateIdEntityOverwriteBootstrap() { - final Optional savedQuery = searchSavedQueryRepository.findByUuid(UUID.fromString("4c57eff3-4608-40ae-85af-b442cfea0746")); - assertEquals(true, savedQuery.isPresent()); - assertEquals("john.doe@example.org", savedQuery.get().getUserAccount().getEmail()); + final Optional savedQuery = searchSavedQueryRepository.findByUuid( + UUID.fromString("4c57eff3-4608-40ae-85af-b442cfea0746")); + assertTrue(savedQuery.isPresent()); + assertEquals(einsteinEmail, savedQuery.get().getUserAccount().getEmail()); assertEquals("Some query 2", savedQuery.get().getName()); } } diff --git a/src/test/resources/fixtures/0100_user-accounts.json b/src/test/resources/fixtures/0100_user-accounts.json deleted file mode 100644 index 1b33940a0..000000000 --- a/src/test/resources/fixtures/0100_user-accounts.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "_class" : "org.fairdatapoint.entity.user.UserAccount", - "uuid": "e8f98d8e-0c4f-4a4b-9cc7-dd884f0c75ee", - "firstName": "John", - "lastName": "Doe", - "email": "john.doe@example.org", - "passwordHash": "$2a$10$hZF1abbZ48Tf.3RndC9W6OlDt6gnBoD/2HbzJayTs6be7d.5DbpnW", - "role": "USER" - } -] diff --git a/src/test/resources/fixtures/0110_api-keys.json b/src/test/resources/fixtures/0110_api-keys.json deleted file mode 100644 index 3a4f9bbdc..000000000 --- a/src/test/resources/fixtures/0110_api-keys.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "_class" : "org.fairdatapoint.entity.apikey.ApiKey", - "uuid": "9d734008-91bb-47e3-97aa-2f537e67d9e6", - "token": "testing-token", - "userAccount": { - "uuid": "e8f98d8e-0c4f-4a4b-9cc7-dd884f0c75ee" - } - } -] diff --git a/src/test/resources/fixtures/0120_saved-queries.json b/src/test/resources/fixtures/0120_saved-queries.json deleted file mode 100644 index 5fe68c721..000000000 --- a/src/test/resources/fixtures/0120_saved-queries.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "_class" : "org.fairdatapoint.entity.search.SearchSavedQuery", - "uuid": "4c57eff3-4608-40ae-85af-b442cfea0746", - "name": "Some query 1", - "description": "Example query", - "type": "PUBLIC", - "varPrefixes": "PREFIX dcat: ", - "varGraphPattern": "?entity rdf:type dcat:Dataset .", - "varOrdering": "ASC(?title)", - "userAccount": { - "uuid": "e8f98d8e-0c4f-4a4b-9cc7-dd884f0c75ee" - } - }, - { - "_class" : "org.fairdatapoint.entity.search.SearchSavedQuery", - "uuid": "4c57eff3-4608-40ae-85af-b442cfea0746", - "name": "Some query 2", - "description": "Example query (with same UUID as previous)", - "type": "PUBLIC", - "varPrefixes": "PREFIX dcat: ", - "varGraphPattern": "?entity rdf:type dcat:Dataset .", - "varOrdering": "ASC(?title)", - "userAccount": { - "uuid": "e8f98d8e-0c4f-4a4b-9cc7-dd884f0c75ee" - } - } -] diff --git a/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json index eb1249f67..2d2365ad4 100644 --- a/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json +++ b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json @@ -35,6 +35,7 @@ "passwordHash": "$2a$10$L.0OZ8QjV3yLhoCDvU04gu.WP1wGQih41MsBdvtQOshJJntaugBxe", "role": "ADMIN" }, + { "_class": "org.fairdatapoint.entity.apikey.ApiKey", "uuid": "a1c00673-24c5-4e0a-bdbe-22e961ee7548", @@ -51,6 +52,7 @@ "uuid": "b5b92c69-5ed9-4054-954d-0121c29b6800" } }, + { "_class" : "org.fairdatapoint.entity.search.SearchSavedQuery", "uuid": "d31e3da1-2cfa-4b55-a8cb-71d1acf01aef", @@ -89,5 +91,31 @@ "userAccount": { "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9" } + }, + { + "_class" : "org.fairdatapoint.entity.search.SearchSavedQuery", + "uuid": "4c57eff3-4608-40ae-85af-b442cfea0746", + "name": "Some query 1", + "description": "Example query", + "type": "PUBLIC", + "varPrefixes": "PREFIX dcat: ", + "varGraphPattern": "?entity rdf:type dcat:Dataset .", + "varOrdering": "ASC(?title)", + "userAccount": { + "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9" + } + }, + { + "_class" : "org.fairdatapoint.entity.search.SearchSavedQuery", + "uuid": "4c57eff3-4608-40ae-85af-b442cfea0746", + "name": "Some query 2", + "description": "Example query (with same UUID as previous)", + "type": "PUBLIC", + "varPrefixes": "PREFIX dcat: ", + "varGraphPattern": "?entity rdf:type dcat:Dataset .", + "varOrdering": "ASC(?title)", + "userAccount": { + "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9" + } } ] \ No newline at end of file From 86225f268c8821835f908b107215cef059ee1951 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Tue, 9 Dec 2025 17:55:17 +0100 Subject: [PATCH 21/28] simplify resource location pattern for Windows compatibility the Path methods caused errors on windows if the location included ':' or '*' characters --- .../org/fairdatapoint/config/BootstrapConfig.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java index 532269130..3a26265ec 100644 --- a/src/main/java/org/fairdatapoint/config/BootstrapConfig.java +++ b/src/main/java/org/fairdatapoint/config/BootstrapConfig.java @@ -38,7 +38,6 @@ import org.springframework.stereotype.Component; import java.io.IOException; -import java.nio.file.Path; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -78,11 +77,13 @@ public Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() { log.info("Looking for db fixtures in the following locations: {}", String.join(", ", this.bootstrap.getLocations())); for (String location : this.bootstrap.getLocations()) { - // Only look for JSON files. Notes: - // - Path.of() removes trailing slashes, so it is safe to concatenate "/*.json". - // - Path.of(location).resolve("*.json") could work on Unix but fails on Windows. - final String pattern = location.endsWith(".json") ? location : Path.of(location) + "/*.json"; - resources.addAll(List.of(resourceResolver.getResources(pattern))); + // Only look for JSON files + String locationPattern = location; + if (!locationPattern.endsWith(".json")) { + // naive append may lead to redundant slashes, but the OS ignores those + locationPattern += "/*.json"; + } + resources.addAll(List.of(resourceResolver.getResources(locationPattern))); } // remove resources that have been applied already final List appliedFixtures = fixtureHistoryRepository.findAll().stream() From 0dd277641675e199038728eed21c402badc3b7e4 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Wed, 10 Dec 2025 11:48:53 +0100 Subject: [PATCH 22/28] catch all exceptions in RdfMetadataMigration.runMigration (dev only) --- .../development/metadata/RdfMetadataMigration.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/fairdatapoint/database/rdf/migration/development/metadata/RdfMetadataMigration.java b/src/main/java/org/fairdatapoint/database/rdf/migration/development/metadata/RdfMetadataMigration.java index 4a6d39946..afcd88236 100644 --- a/src/main/java/org/fairdatapoint/database/rdf/migration/development/metadata/RdfMetadataMigration.java +++ b/src/main/java/org/fairdatapoint/database/rdf/migration/development/metadata/RdfMetadataMigration.java @@ -22,6 +22,7 @@ */ package org.fairdatapoint.database.rdf.migration.development.metadata; +import lombok.extern.slf4j.Slf4j; import org.fairdatapoint.api.dto.metadata.MetaStateChangeDTO; import org.fairdatapoint.database.common.migration.Migration; import org.fairdatapoint.database.db.repository.ResourceDefinitionRepository; @@ -49,6 +50,7 @@ import static org.fairdatapoint.entity.metadata.MetadataGetter.getUri; import static org.fairdatapoint.util.ValueFactoryHelper.i; +@Slf4j @Service public class RdfMetadataMigration implements Migration { @@ -104,8 +106,8 @@ public void runMigration() { // Load metadata fixtures importDefaultFixtures(persistentUrl); } - catch (MetadataServiceException exception) { - exception.printStackTrace(); + catch (Exception exception) { + log.warn("Failed to run RDF development migration:", exception); } } From a531516215e1c48cb768198dfd461a3621a1bbfc Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Wed, 10 Dec 2025 13:06:57 +0100 Subject: [PATCH 23/28] fix test data description to match user account uuid description said Nikola Tesla, but uuid was for Albert Einstein --- .../0130_test-users-with-api-keys-and-saved-queries.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json index 2d2365ad4..b0ed4238d 100644 --- a/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json +++ b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json @@ -83,7 +83,7 @@ "_class" : "org.fairdatapoint.entity.search.SearchSavedQuery", "uuid": "97da9119-834e-4687-8321-3df157547178", "name": "Things with data", - "description": "This is private query of Nikola Tesla!", + "description": "This is a private query of Albert Einstein", "type": "PRIVATE", "varPrefixes": "PREFIX dcat: ", "varGraphPattern": "?entity ?relationPredicate ?relationObject .\nFILTER isLiteral(?relationObject)\nFILTER CONTAINS(LCASE(str(?relationObject)), LCASE(\"data\"))", From 249379105061fdf0886fd6fbeed66a0399f3a54d Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Wed, 10 Dec 2025 13:08:21 +0100 Subject: [PATCH 24/28] modify testDuplicateIdEntityOverwriteBootstrap and corresponding fixture data changed uuid and type for SearchSavedQuery objects to minimize interference with the existing acceptance tests --- .../db/repository/bootstrap/DatabaseBootstrapTests.java | 2 +- .../0130_test-users-with-api-keys-and-saved-queries.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java b/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java index 1ec33c133..d078af0ad 100644 --- a/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java +++ b/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java @@ -80,7 +80,7 @@ public void testDuplicateIdEntityOverwriteBootstrap() { final Optional savedQuery = searchSavedQueryRepository.findByUuid( UUID.fromString("4c57eff3-4608-40ae-85af-b442cfea0746")); assertTrue(savedQuery.isPresent()); - assertEquals(einsteinEmail, savedQuery.get().getUserAccount().getEmail()); + assertEquals("isaac.newton@example.org", savedQuery.get().getUserAccount().getEmail()); assertEquals("Some query 2", savedQuery.get().getName()); } } diff --git a/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json index b0ed4238d..d184b9b31 100644 --- a/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json +++ b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json @@ -97,12 +97,12 @@ "uuid": "4c57eff3-4608-40ae-85af-b442cfea0746", "name": "Some query 1", "description": "Example query", - "type": "PUBLIC", + "type": "PRIVATE", "varPrefixes": "PREFIX dcat: ", "varGraphPattern": "?entity rdf:type dcat:Dataset .", "varOrdering": "ASC(?title)", "userAccount": { - "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9" + "uuid": "8d1a4c06-bb0e-4d03-a01f-14fa49bbc152" } }, { @@ -110,12 +110,12 @@ "uuid": "4c57eff3-4608-40ae-85af-b442cfea0746", "name": "Some query 2", "description": "Example query (with same UUID as previous)", - "type": "PUBLIC", + "type": "PRIVATE", "varPrefixes": "PREFIX dcat: ", "varGraphPattern": "?entity rdf:type dcat:Dataset .", "varOrdering": "ASC(?title)", "userAccount": { - "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9" + "uuid": "8d1a4c06-bb0e-4d03-a01f-14fa49bbc152" } } ] \ No newline at end of file From ce810ea916dcfa2210697fc688d652688631aaa5 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Wed, 10 Dec 2025 13:16:31 +0100 Subject: [PATCH 25/28] adapt search/query/saved test expectations to updated test data Due to the addition of DatabaseBootstrapTests, fixture 0130_test-users-with-api-keys-and-saved-queries.json now includes two new SearchSavedQuery objects. One of these new objects replaces the other, so the total number of SearchSavedQuery objects expected in the test database is increased by one. --- .../acceptance/search/query/saved/Detail_DELETE.java | 8 ++++---- .../acceptance/search/query/saved/List_GET.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/fairdatapoint/acceptance/search/query/saved/Detail_DELETE.java b/src/test/java/org/fairdatapoint/acceptance/search/query/saved/Detail_DELETE.java index cf49de7c9..5bab2be6d 100644 --- a/src/test/java/org/fairdatapoint/acceptance/search/query/saved/Detail_DELETE.java +++ b/src/test/java/org/fairdatapoint/acceptance/search/query/saved/Detail_DELETE.java @@ -70,7 +70,7 @@ public void res403_anonymousUser() { // THEN: assertThat(result.getStatusCode(), is(equalTo(HttpStatus.FORBIDDEN))); - assertThat(searchSavedQueryRepository.count(), is(equalTo(3L))); + assertThat(searchSavedQueryRepository.count(), is(equalTo(4L))); } @Test @@ -92,7 +92,7 @@ public void res403_nonOwnerUser() { // THEN: assertThat(result.getStatusCode(), is(equalTo(HttpStatus.FORBIDDEN))); - assertThat(searchSavedQueryRepository.count(), is(equalTo(3L))); + assertThat(searchSavedQueryRepository.count(), is(equalTo(4L))); } @Test @@ -114,7 +114,7 @@ public void res200_owner() { // THEN: assertThat(result.getStatusCode(), is(equalTo(HttpStatus.NO_CONTENT))); - assertThat(searchSavedQueryRepository.count(), is(equalTo(2L))); + assertThat(searchSavedQueryRepository.count(), is(equalTo(3L))); } @Test @@ -136,6 +136,6 @@ public void res200_admin() { // THEN: assertThat(result.getStatusCode(), is(equalTo(HttpStatus.NO_CONTENT))); - assertThat(searchSavedQueryRepository.count(), is(equalTo(2L))); + assertThat(searchSavedQueryRepository.count(), is(equalTo(3L))); } } diff --git a/src/test/java/org/fairdatapoint/acceptance/search/query/saved/List_GET.java b/src/test/java/org/fairdatapoint/acceptance/search/query/saved/List_GET.java index 90f4ea1b0..fd650b5dc 100644 --- a/src/test/java/org/fairdatapoint/acceptance/search/query/saved/List_GET.java +++ b/src/test/java/org/fairdatapoint/acceptance/search/query/saved/List_GET.java @@ -155,7 +155,7 @@ public void res200_admin() { // THEN: assertThat(result.getStatusCode(), is(equalTo(HttpStatus.OK))); List body = result.getBody(); - assertThat(body.size(), is(equalTo(3))); + assertThat(body.size(), is(equalTo(4))); assertThat(body.get(0).getUuid(), is(equalTo(q1.getUuid()))); assertThat(body.get(1).getUuid(), is(equalTo(q2.getUuid()))); assertThat(body.get(2).getUuid(), is(equalTo(q3.getUuid()))); From 79cde975f80149dbf0fa9dbef4e3153df10a33f5 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Wed, 10 Dec 2025 13:39:17 +0100 Subject: [PATCH 26/28] revert default user emails from example.org to example.com Although I prefer .org, existing docs and tests expect .com. Also it will likely lead to confusion because people will keep trying to log in using the .com addresses. --- fixtures/0100_user-accounts.json | 4 ++-- .../db/repository/bootstrap/DatabaseBootstrapTests.java | 4 ++-- .../0130_test-users-with-api-keys-and-saved-queries.json | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fixtures/0100_user-accounts.json b/fixtures/0100_user-accounts.json index 4b5f3d3b1..14a3bd05f 100644 --- a/fixtures/0100_user-accounts.json +++ b/fixtures/0100_user-accounts.json @@ -4,7 +4,7 @@ "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9", "firstName": "Albert", "lastName": "Einstein", - "email": "albert.einstein@example.org", + "email": "albert.einstein@example.com", "passwordHash": "$2a$10$hZF1abbZ48Tf.3RndC9W6OlDt6gnBoD/2HbzJayTs6be7d.5DbpnW", "role": "ADMIN" }, @@ -13,7 +13,7 @@ "uuid": "b5b92c69-5ed9-4054-954d-0121c29b6800", "firstName": "Nikola", "lastName": "Tesla", - "email": "nikola.tesla@example.org", + "email": "nikola.tesla@example.com", "passwordHash": "$2a$10$tMbZUZg9AbYL514R.hZ0tuzvfZJR5NQhSVeJPTQhNwPf6gv/cvrna", "role": "USER" } diff --git a/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java b/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java index d078af0ad..ec1c50517 100644 --- a/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java +++ b/src/test/java/org/fairdatapoint/database/db/repository/bootstrap/DatabaseBootstrapTests.java @@ -54,7 +54,7 @@ public class DatabaseBootstrapTests extends BaseIntegrationTest { @Autowired private SearchSavedQueryRepository searchSavedQueryRepository; - private final String einsteinEmail = "albert.einstein@example.org"; + private final String einsteinEmail = "albert.einstein@example.com"; @Test public void testSingleEntityBootstrap() { @@ -80,7 +80,7 @@ public void testDuplicateIdEntityOverwriteBootstrap() { final Optional savedQuery = searchSavedQueryRepository.findByUuid( UUID.fromString("4c57eff3-4608-40ae-85af-b442cfea0746")); assertTrue(savedQuery.isPresent()); - assertEquals("isaac.newton@example.org", savedQuery.get().getUserAccount().getEmail()); + assertEquals("isaac.newton@example.com", savedQuery.get().getUserAccount().getEmail()); assertEquals("Some query 2", savedQuery.get().getName()); } } diff --git a/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json index d184b9b31..a58ae0af3 100644 --- a/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json +++ b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json @@ -4,7 +4,7 @@ "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9", "firstName": "Albert", "lastName": "Einstein", - "email": "albert.einstein@example.org", + "email": "albert.einstein@example.com", "passwordHash": "$2a$10$hZF1abbZ48Tf.3RndC9W6OlDt6gnBoD/2HbzJayTs6be7d.5DbpnW", "role": "USER" }, @@ -13,7 +13,7 @@ "uuid": "b5b92c69-5ed9-4054-954d-0121c29b6800", "firstName": "Nikola", "lastName": "Tesla", - "email": "nikola.tesla@example.org", + "email": "nikola.tesla@example.com", "passwordHash": "$2a$10$tMbZUZg9AbYL514R.hZ0tuzvfZJR5NQhSVeJPTQhNwPf6gv/cvrna", "role": "USER" }, @@ -22,7 +22,7 @@ "uuid": "8d1a4c06-bb0e-4d03-a01f-14fa49bbc152", "firstName": "Isaac", "lastName": "Newton", - "email": "isaac.newton@example.org", + "email": "isaac.newton@example.com", "passwordHash": "$2a$10$DLkI7NAZDzWVaKG1lVtloeoPNLPoAgDDBqQKQiSAYDZXrf2QKkuHC", "role": "USER" }, @@ -31,7 +31,7 @@ "uuid": "95589e50-d261-492b-8852-9324e9a66a42", "firstName": "Admin", "lastName": "von Universe", - "email": "admin@example.org", + "email": "admin@example.com", "passwordHash": "$2a$10$L.0OZ8QjV3yLhoCDvU04gu.WP1wGQih41MsBdvtQOshJJntaugBxe", "role": "ADMIN" }, From 65f641f8400cec998d263003613669f6a7d66618 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Wed, 10 Dec 2025 13:49:54 +0100 Subject: [PATCH 27/28] adapt order of test users to match the original expectation --- ...-users-with-api-keys-and-saved-queries.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json index a58ae0af3..a7d28cf9b 100644 --- a/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json +++ b/src/test/resources/test-fixtures/0130_test-users-with-api-keys-and-saved-queries.json @@ -1,4 +1,13 @@ [ + { + "_class": "org.fairdatapoint.entity.user.UserAccount", + "uuid": "95589e50-d261-492b-8852-9324e9a66a42", + "firstName": "Admin", + "lastName": "von Universe", + "email": "admin@example.com", + "passwordHash": "$2a$10$L.0OZ8QjV3yLhoCDvU04gu.WP1wGQih41MsBdvtQOshJJntaugBxe", + "role": "ADMIN" + }, { "_class": "org.fairdatapoint.entity.user.UserAccount", "uuid": "7e64818d-6276-46fb-8bb1-732e6e09f7e9", @@ -26,15 +35,6 @@ "passwordHash": "$2a$10$DLkI7NAZDzWVaKG1lVtloeoPNLPoAgDDBqQKQiSAYDZXrf2QKkuHC", "role": "USER" }, - { - "_class": "org.fairdatapoint.entity.user.UserAccount", - "uuid": "95589e50-d261-492b-8852-9324e9a66a42", - "firstName": "Admin", - "lastName": "von Universe", - "email": "admin@example.com", - "passwordHash": "$2a$10$L.0OZ8QjV3yLhoCDvU04gu.WP1wGQih41MsBdvtQOshJJntaugBxe", - "role": "ADMIN" - }, { "_class": "org.fairdatapoint.entity.apikey.ApiKey", From 2341d09cf5fc394f4e468fc61604fae1e4631020 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Wed, 10 Dec 2025 13:57:52 +0100 Subject: [PATCH 28/28] repopulate test database after flyway.clean in ResourceDefinitionCacheTest --- .../service/resource/ResourceDefinitionCacheTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/java/org/fairdatapoint/service/resource/ResourceDefinitionCacheTest.java b/src/test/java/org/fairdatapoint/service/resource/ResourceDefinitionCacheTest.java index 4800c2d54..07db33f84 100644 --- a/src/test/java/org/fairdatapoint/service/resource/ResourceDefinitionCacheTest.java +++ b/src/test/java/org/fairdatapoint/service/resource/ResourceDefinitionCacheTest.java @@ -32,6 +32,9 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; +import org.springframework.data.repository.init.ResourceReaderRepositoryPopulator; +import org.springframework.data.repository.support.Repositories; import org.springframework.test.context.ActiveProfiles; import static org.hamcrest.MatcherAssert.assertThat; @@ -53,10 +56,18 @@ public class ResourceDefinitionCacheTest extends BaseIntegrationTest { @Autowired protected Flyway flyway; + @Autowired + private ApplicationContext applicationContext; + + @Autowired + private ResourceReaderRepositoryPopulator populator; + @BeforeEach public void setup() { flyway.clean(); flyway.migrate(); + // re-populate the database using default fixtures + populator.populate(new Repositories(applicationContext)); } @Test