getodk / validate

ODK Validate is a Java application for confirming that a form is valid and compliant with the ODK XForms specification. Contribute and make the world a better place! ✨🔍✨
https://docs.getodk.org/validate/
Other
9 stars 27 forks source link

Register stub setgeopoint implementation that does nothing #79

Closed lognaturel closed 5 years ago

lognaturel commented 5 years ago

The default stub from JavaRosa writes a string out which fails if the target node type is e.g. geopoint.

Needed to address https://github.com/XLSForm/pyxform/issues/351

What has been done to verify that this works as intended?

I tried metadata.xml.txt before the fix, confirmed it fails because of a casting issue, applied the fix, confirmed that it works.

Why is this the best possible solution? Were any other approaches considered?

I considered changing the stub implementation in JavaRosa to write something in geopoint format, probably 0 0 0 0, but I think it's helpful for JR tests to have the "no implementation" text and I think it makes it more likely clients would notice they've made a mistake if they don't register their own action handler.

For Validate, having the action do nothing is ideal. We can't do that at the JR level because it doesn't allow us to test that the basic action setup (abstract SetGeopointAction class) works.

Are there any risks to merging this code? If so, what are they?

I can't think of any. This only affects forms that have setgeopoint actions. It adds support for those forms and I think the only risk is that it doesn't work in some contexts.

yanokwa commented 5 years ago

Can you confirm you tried this fix with pyxform running Validate?

lognaturel commented 5 years ago

I've tried to add more context to the comment and I hope that helps.

Can you confirm you tried this fix with pyxform running Validate?

I tried it just with Validate but did not put the patched Validate in pyxform. I don't think that would be any different than validating standalone.

yanokwa commented 5 years ago

Confirmed that running test_set_geopoint in pyxform with run_odk_validate=True with this new jar works.