From e1149eb5c482208f2e462ce46e364ac4590e4fe6 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Mon, 25 Mar 2024 15:01:42 +0100 Subject: [PATCH] xslt rules and tests --- .../base/xml/base2oaf.transformationRule.xml | 2 ++ .../base/xml/base2odf.transformationRule.xml | 5 +++ .../plugin/base/BaseTransfomationTest.java | 17 +++++++++ .../collection/plugin/base/record_wrong_1.xml | 36 +++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/collection/plugin/base/record_wrong_1.xml diff --git a/dhp-workflows/dhp-aggregation/src/main/resources/eu/dnetlib/dhp/collection/plugin/base/xml/base2oaf.transformationRule.xml b/dhp-workflows/dhp-aggregation/src/main/resources/eu/dnetlib/dhp/collection/plugin/base/xml/base2oaf.transformationRule.xml index 201e5c3632..a49687e3ad 100644 --- a/dhp-workflows/dhp-aggregation/src/main/resources/eu/dnetlib/dhp/collection/plugin/base/xml/base2oaf.transformationRule.xml +++ b/dhp-workflows/dhp-aggregation/src/main/resources/eu/dnetlib/dhp/collection/plugin/base/xml/base2oaf.transformationRule.xml @@ -303,7 +303,9 @@ base_dc:link (I used dc:identifier) + CLOSED OPEN + UNKNOWN diff --git a/dhp-workflows/dhp-aggregation/src/main/resources/eu/dnetlib/dhp/collection/plugin/base/xml/base2odf.transformationRule.xml b/dhp-workflows/dhp-aggregation/src/main/resources/eu/dnetlib/dhp/collection/plugin/base/xml/base2odf.transformationRule.xml index 407c51015d..0e0e41f129 100644 --- a/dhp-workflows/dhp-aggregation/src/main/resources/eu/dnetlib/dhp/collection/plugin/base/xml/base2odf.transformationRule.xml +++ b/dhp-workflows/dhp-aggregation/src/main/resources/eu/dnetlib/dhp/collection/plugin/base/xml/base2odf.transformationRule.xml @@ -178,6 +178,9 @@ + + restricted access + open access @@ -341,7 +344,9 @@ + CLOSED OPEN + UNKNOWN diff --git a/dhp-workflows/dhp-aggregation/src/test/java/eu/dnetlib/dhp/collection/plugin/base/BaseTransfomationTest.java b/dhp-workflows/dhp-aggregation/src/test/java/eu/dnetlib/dhp/collection/plugin/base/BaseTransfomationTest.java index 2bbd871178..6c0c23922f 100644 --- a/dhp-workflows/dhp-aggregation/src/test/java/eu/dnetlib/dhp/collection/plugin/base/BaseTransfomationTest.java +++ b/dhp-workflows/dhp-aggregation/src/test/java/eu/dnetlib/dhp/collection/plugin/base/BaseTransfomationTest.java @@ -1,6 +1,8 @@ package eu.dnetlib.dhp.collection.plugin.base; +import static org.junit.jupiter.api.Assertions.assertThrows; + import java.io.IOException; import org.apache.commons.io.IOUtils; @@ -63,6 +65,21 @@ public class BaseTransfomationTest extends AbstractVocabularyTest { System.out.println(result.getBody()); } + @Test + void testBase2ODF_wrong_date() throws Exception { + + final MetadataRecord mr = new MetadataRecord(); + mr.setProvenance(new Provenance("DSID", "DSNAME", "PREFIX")); + mr.setBody(IOUtils.toString(getClass().getResourceAsStream("record_wrong_1.xml"))); + + final XSLTTransformationFunction tr = loadTransformationRule("xml/base2oaf.transformationRule.xml"); + + assertThrows(NullPointerException.class, () -> { + final MetadataRecord result = tr.call(mr); + System.out.println(result.getBody()); + }); + } + private XSLTTransformationFunction loadTransformationRule(final String path) throws Exception { final String xslt = new SAXReader() .read(this.getClass().getResourceAsStream(path)) diff --git a/dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/collection/plugin/base/record_wrong_1.xml b/dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/collection/plugin/base/record_wrong_1.xml new file mode 100644 index 0000000000..f6dccc006e --- /dev/null +++ b/dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/collection/plugin/base/record_wrong_1.xml @@ -0,0 +1,36 @@ + + +
+ ftunivminnesdc:oai:conservancy.umn.edu:11299/109914 + 2023-07-18T20:05:40Z +
+ + + ftunivminnesdc:oai:conservancy.umn.edu:11299/109914 + cna + us + ftunivminnesdc + University of Minnesota Digital Conservancy + An Experimental Investigation of the influence of an air bubble layer on radiated noise and surface pressure fluctuations in a turbulent boundary layer + Killen, John M. + Boundary layer noise + Kinetic energy dissipation + Air bubble layer + Maximum stable bubble size + bubble noise spectra + between the noise spectra of a layer of air bubbles in a turbulent flow and' a maximum stable bubble size which can exist in the same flow. An air bubbie layer with individual bubble sizes greater than a maximum stable size was introduced into the boundary layer of water flowing along a smooth flat plate. It was found that the maximum stable bubble size was related to the turbulent kinetic energy dissipation as had been previously shown by other investigators ; Office of Naval Research Arlington, Virginia 22217 + 1981-09-31T21:42:52Z + 1981 + Report + 14 + http://purl.umn.edu/109914 + http://purl.umn.edu/109914 + en_US + Project Reports + 202 + http://purl.umn.edu/109914 + 2 + eng + + +
\ No newline at end of file