list of ids to purge because duplicates in the gateway

This commit is contained in:
Alessia Bardi 2020-07-02 16:01:24 +02:00
parent 0c9539a301
commit 3600d39f96
1 changed files with 69 additions and 2 deletions

View File

@ -6,7 +6,9 @@ import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.List;
import com.google.common.collect.Lists;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.http.HttpStatus; import org.apache.http.HttpStatus;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
@ -20,7 +22,7 @@ import eu.dnetlib.dhp.oa.graph.dump.gcat.GCatAPIClient;
* NEVER EVER ENABLE THIS CLASS UNLESS YOU ABSOLUTELY KNOW WHAT YOU ARE DOING: with the proper parameters set it can * NEVER EVER ENABLE THIS CLASS UNLESS YOU ABSOLUTELY KNOW WHAT YOU ARE DOING: with the proper parameters set it can
* dropped a D4Science Catalogue * dropped a D4Science Catalogue
*/ */
//@Disabled @Disabled
public class GCatAPIClientTest { public class GCatAPIClientTest {
private static GCatAPIClient client; private static GCatAPIClient client;
@ -28,7 +30,7 @@ public class GCatAPIClientTest {
@BeforeAll @BeforeAll
public static void setup() { public static void setup() {
client = new GCatAPIClient(); client = new GCatAPIClient();
client.setApplicationToken("816486a3-60a9-4ecc-a7e0-a96740a90207-843339462"); client.setApplicationToken("");
client.setGcatBaseURL("https://gcat.d4science.org/gcat/"); client.setGcatBaseURL("https://gcat.d4science.org/gcat/");
} }
@ -133,4 +135,69 @@ public class GCatAPIClientTest {
// and then drop all // and then drop all
Assertions.assertEquals(1, client.purgeAll()); Assertions.assertEquals(1, client.purgeAll());
} }
@Test
public void purgeList() throws IOException, URISyntaxException {
List<String> toPurge = Lists.newArrayList();
toPurge.add("od______3379--50842bb0a03d644a6ed831c0a59d25f4");
toPurge.add("od_______177--50842bb0a03d644a6ed831c0a59d25f4");
toPurge.add("od______4325--d6ad4e4111afd06f69c1597a60f09cef");
toPurge.add("od______3379--d6ad4e4111afd06f69c1597a60f09cef");
toPurge.add("od_______177--d6ad4e4111afd06f69c1597a60f09cef");
toPurge.add("od______4325--50842bb0a03d644a6ed831c0a59d25f4");
toPurge.add("od______4325--b823dc448d06160da67ebdcd1a67c544");
toPurge.add("od_______177--b823dc448d06160da67ebdcd1a67c544");
toPurge.add("od______1106--7407d45261b901f936319762b30a66f0");
toPurge.add("od______3379--b823dc448d06160da67ebdcd1a67c544");
toPurge.add("od______4325--655f1b9517a0dd16efd05b572f66927b");
toPurge.add("od______3379--655f1b9517a0dd16efd05b572f66927b");
toPurge.add("od_______177--655f1b9517a0dd16efd05b572f66927b");
toPurge.add("od______3379--308718c4498f1c857d9dec8fc8412bed");
toPurge.add("od_______177--308718c4498f1c857d9dec8fc8412bed");
toPurge.add("od______4325--308718c4498f1c857d9dec8fc8412bed");
toPurge.add("od______4325--26025853fbcb01858d58e3c268d144ce");
toPurge.add("od_______177--26025853fbcb01858d58e3c268d144ce");
toPurge.add("od______3379--4af67cb057f92a8c276c3aae56980430");
toPurge.add("od_______177--4af67cb057f92a8c276c3aae56980430");
toPurge.add("od______4325--4af67cb057f92a8c276c3aae56980430");
toPurge.add("od______3379--1c384c7771d6d5ec0b2b14264d0af8cd");
toPurge.add("od_______177--1c384c7771d6d5ec0b2b14264d0af8cd");
toPurge.add("od______4325--1c384c7771d6d5ec0b2b14264d0af8cd");
toPurge.add("od_______177--15a65e2433929cc77ae7b10fd56c1e9e");
toPurge.add("od______4325--15a65e2433929cc77ae7b10fd56c1e9e");
toPurge.add("od______3379--15a65e2433929cc77ae7b10fd56c1e9e");
toPurge.add("od_______177--c5caa1b39d9c7998f0f7c37f948ea097");
toPurge.add("od______3379--c5caa1b39d9c7998f0f7c37f948ea097");
toPurge.add("od_______177--11df09fd7a9ad36f0de546ea991182ce");
toPurge.add("od______3379--11df09fd7a9ad36f0de546ea991182ce");
toPurge.add("od______4325--11df09fd7a9ad36f0de546ea991182ce");
toPurge.add("dedup_wf_001::2fb2a1e02bfae184789181009d59232c");
toPurge.add("od_______177--39688c4bc9fd811e55f914e58701536d");
toPurge.add("od______3379--39688c4bc9fd811e55f914e58701536d");
toPurge.add("od______4325--39688c4bc9fd811e55f914e58701536d");
toPurge.add("od______4325--200c9c70dff2e86dad6ba555381027fc");
toPurge.add("od______3379--200c9c70dff2e86dad6ba555381027fc");
toPurge.add("od_______177--200c9c70dff2e86dad6ba555381027fc");
toPurge.add("od______3379--cf54f6149e7427d77dd37fccc3a0c747");
toPurge.add("od______3379--1f50518c04e2c0966425a350def1f82a");
toPurge.add("od______4325--1f50518c04e2c0966425a350def1f82a");
toPurge.add("od_______177--1f50518c04e2c0966425a350def1f82a");
toPurge.add("od______3379--bff6c5b35457f7f51d52d41323226663");
toPurge.add("od_______177--bff6c5b35457f7f51d52d41323226663");
toPurge.add("od______4325--bff6c5b35457f7f51d52d41323226663");
toPurge.add("od______2659--cbdcbe3865868c15680d95c7f83c3ff7");
toPurge.add("dedup_wf_001--569da4f719f51eb07f23548000e57d72");
toPurge.add("od_______177--bf88e4876d9c5a9720ca3fefe3ce93ea");
toPurge.add("od______3379--bf88e4876d9c5a9720ca3fefe3ce93ea");
toPurge.add("od______4325--bf88e4876d9c5a9720ca3fefe3ce93ea");
for (String name : toPurge) {
System.out.println("Purging " + name);
if (client.purge(name))
System.out.println("Purged");
else {
System.out.println("Failed");
}
}
}
} }