today i had a deeper look at the current implementation of resourceresolver-mock [1]. nice work, simulates an simple in-memory resource tree without any underlying JCR. data can be written using Sling CRUD API.
unfortunately currently no support for binary data exists, and i'm unsure what's the best way to implement it: a) in JCR resource implementation binary data can be read and written via InputStream objects in the ValueMap - that's gets converted internaly to a JCR BinaryValue, that means the InputStream can be read again many times, not only once. read is not done via ValueMap, but via adapting the property resource to InputStream. this does not work in resourceresolver-mock because a) only a simple map is used for storage and b) Resources for properties are not supported at all. b) the resourceresolver-mock could be somehow extended to detect InputStream values and apply a special treatment, mimicking the behavior of the JCR ValueMap implementation c) or the generic ValueMapDecorator implementation is extended to support such binary data handling my goal is to be able to use the resourceresolver-mock implementation in unit tests to test code that reads and writes data using Sling CRUD API including binary data. stefan [1] http://svn.apache.org/repos/asf/sling/trunk/testing/resourceresolver-mock