From 1871287831214c4767a8ee1d225685e71cf164bc Mon Sep 17 00:00:00 2001 From: Jan Dvorak Date: Sat, 9 Dec 2023 16:43:46 +0100 Subject: [PATCH 1/2] Make the (URL) constructor protected (#12) --- .../org/eurocris/openaire/cris/validator/CRISValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/eurocris/openaire/cris/validator/CRISValidator.java b/src/main/java/org/eurocris/openaire/cris/validator/CRISValidator.java index 1164be8..f08ba1b 100644 --- a/src/main/java/org/eurocris/openaire/cris/validator/CRISValidator.java +++ b/src/main/java/org/eurocris/openaire/cris/validator/CRISValidator.java @@ -196,7 +196,7 @@ public CRISValidator() throws MissingArgumentException, SAXException, IOExceptio * @throws IOException on a problem accessing a schema * @throws ParserConfigurationException when an XML parser cannot be instantiated */ - public CRISValidator( final URL endpointBaseUrl ) throws SAXException, IOException, ParserConfigurationException { + protected CRISValidator( final URL endpointBaseUrl ) throws SAXException, IOException, ParserConfigurationException { if ( endpoint == null || ! endpointBaseUrl.toExternalForm().equals( endpoint.getBaseUrl() ) ) { endpoint = new OAIPMHEndpoint( endpointBaseUrl, getParserSchema(), CONN_STREAM_FACTORY ); metadataFormatsByPrefix.clear(); From 2f7f16d83677ba4773058eca1c3c2beeb5f57bf7 Mon Sep 17 00:00:00 2001 From: Jan Dvorak Date: Sat, 9 Dec 2023 16:44:47 +0100 Subject: [PATCH 2/2] Adapt the tests to having the CRISValidator(URL) protected (#12) --- .../metadataTests/CRISValidator.java | 27 +++++++++++++++++++ .../metadataTests/MetadataFormatTest.java | 1 - 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/test/java/org/eurocris/openaire/cris/validator/metadataTests/CRISValidator.java diff --git a/src/test/java/org/eurocris/openaire/cris/validator/metadataTests/CRISValidator.java b/src/test/java/org/eurocris/openaire/cris/validator/metadataTests/CRISValidator.java new file mode 100644 index 0000000..99b1a6b --- /dev/null +++ b/src/test/java/org/eurocris/openaire/cris/validator/metadataTests/CRISValidator.java @@ -0,0 +1,27 @@ +package org.eurocris.openaire.cris.validator.metadataTests; + +import java.io.IOException; +import java.net.URL; + +import javax.xml.parsers.ParserConfigurationException; + +import org.xml.sax.SAXException; + +/** + * Adapting {@link org.eurocris.openaire.cris.validator.CRISValidator} for usage in this package. + * Just inheriting the protected constructor is needed. + */ +public class CRISValidator extends org.eurocris.openaire.cris.validator.CRISValidator { + + /** + * A simple call to {@link org.eurocris.openaire.cris.validator.CRISValidator#CRISValidator( URL )}. + * @param endpointBaseUrl + * @throws SAXException + * @throws IOException + * @throws ParserConfigurationException + */ + protected CRISValidator(URL endpointBaseUrl) throws SAXException, IOException, ParserConfigurationException { + super( endpointBaseUrl ); + } + +} diff --git a/src/test/java/org/eurocris/openaire/cris/validator/metadataTests/MetadataFormatTest.java b/src/test/java/org/eurocris/openaire/cris/validator/metadataTests/MetadataFormatTest.java index 1253d5b..c49f714 100644 --- a/src/test/java/org/eurocris/openaire/cris/validator/metadataTests/MetadataFormatTest.java +++ b/src/test/java/org/eurocris/openaire/cris/validator/metadataTests/MetadataFormatTest.java @@ -5,7 +5,6 @@ import java.net.URL; -import org.eurocris.openaire.cris.validator.CRISValidator; import org.junit.Test; /**