Ejemplo n.º 1
0
 @BeforeMethod
 public void setUp() {
   n = new CacheNotifierImpl();
   mockCache = mock(Cache.class, RETURNS_DEEP_STUBS);
   Configuration config = mock(Configuration.class, RETURNS_DEEP_STUBS);
   when(mockCache.getAdvancedCache().getStatus()).thenReturn(ComponentStatus.INITIALIZING);
   Answer answer =
       new Answer<Object>() {
         @Override
         public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
           return Mockito.mock((Class) invocationOnMock.getArguments()[0]);
         }
       };
   when(mockCache.getAdvancedCache().getComponentRegistry().getComponent(any(Class.class)))
       .then(answer);
   when(mockCache
           .getAdvancedCache()
           .getComponentRegistry()
           .getComponent(any(Class.class), anyString()))
       .then(answer);
   n.injectDependencies(mockCache, cdl, null, config);
   cl = new PrimaryOwnerCacheListener();
   n.start();
   n.addListener(cl);
   ctx = new NonTxInvocationContext(AnyEquivalence.getInstance());
 }
Ejemplo n.º 2
0
 @Override
 public <C> void addListener(
     Object listener,
     CacheEventFilter<? super K, ? super V> filter,
     CacheEventConverter<? super K, ? super V, C> converter) {
   addListener(listener, filter, converter, null);
 }
Ejemplo n.º 3
0
 @Override
 public void addListener(Object listener, KeyFilter filter) {
   addListener(listener, filter, null);
 }
Ejemplo n.º 4
0
 @Override
 public void addListener(Object listener, KeyFilter<? super K> filter, ClassLoader classLoader) {
   addListener(listener, new KeyFilterAsCacheEventFilter<K>(filter), null, classLoader);
 }
Ejemplo n.º 5
0
 @Override
 public void addListener(Object listener, ClassLoader classLoader) {
   addListener(listener, null, null, classLoader);
 }
Ejemplo n.º 6
0
 @Override
 public void addListener(Object listener) {
   addListener(listener, null, null, null);
 }