<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 14, 2013 at 11:51 AM, Pedro Ruivo <span dir="ltr">&lt;<a href="mailto:pedro@infinispan.org" target="_blank">pedro@infinispan.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im"><br>
<br>
On 05/14/2013 09:44 AM, Dan Berindei wrote:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Tue, May 14, 2013 at 11:37 AM, Manik Surtani &lt;<a href="mailto:msurtani@redhat.com">msurtani@redhat.com</a><br>
</div><div class="im">&gt; &lt;mailto:<a href="mailto:msurtani@redhat.com">msurtani@redhat.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;     On 14 May 2013, at 08:33, Dan Berindei &lt;<a href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a><br>
</div><div class="im">&gt;     &lt;mailto:<a href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;&gt;     If we want to keep it hidden, then I think it would be best to<br>
&gt;&gt;     leave the getTimeService() method only in<br>
&gt;&gt;     ComponentRegistry/GlobalComponentRegistry and remove it from the<br>
&gt;&gt;     AdvancedCache interface.<br>
&gt;<br>
&gt;     +1.<br>
<br>
</div>first I have two situations here:<br>
<br>
in production: it&#39;s indifferent for me have it in the AdvancedCache or<br>
in the ComponentRegistry, in the cache loader/store and in the Extended<br>
Stats I have access to the cache and I can pick from everywhere.<br>
<br>
in the test suite: I first try to have it only in the ComponentRegistry<br>
and I was not be able to mock it because the class is final (I believe<br>
that is final for some reason). In addition, all the cache store tests<br>
mocks the Cache interface. That&#39;s why I put it in the AdvancedCache.<br>
<div class="im"><br></div></blockquote><div><br></div><div>Yeah, being able to inject the TimeService directly in the cache store would have been nice :)<br></div><div>I think we can remove the final modifier from the ComponentRegistry class, though.<br>

</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">
&gt;<br>
&gt;&gt;     We might want to remove it from the configuration, too.<br>
&gt;<br>
&gt;     It is definitely *not* configurable and *not* a part of the<br>
&gt;     configuration.  See an earlier thread on this subject:<br>
&gt;     <a href="http://bit.ly/102aQ9R" target="_blank">http://bit.ly/102aQ9R</a><br>
<br>
</div>This is another issue I have. I need to have the TimeService in the<br>
Extended Stats and this are a CustomInterceptor. My first try was to<br>
replace and rewire the GlobalComponent but this does not work because I<br>
don&#39;t have any @Inject method in the CustomInterceptor where I can<br>
replace for TimeService implementation in the test suite. That&#39;s why it<br>
is in the GlobalConfiguration.<br>
<br></blockquote><div><br></div><div>cache.getAdvancedCache().getComponentRegistry().getTimeService() should work in a custom interceptor.<br></div><div>You just have to mock the cache and the component registry...<br><br>

</div></div></div></div>