From 04141fe259c3a2af46a1e69946a4381727d01592 Mon Sep 17 00:00:00 2001 From: Alessia Bardi Date: Fri, 19 May 2023 14:28:24 +0200 Subject: [PATCH] tests for records from D4Science catalogues --- .../dnetlib/dhp/oa/graph/raw/MappersTest.java | 17 +++++ .../eu/dnetlib/dhp/oa/graph/raw/d4science.xml | 70 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/d4science.xml diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/raw/MappersTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/raw/MappersTest.java index 4c488a894..bfd6d461d 100644 --- a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/raw/MappersTest.java +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/raw/MappersTest.java @@ -1007,6 +1007,23 @@ class MappersTest { }); } + @Test + void testD4Science() throws IOException { + final String xml = IOUtils + .toString(Objects.requireNonNull(getClass().getResourceAsStream("d4science.xml"))); + final List actual = new OdfToOafMapper(vocs, false, true).processMdRecord(xml); + assertNotNull(actual); + assertFalse(actual.isEmpty()); + System.out.println("***************"); + System.out.println(new ObjectMapper().writeValueAsString(actual)); + System.out.println("***************"); + final Dataset d = (Dataset) actual.get(0); + assertValidId(d.getId()); + assertTrue(StringUtils.isNotBlank(d.getTitle().get(0).getValue())); + + } + + private void assertValidId(final String id) { // System.out.println(id); diff --git a/dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/d4science.xml b/dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/d4science.xml new file mode 100644 index 000000000..d202016fa --- /dev/null +++ b/dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/d4science.xml @@ -0,0 +1,70 @@ + + + + alessia_____::028879484548f4e1c630e1c503e35231 + 4fed018e-c2ff-4afa-b7b5-1ca1beebf850 + 2023-03-17T13:30:02.026+01:00 + alessia_____ + 2023-05-19T14:07:51.701+02:00 + + + + http://data.d4science.org/ctlg/ResourceCatalogue/city-to-city_migration + + + + Pappalardo, Luca + + 0000-0002-1547-6007 + + + + City-to-city migration + + SoBigData++ + + + 2018-02-15 10:05 + + Dataset + + Census data recording the migration of people between metropolitan areas in + the US + + + Human Mobility data + + + + OPEN + 0021 + 2018-02-15 10:05 + + + AFL-3.0 + corda__h2020::871042 + + + + + https%3A%2F%2Fapi.d4science.org%2Fcatalogue%2Fitems + + + + + + + false + false + 0.9 + + + + + \ No newline at end of file