From b348366873f12eca6a34a9dbbbac5d93f99ca3ee Mon Sep 17 00:00:00 2001 From: Enrico Ottonello Date: Mon, 18 Jul 2022 16:39:34 +0200 Subject: [PATCH] added path method to fix ADS overwritten collections on public portal --- .../GraphDbReaderAndESIndexTest.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java b/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java index 3855b2a..63b6664 100644 --- a/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java +++ b/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java @@ -18,6 +18,7 @@ import org.junit.Test; import org.springframework.core.io.ClassPathResource; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Properties; @@ -427,6 +428,58 @@ public class GraphDbReaderAndESIndexTest { readAndIndexTest(isRecord, recordId, datasource, collectionId); } + private class CollectionData { + String URI_ID; + String id; + + public CollectionData(String URI_ID, String id) { + this.URI_ID = URI_ID; + this.id = id; + } + } + + // used only once to fix overwritten ADS collections + private void fixPublicADSCollections() throws Exception { + boolean isRecord = false; + String datasource = "ads"; + List collectionToFix = Arrays.asList( + new CollectionData("AAA81A6D-56F3-341C-BAF0-791C31BC7F73", "398"), + new CollectionData("B6AF6572-6CF5-3EEE-A6CD-778FD975903A", "1785"), + new CollectionData("61CC3C06-21FE-3983-93B7-7ADE3535C59A", "1787"), + new CollectionData("F8FAC6C9-8E3D-355C-83E5-B162FC005EC2", "1788"), + new CollectionData("C2BC1925-493E-3047-858E-A720403D1F68", "324"), + new CollectionData("55B8D842-F80A-3841-9A4B-36F714D438BC", "1054"), + new CollectionData("5DE1B42A-6A52-3164-A1F3-E17BD6A2D082", "272_event"), + new CollectionData("F350D267-D463-33DE-883B-3561AA523168", "304"), + new CollectionData("F31C1473-3527-3C56-9801-F833D3C26A70", "3"), + new CollectionData("DE1A5A67-F32D-318B-808B-4457B1EF329F", "1957"), + new CollectionData("BB5172FB-55D2-3E6F-B03B-78B9A4B595BA", "1970"), + new CollectionData("8F4CA5AD-2339-3FED-89BB-F97291DDDC99", "270"), + new CollectionData("D52279BD-4C39-3682-9BFB-9BC7D0CD9D7F", "397"), + new CollectionData("57DB9A00-5856-3120-BE2A-2FFBD253CA04", "328"), + new CollectionData("80BF2F63-5448-3C38-BF89-A38DBC4AFB3E", "292"), + new CollectionData("58114087-BD7B-3ECC-9B46-A48C8BB36F6C", "858"), + new CollectionData("E0B88506-0A29-392B-8FDF-E7D7FDA2412B", "321"), + new CollectionData("C27CDB2E-CC18-3028-96C4-A13C1BC46044", "367"), + new CollectionData("849B1C0F-4C5F-3D8C-9082-CA60DBB4F557", "271"), + new CollectionData("95EDB084-6566-39E6-AFC2-82CC3F7B70D2", "420_event"), + new CollectionData("F68EC4F0-C6DF-3013-B749-AF75A929A3EB", "4"), + new CollectionData("F18A0D06-2A86-334A-AA1E-046E32A34327", "836"), + new CollectionData("EFE699F4-F42D-36AC-8CA2-24AD5F0B9307", "1972") + ); + + collectionToFix.forEach(data -> { + String prefix = "https://ariadne-infrastructure.eu/aocat/Collection/ADS/"; + String collectionIdURI = prefix.concat(data.URI_ID); + try { + readAndIndexTest(isRecord, collectionIdURI, datasource, data.id); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + }); + } + private void readAndIndexTest(boolean isRecord, String recordId, String datasource, String collectionId) throws Exception { final ClassPathResource resource = new ClassPathResource("application.properties"); Properties appProps = new Properties();