Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests shouldn't depend on http://schemas.deegree.org #649

Closed
copierrj opened this issue Dec 10, 2015 · 4 comments · Fixed by #735
Closed

Tests shouldn't depend on http://schemas.deegree.org #649

copierrj opened this issue Dec 10, 2015 · 4 comments · Fixed by #735
Assignees
Labels
enhancement enhancement or improvement
Milestone

Comments

@copierrj
Copy link
Member

http://schemas.deegree.org is being used in unit tests. This is causing problems when:

  • the server is down
  • PR makes changes in the schema files
@stephanr
Copy link
Member

I think the current handling intended to only use the local xsd schema files for building, so no online dependecy is required.
See https://github.com/deegree/deegree3/blob/master/pom.xml#L86

@tfr42 tfr42 added the enhancement enhancement or improvement label Dec 10, 2015
@stephanr
Copy link
Member

stephanr commented Aug 9, 2016

As a temporary resolve can be adding a classpath resulition by addin a dependecy to this code:

public class CatalogResolver extends com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver {

    public String getResolvedEntity( String publicId, String systemId ) {
        System.err.println( "*** DEEGREE RESOLVER - getResolvedEntity ***" );
        System.err.println( "publicId: " + publicId );
        System.err.println( "systemId: " + systemId );

        if ( systemId != null && systemId.toLowerCase().startsWith( "http://schemas.deegree.org/" ) ) {
            String newid = "META-INF/schemas/" + systemId.substring( 27 );
            System.err.println( "trying: " + newid );
            try {
                URL resource = Thread.currentThread().getContextClassLoader().getResource( newid );
                System.err.println( "Found: " + resource );
                if ( resource == null ) {
                    resource = getClass().getResource( "/" + newid );
                }
                if ( resource != null ) {
                    System.err.println( "Using local schema file: " + resource );
                    return resource.toString();
                }
            } catch ( Exception ex ) {
                System.err.println( "Error: " + ex.getMessage() );
            }
        }

        return super.getResolvedEntity( publicId, systemId );
    }
}

@copierrj
Copy link
Member Author

copierrj commented Aug 9, 2016

Using version 0.12.0 of maven-jaxb2-plugin should be used eventually.

Perhaps we could leverage the dependency plugin (to extract xsd's from other artifacts) and the 'schemaDirectory' option of jaxb plugin?

@copierrj
Copy link
Member Author

copierrj commented Aug 9, 2016

related issue: #731

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement enhancement or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants