opengeospatial / ets-gpkg12

GeoPackage 1.2 Executable Test Suite
Other
7 stars 10 forks source link

Standalone jar requires net connection even for local GeoPackage #102

Closed jratike80 closed 3 years ago

jratike80 commented 4 years ago

The standalone jar file cannot be used for testing a local GeoPackage with a default test-run-props.xml file if there is no network connection. The reason is this reference in the props file <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

Offline check succeeds by downloading the DTD into local file system and changing the reference <!DOCTYPE properties SYSTEM "file:///C:/teamengine/properties.dtd">

As an enhancement I suggest to document this workaround if it is not reasonable to add a copy of properties.dtd into the jar file or to skip the DTD check.

dstenger commented 4 years ago

Thank you for the hint!

Alternatively, the properties.dtd could be copied to the source code repository so that the test suite will always use the local copy instead of the online resource. What do you think about that approach?

However, as far as I know, it was never a requirement that the test suite also runs offline. So, there might also be other resources being referenced remotely.

jratike80 commented 4 years ago

By looking at the list of test suites https://cite.opengeospatial.org/teamengine/ the GeoPackage test is probably the only one that can be run offline. However, server administrators do not like to open holes into the firewall and they would appreciate if they knew the trick to run the GPKG tests locally. Of course they have another good option in the GDAL Python script https://github.com/OSGeo/gdal/blob/master/gdal/swig/python/samples/validate_gpkg.py.

dstenger commented 4 years ago

Then, it might be a good idea to remove the only existing online resource and to replace it with a local resource. By that, the test suite can be executed offline without any problems.

keshavnangare commented 4 years ago

Following is my workaround: [1] <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

[2] <!DOCTYPE properties SYSTEM "C:\properties.dtd">

I am unable to build test-suite normally with reference [2] in test-run-props.xml because JUnit test cases are getting failed with below exception:

org.opengis.cite.gpkg12.VerifyTestNGController
cleanTestRun(org.opengis.cite.gpkg12.VerifyTestNGController)  Time elapsed: 0.013 sec  <<< ERROR!
java.util.InvalidPropertiesFormatException: org.xml.sax.SAXException: Invalid system identifier: file:///C:/properties.dtd
        at org.opengis.cite.gpkg12.VerifyTestNGController.loadDefaultTestRunProperties(VerifyTestNGController.java:50)
Caused by: org.xml.sax.SAXException: Invalid system identifier: file:///C:/properties.dtd
        at org.opengis.cite.gpkg12.VerifyTestNGController.loadDefaultTestRunProperties(VerifyTestNGController.java:50)

The reason of above failure is loadXMLFrom method of Properties class in the following JUnit test class https://github.com/opengeospatial/ets-gpkg12/blob/eeb9663e164705ed1675bbca586cd9d23af00f4f/src/test/java/org/opengis/cite/gpkg12/VerifyTestNGController.java#L50 which expects the XML document must have the following DOCTYPE declaration: <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

I am able to build the test-suite by skipping JUnit test cases and executed successfully.

keshavnangare commented 4 years ago

@dstenger Following are the fixes of the issue:

  1. Check whether we can use relative path to avoid the use of an absolute path:

    We can use the relative path to point local properties.dtd file and able to run the test. We can see the below snippet which will use the dtd file from the test project resource directory.

    <!DOCTYPE root-name SYSTEM "./org/opengis/cite/gpkg12/dtd/properties.dtd">

  2. Fix Junit tests case: I have added fix for the Junit test case to load the properties file from the test-run-props.xml file.

keshavnangare commented 4 years ago

Fixed with this PR #103.