You signed in with another tab or window. Reload to refresh your session.You sign
8000
ed 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?
Activity
cgdecker commentedon Jun 30, 2021
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.jsnps commentedon Jul 2, 2021
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?