[
https://issues.apache.org/jira/browse/SLING-6387?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan Seifert resolved SLING-6387.
-----------------------------------
Resolution: Fixed
Assignee: Stefan Seifert
Fix Version/s: Testing Sling Mock 2.2.2
Testing Sling Mock 1.9.2
Completed: At revision: 1773569
thanks! i've applied it with modifications:
* it makes sense to not introduce state into the content loader, but
overloading all methods with a commit flag is not nice either. i´'ve changed
this and added a autocommit flag to the "load" method wich is a good compromise
and still allows full control.
* fixed some small issues in the unit tests (unused methods/variables due to
small copy&paste errors)
> ContentLoader shouldn't commit changes or at least allow to disable auto
> commit
> -------------------------------------------------------------------------------
>
> Key: SLING-6387
> URL: https://issues.apache.org/jira/browse/SLING-6387
> Project: Sling
> Issue Type: Improvement
> Components: Testing
> Affects Versions: Testing Sling Mock 2.1.2
> Reporter: Dirk Rudolph
> Assignee: Stefan Seifert
> Priority: Minor
> Fix For: Testing Sling Mock 1.9.2, Testing Sling Mock 2.2.2
>
>
> The {{ContentLoader}} always, automatically persists changes made to the
> given {{ResoureResolver}}. This makes it hard to use for test on classes
> implementing transactional changes.
> Example: Having high-level APIs that do changes on the {{ResourceResolver}}
> allowing to automatically commiting them (PageManager, AssetManager in AEM as
> implementation on top of sling). But to keep it abstract, lets say I have a
> class {{SpecificBinaryFileSetResource}}, which has a method
> {{addBinaryFile}}. The goal is to implement a mock for that, so I'm using
> {{ContentLoader}} to create a binary file in the {{ResourceResolver}}. This
> will automatically commit the changes. Now lets extend the {{addBinaryFile}}
> to accept a boolean parameter to not automatically commit those changes
> (maybe because I want to make multiple changes rolling them back on error).
> This isn't not supported so far when using ContentLoader.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)