metadata101 / iso19139.ca.HNAP

ISO Harmonized North American Profile (HNAP)
GNU General Public License v2.0
4 stars 19 forks source link

HNAP schema producing test failures in core-geonetwork/services #70

Open jodygarnett opened 4 years ago

jodygarnett commented 4 years ago

@ianwallen you recently added a snippet to add-schema.sh to help address this, it seems to no longer be working:

[ERROR] testExecListOne(org.fao.geonet.services.metadata.schema.SchematronCriteriaGroupServiceIntegrationTest)  Time elapsed: 0.001 s  <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from URL [jar:file:/Users/jgarnett/.m2/repository/org/geonetwork-opensource/schema-iso19139.ca.HNAP/3.11.0-SNAPSHOT/schema-iso19139.ca.HNAP-3.11.0-SNAPSHOT.jar!/config-spring-geonetwork.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 75; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.
ianwallen commented 4 years ago

I can look into this - is this based on the latest geonetwork core master? and the HNAP 3.10.x branch?

What parameters did you pass when you called add-schema.sh?

jodygarnett commented 4 years ago

I used the default example from add-schema.sh:

./add-schema.sh iso19139.ca.HNAP https://github.com/metadata101/iso19139.ca.HNAP 3.11.x
jodygarnett commented 4 years ago

See https://github.com/geonetwork/core-geonetwork/issues/4914 for context

ianwallen commented 4 years ago

@jodygarnett

Sorry - did not have much time to test. I quickly did the following I checkout the master from geonetwork core then run ./add-schema.sh iso19139.ca.HNAP https://github.com/metadata101/iso19139.ca.HNAP 3.11.x

And then run mvn clean install I get the following error.

[ERROR] Failed to execute goal on project services: Could not resolve dependencies for project org.geonetwork-opensource:services:jar:3.11.0-SNAPSHOT: Could not find artifact org.geonetwork-opensource:schema-iso19139.ca.HNAP:jar:3.11.0-SNAPSHOT -> [Help 1]

I noticed that you changed the group for the schema to org.geonetwork-opensource.schemas. Not sure if add-schema.sh also has to use this for the service module.

https://github.com/geonetwork/core-geonetwork/blob/7e52a5146a9d70835867e3685b6b687dd3db4ade/add-schema.sh#L148

ianwallen commented 4 years ago

@jodygarnett In service pom.xml, I changed the group to org.geonetwork-opensource.schemas and I no longer get that error. But now I get the following error.

[ERROR] testCollectGraphicOverviewEntries(org.fao.geonet.api.directory.DirectoryApiTest)  Time elapsed: 0.042 s  <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from URL [jar:file:/u01/geonetwork_build/core-geonetwork/schemas/iso19139.ca.HNAP/target/schema-iso19139.ca.HNAP-3.11.0-SNAPSHOT.jar!/config-spring-geonetwork.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 75; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.

When I compare version 3.11.x version of config-spring-geonetwork.xml https://github.com/metadata101/iso19139.ca.HNAP/blob/3.11.x/src/main/resources/config-spring-geonetwork.xml with version 3.10.x https://github.com/metadata101/iso19139.ca.HNAP/blob/3.10.x/src/main/resources/config-spring-geonetwork.xml I can see that the xsi:schemaLocation is missing the context.

I'm not sure why this would be different in 3.11.x. Makes me wonder if there are other difference between 3.10.x and 3.11.x that could cause issues.

jodygarnett commented 4 years ago

Thanks for detecting the schema plugin change, I expect that is a needed change to add-schema.sh script.

As for the new failure ... can we recreate master (formally 3.11.x) from the existing 3.10.x and make the appropriate pom.xml changes. I am not sure how well hnap schema plugin has been maintained with respect to compatibility with master...

It may be wise to set up a jenkins build job to continually test core-geonetwork master and hnap master so we can be notified of any breaking changes early.

ianwallen commented 4 years ago

I don't believe master has been used so I don't have any objection with it being recreated from 3.10.x