Coder Social home page Coder Social logo

eurocris / openaire-cris-validator Goto Github PK

View Code? Open in Web Editor NEW
7.0 6.0 4.0 348 KB

A validator tool to assess the compliance of an OAI-PMH endpoint with the OpenAIRE Guidelines for CRIS Managers 1.1 or 1.2.

License: Apache License 2.0

Java 98.69% Shell 0.87% XSLT 0.44%
openaire oai-pmh-client validation xml-schema

openaire-cris-validator's People

Contributors

acz-unibi avatar jdvorak001 avatar lap82 avatar spyroukostas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

openaire-cris-validator's Issues

IllegalArgumentException: Test class can only have one constructor

OpenAIRE CRIS Validator Version: 2.0.0
Java Version: Temurin-17.0.9+9

There seems to be a problem when running openaire-cris-validator jar:

➜  openaire-cris-validator git:(main) ✗ java -jar target/openaire-cris-validator-*-jar-with-dependencies.jar file:samples/ 

...

JUnit version 4.13.2
.E
Time: 0.003
There was 1 failure:
1) initializationError(org.eurocris.openaire.cris.validator.CRISValidator)
java.lang.IllegalArgumentException: Test class can only have one constructor
        at org.junit.runners.model.TestClass.<init>(TestClass.java:48)
        at org.junit.runners.JUnit4.<init>(JUnit4.java:23)
        at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10)
        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
        at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
        at org.junit.runner.Computer.getRunner(Computer.java:50)
        at org.junit.runner.Computer$1.runnerForClass(Computer.java:31)
        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
        at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:125)
        at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:111)
        at org.junit.runners.Suite.<init>(Suite.java:81)
        at org.junit.runner.Computer$2.<init>(Computer.java:33)
        at org.junit.runner.Computer.getSuite(Computer.java:28)
        at org.junit.runner.Request.classes(Request.java:77)
        at org.junit.runner.JUnitCommandLineParseResult.createRequest(JUnitCommandLineParseResult.java:116)
        at org.junit.runner.JUnitCore.runMain(JUnitCore.java:77)
        at org.junit.runner.JUnitCore.main(JUnitCore.java:36)
        at org.eurocris.openaire.cris.validator.CRISValidator.main(CRISValidator.java:167)

FAILURES!!!
Tests run: 1,  Failures: 1

Steps To Reproduce

  1. mvn clean package
  2. java -jar target/openaire-cris-validator-*-jar-with-dependencies.jar file:samples/

Works fine after replacing constructor public CRISValidator( final URL endpointBaseUrl ).

SAXParseException on fetching records

When running the validator on our OpenAIRE endpoint in Narcis, we get a org.xml.sax.SAXParseException on the tests for check400_CheckPersons, check500_CheckOrgUnits and check600_CheckProjects. Listed below is an example input, as well as the error message that is outputed by the validator.

However, if we go back to commit 6fcb5ff (which is the one before you introduced strict mode on the validator), the XML parsing is done successfully. Every commit after, up to the current master, will fail on the aforementioned tests with the same exception.

example input:

<?xml version="1.0" encoding="UTF-8"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
   <responseDate>2018-11-07T14:26:30Z</responseDate>
   <request metadataPrefix="oai_cerif_openaire" verb="ListRecords">http://oai.narcis.nl/cerif</request>
   <ListRecords>
      <record>
         <header>
            <identifier>oai:narcis.nl:OrgUnits/ORG1236019</identifier>
            <datestamp>2018-10-18T07:49:33Z</datestamp>
            <setSpec>openaire_cris_orgunits</setSpec>
         </header>
         <metadata>
            <OrgUnit xmlns="https://www.openaire.eu/cerif-profile/1.1/" id="ORG1236019">
               <Naam xml:lang="nl">test naam</Naam>
               <Naam xml:lang="en">test name</Naam>
               <ElectronicAddress>tel:+31-123-456789</ElectronicAddress>
               <ElectronicAddress>fax:+31-987-654321</ElectronicAddress>
               <ElectronicAddress>mailto:[email protected]</ElectronicAddress>
               <ElectronicAddress>url:http://www.example.com</ElectronicAddress>
            </OrgUnit>
         </metadata>
         <about>
            <provenance xmlns="http://www.openarchives.org/OAI/2.0/provenance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/provenance http://www.openarchives.org/OAI/2.0/provenance.xsd">
               <originDescription harvestDate="2018-10-18T09:49:32Z" altered="true">
                  <baseURL>http://tnarcis01.dans.knaw.nl/nodserver-0.0.1/nodbrug</baseURL>
                  <identifier>ORG1236019</identifier>
                  <datestamp>2003-07-02</datestamp>
                  <metadataNamespace>http://www.onderzoekinformatie.nl/nod/org</metadataNamespace>
               </originDescription>
            </provenance>
         </about>
      </record>
   </ListRecords>
</OAI-PMH>

validator error message:

[org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 76; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'provenance'.]

Update JAVA 8 basis to a newer JAVA LTS

Dear,

JAVA 8 with Long-Term-Support (LTS) was generally available in March 2014 and the Premier Support ended this month (March 2022). The extended support is mentioned until December 2030 with *****.

***** The Extended Support uplift fee will be waived for the period June 2019 - July 2022 for Java SE 7. The Extended Support uplift fee will be waived for the period March 2022 - December 2030 for Java SE 8. During this period, you will receive Extended Support as described in the Oracle Technical Support Level sections of the Technical Support Policies.

My intention would be to replace the JAVA 8 version with a newer LTS version (e.g. 11,17), in order to be able to

  • to use newer components, like newer TLS support
  • to react to security vulnerabilities and their dependencies if necessary
  • improvement of performance, would be nice if it happens

The full JAVA SE support roadmap could be found at: https://www.oracle.com/java/technologies/java-se-support-roadmap.html

I'm looking forward to your feedback.

Best, Andreas

Validator fails on ORCID validation

When running the latest version of the validator, I get the error below. For some reason it isn't expecting the <ORCID> here. However, when I look in the specs, I clearly see that <ORCID> is allowed. Also, when looking in the examples I see an <ORCID> in there as well.

See below for the input record that fails in the validator. For obvious reasons I have obviscated the actual data here. However, I have already checked that url given in <ORCID> matches the regular expression listed in the specs.

What I find interesting is that the error message says that it only expects one of four elements (ElectronicAddress, Affiliation, Classification and Link), while the specs contain more elements and don't include the expected element Link.

error message

While validating element Person[@id="PRSxxxxxxx"]: org.xml.sax.SAXParseException; cvc-complex-type.2.4.a: Invalid content was found starting with element 'ORCID'. One of '{"https://www.openaire.eu/cerif-profile/1.1/":ElectronicAddress, "https://www.openaire.eu/cerif-profile/1.1/":Affiliation, "https://www.openaire.eu/cerif-profile/1.1/":Classification, "https://www.openaire.eu/cerif-profile/1.1/":Link}' is expected.

record on which the validator fails

<record>
   <header>
      <identifier>oai:narcis.nl:Persons/PRSxxxxxxx</identifier>
      <datestamp>2018-10-19T08:31:44Z</datestamp>
      <setSpec>openaire_cris_persons</setSpec>
   </header>
   <metadata>
      <Person xmlns="https://www.openaire.eu/cerif-profile/1.1/" id="PRSxxxxxxx">
         <PersonName>
            <FamilyNames>My-Name</FamilyNames>
            <FirstNames>x.y</FirstNames>
         </PersonName>
         <ISNI>some isni</ISNI>
         <ORCID>https://orcid.org/0000-000some-orcid-tail</ORCID>
         <ElectronicAddress>url:http://www.some.website/</ElectronicAddress>
         <Affiliation>
            <OrgUnit id="some org Id" />
         </Affiliation>
      </Person>
   </metadata>
   <about>
      <provenance xmlns="http://www.openarchives.org/OAI/2.0/provenance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/provenance http://www.openarchives.org/OAI/2.0/provenance.xsd">
         <originDescription harvestDate="2018-10-19T10:31:29Z" altered="true">
            <baseURL>http://tnarcis01.dans.knaw.nl/nodserver-0.0.1/nodbrug</baseURL>
            <identifier>PRSxxxxxxx</identifier>
            <datestamp>2009-06-12</datestamp>
            <metadataNamespace>http://www.onderzoekinformatie.nl/nod/prs</metadataNamespace>
         </originDescription>
      </provenance>
   </about>
</record>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.