From 937ff6a7c77fa6422463471d8f3aff9c22ff775b Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Tue, 31 Oct 2023 15:56:08 +0100 Subject: [PATCH] - --- .../dhp/api/QueryCommunityAPITest.java | 119 ------------------ .../dnetlib/dhp/bulktag/BulkTagJobTest.java | 2 - 2 files changed, 121 deletions(-) delete mode 100644 dhp-workflows/dhp-enrichment/src/test/java/eu/dnetlib/dhp/api/QueryCommunityAPITest.java diff --git a/dhp-workflows/dhp-enrichment/src/test/java/eu/dnetlib/dhp/api/QueryCommunityAPITest.java b/dhp-workflows/dhp-enrichment/src/test/java/eu/dnetlib/dhp/api/QueryCommunityAPITest.java deleted file mode 100644 index 6ee01a6f0..000000000 --- a/dhp-workflows/dhp-enrichment/src/test/java/eu/dnetlib/dhp/api/QueryCommunityAPITest.java +++ /dev/null @@ -1,119 +0,0 @@ - -package eu.dnetlib.dhp.api; - -import java.util.List; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import eu.dnetlib.dhp.api.QueryCommunityAPI; -import eu.dnetlib.dhp.api.Utils; -import eu.dnetlib.dhp.api.model.CommunityEntityMap; -import eu.dnetlib.dhp.api.model.CommunityModel; -import eu.dnetlib.dhp.api.model.CommunitySummary; -import eu.dnetlib.dhp.api.model.DatasourceList; -import eu.dnetlib.dhp.bulktag.community.Community; -import eu.dnetlib.dhp.bulktag.community.CommunityConfiguration; - -/** - * @author miriam.baglioni - * @Date 06/10/23 - */ -public class QueryCommunityAPITest { - - @Test - void communityList() throws Exception { - String body = QueryCommunityAPI.communities(true); - new ObjectMapper() - .readValue(body, CommunitySummary.class) - .forEach(p -> { - try { - System.out.println(new ObjectMapper().writeValueAsString(p)); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } - }); - } - - @Test - void community() throws Exception { - String id = "dh-ch"; - String body = QueryCommunityAPI.community(id, true); - System.out - .println( - new ObjectMapper() - .writeValueAsString( - new ObjectMapper() - .readValue(body, CommunityModel.class))); - } - - @Test - void communityDatasource() throws Exception { - String id = "dh-ch"; - String body = QueryCommunityAPI.communityDatasource(id, true); - new ObjectMapper() - .readValue(body, DatasourceList.class) - .forEach(ds -> { - try { - System.out.println(new ObjectMapper().writeValueAsString(ds)); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } - }); - ; - } - - @Test - void validCommunities() throws Exception { - CommunityConfiguration cc = Utils.getCommunityConfiguration(true); - System.out.println(cc.getCommunities().keySet()); - Community community = cc.getCommunities().get("aurora"); - Assertions.assertEquals(0, community.getSubjects().size()); - Assertions.assertEquals(null, community.getConstraints()); - Assertions.assertEquals(null, community.getRemoveConstraints()); - Assertions.assertEquals(2, community.getZenodoCommunities().size()); - Assertions - .assertTrue( - community.getZenodoCommunities().stream().anyMatch(c -> c.equals("aurora-universities-network"))); - Assertions - .assertTrue(community.getZenodoCommunities().stream().anyMatch(c -> c.equals("university-of-innsbruck"))); - Assertions.assertEquals(35, community.getProviders().size()); - Assertions - .assertEquals( - 35, community.getProviders().stream().filter(p -> p.getSelectionConstraints() == null).count()); - - } - - @Test - void eutopiaCommunityConfiguration() throws Exception { - CommunityConfiguration cc = Utils.getCommunityConfiguration(true); - System.out.println(cc.getCommunities().keySet()); - Community community = cc.getCommunities().get("eutopia"); - community.getProviders().forEach(p -> System.out.println(p.getOpenaireId())); - } - - @Test - void getCommunityProjects() throws Exception { - CommunityEntityMap projectMap = Utils.getCommunityProjects(true); - - Assertions - .assertTrue( - projectMap - .keySet() - .stream() - .allMatch(k -> k.startsWith("40|"))); - - System.out.println(projectMap); - } - - @Test - void getCommunityOrganizations() throws Exception { - CommunityEntityMap organizationMap = Utils.getCommunityOrganization(true); - Assertions.assertTrue(organizationMap.keySet().stream().allMatch(k -> k.startsWith("20|"))); - - } - -} diff --git a/dhp-workflows/dhp-enrichment/src/test/java/eu/dnetlib/dhp/bulktag/BulkTagJobTest.java b/dhp-workflows/dhp-enrichment/src/test/java/eu/dnetlib/dhp/bulktag/BulkTagJobTest.java index 5e106ef45..d02faedec 100644 --- a/dhp-workflows/dhp-enrichment/src/test/java/eu/dnetlib/dhp/bulktag/BulkTagJobTest.java +++ b/dhp-workflows/dhp-enrichment/src/test/java/eu/dnetlib/dhp/bulktag/BulkTagJobTest.java @@ -32,8 +32,6 @@ public class BulkTagJobTest { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); - public static final String MOCK_IS_LOOK_UP_URL = "BASEURL:8280/is/services/isLookUp"; - public static final String pathMap = "{ \"author\" : \"$['author'][*]['fullname']\"," + " \"title\" : \"$['title'][*]['value']\"," + " \"orcid\" : \"$['author'][*]['pid'][*][?(@['key']=='ORCID')]['value']\","