You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To make EMF aware of jimfs, we register the top-level URI of a jimfs path into the ecore 'platform resource map' (essentially a map from Eclipse IProject -> URI) in the test setup:
I've just tested the behavior of the default file system (on my Mac, at least) and URLConnections created for its files do not support writing. I'm disinclined to have Jimfs support things that, if you switched to a real file system, would not work.
I see that the generic file path url connection does indeed not support output and I’ve found some (old) enhancement requests for this to be enabled.
There are some file-oriented url connections that do support getoutputstream: for example org.jboss.net.protocol.file.FileURLConnection (FileURLConnection (JBoss/Common API))
Essentially, having jimfs not support this feature means that any infrastructure that uses URIs to interact with jimfs cannot write to the filesystem, hence making jimfs of limited use in those contexts
(such as the emf platform uri extension mechanism).
If this is not an option for the jimfs API, then we either need to move away from jimfs as a testing aid or find some other way of allowing (emf) resources to be written ‘out’ in a unittest context.
Maybe you would be open to conditionally enable this getoutputstream capability, based on a java property or something?
This way, unittesting uses could still work with an additional action and the ‘normal’ behavior stays in line with standard path url connection behavior?
Hey,
we ran into some issues in our unit tests, where EMF is trying to write to some URL in the jimfs filesystem.
The stack is the following:
To make EMF aware of jimfs, we register the top-level URI of a jimfs path into the ecore 'platform resource map' (essentially a map from Eclipse IProject -> URI) in the test setup:
It would be good, if the PathURLConnection could also implement the write protocol.
A trivial implementation fixed the issue for us: pull request
We would kindly ask to review the change and make suggestions if you see any violations of the protocol.
also see: #13 Obtaining a URL from a jimfs path
Thanks
Janik
The text was updated successfully, but these errors were encountered: