On Wed, May 8, 2013 at 2:06 PM, Mircea Markus <mmarkus(a)redhat.com> wrote:
On 8 May 2013, at 10:40, Pedro Ruivo wrote:
> On 05/08/2013 10:36 AM, Manik Surtani wrote:
>>
>> On 8 May 2013, at 10:34, Pedro Ruivo <pedro(a)infinispan.org> wrote:
>>
>>> Hi guys,
>>>
>>> In order to use the TimeService inside the cache loaders/stores I had
to
>>> change the method init() to include a new parameter the TimeService.
>>
>> Won't this break custom/3rd party impls?
>
> probably/definitely yes.
-1
>
> but I don't want to create a cache in all the cache loader/store tests
> that will be used to pick the TimeService.
>
> I tried to mock the ComponentRegistry but it is not possible for final
> classes. I don't want to remove the final :(
>
> Another alternative that come to my mind was to add a new method in
> AdvancedCache that returns the TimeService (and this I can mock it in
> the test suite)
+1
Couldn't you change CacheLoaderManager to call
ComponentRegistry.wireDependencies(cacheStore)?
That way, each cache store could have a separate @Inject method, and it
could depend on any cache-scoped or global-scoped component. It may require
an infinispan-module.properties file in each cache store module, but it
then it could be used for any other component.