Skip to content

Commit

Permalink
check010_MetadataFormats: improved diagnostics for schema file location
Browse files Browse the repository at this point in the history
  • Loading branch information
jdvorak001 committed Jan 19, 2019
1 parent 1ab5ba3 commit 70f6895
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ public class CRISValidator {
*/
public static final String CURRENT_XML_SCHEMA_URL_PREFIX = OPENAIRE_CERIF_SCHEMAS_ROOT + "current/";

/**
* The name of the XML Schema file.
*/
public static final String OPENAIRE_CERIF_SCHEMA_FILENAME = "openaire-cerif-profile.xsd";

/**
* The connection stream factory to use for getting the response stream from a connection.
*/
Expand Down Expand Up @@ -329,8 +334,8 @@ public boolean test( final MetadataFormatType mf ) {
try {
final DocumentBuilder db = dbf.newDocumentBuilder();
final String schemaUrl = mf.getSchema();
assertTrue( schemaUrl.startsWith( OPENAIRE_CERIF_SCHEMAS_ROOT ) );
assertTrue( schemaUrl.endsWith( "/openaire-cerif-profile.xsd" ) );
assertTrue( "Please reference the official XML Schema at " + OPENAIRE_CERIF_SCHEMAS_ROOT + " (2)", schemaUrl.startsWith( OPENAIRE_CERIF_SCHEMAS_ROOT ) );
assertTrue( "The schema file should be " + OPENAIRE_CERIF_SCHEMA_FILENAME + " (2)", schemaUrl.endsWith( "/" + OPENAIRE_CERIF_SCHEMA_FILENAME ) );
final String realSchemaUrl = ( schemaUrl.equals( CURRENT_XML_SCHEMA_URL_PREFIX + "openaire-cerif-profile.xsd" ) )
? this.getClass().getResource( "/schemas/openaire-cerif-profile.xsd" ).toExternalForm()
: schemaUrl;
Expand Down

0 comments on commit 70f6895

Please sign in to comment.