@Override public void call() { Cache c = cm.getCache(); DummyInterceptor i = TestingUtil.findInterceptor(c, DummyInterceptor.class); assert i != null; Cache<Object, Object> namedCacheX = cm.getCache("x"); assert TestingUtil.findInterceptor(namedCacheX, CustomInterceptor1.class) != null; assert TestingUtil.findInterceptor(namedCacheX, CustomInterceptor2.class) != null; } });
@Override public void call() { AbstractLockingInterceptor lockingInterceptor = TestingUtil.findInterceptor( cm.getCache(), AbstractLockingInterceptor.class); assertTrue(lockingInterceptor instanceof NonTransactionalLockingInterceptor); } });
@Override public void call() { Cache c = cm.getCache(); DummyInterceptor i = TestingUtil.findInterceptor(c, DummyInterceptor.class); assertNotNull(i); } });
private void assertQueryInterceptorPresent(Cache<?, ?> c) { QueryInterceptor i = TestingUtil.findInterceptor(c, QueryInterceptor.class); assert i != null : "Expected to find a QueryInterceptor, only found " + c.getAdvancedCache().getAsyncInterceptorChain().getInterceptors(); }
@Override public void call() { cm.defineConfiguration("custom", cfg.build()); Cache c = cm.getCache("custom"); DummyInterceptor i = TestingUtil.findInterceptor(c, DummyInterceptor.class); assertNotNull(i); } });
private void doTest(CacheMode m) { CacheContainer cc = null; try { cc = TestCacheManagerFactory.createCacheManager(m, true); QueryInterceptor queryInterceptor = TestingUtil.findInterceptor(cc.getCache(), QueryInterceptor.class); assertNotNull("Didn't find a query interceptor in the chain!!", queryInterceptor); } finally { TestingUtil.killCacheManagers(cc); } } }
private void assertNoCacheLoaderInteractions() { for (EmbeddedCacheManager cacheManager : cacheManagers) { CacheLoaderInterceptor interceptor = findInterceptor(cacheManager.getCache(), CacheLoaderInterceptor.class); assertEquals(0, interceptor.getCacheLoaderLoads()); assertEquals(0, interceptor.getCacheLoaderMisses()); } }
public void testForwardToJoinerNonTransactional() throws Exception { EmbeddedCacheManager cm1 = addClusterEnabledCacheManager(buildConfig(PutKeyValueCommand.class)); final Cache<Object, Object> c1 = cm1.getCache(); DelayInterceptor di1 = findInterceptor(c1, DelayInterceptor.class); int initialTopologyId = c1.getAdvancedCache().getDistributionManager().getCacheTopology().getTopologyId(); DelayInterceptor di2 = findInterceptor(c2, DelayInterceptor.class); waitForStateTransfer(initialTopologyId + 4, c1, c2); DelayInterceptor di3 = findInterceptor(c3, DelayInterceptor.class); waitForStateTransfer(initialTopologyId + 8, c1, c2, c3);
public void testRetryAfterJoinNonTransactional() throws Exception { EmbeddedCacheManager cm1 = addClusterEnabledCacheManager(buildConfig(null, PutKeyValueCommand.class, true)); final Cache<Object, Object> c1 = cm1.getCache(); DelayInterceptor di1 = findInterceptor(c1, DelayInterceptor.class); int initialTopologyId = c1.getAdvancedCache().getDistributionManager().getCacheTopology().getTopologyId(); DelayInterceptor di2 = findInterceptor(c2, DelayInterceptor.class); waitForStateTransfer(initialTopologyId + 4, c1, c2); DelayInterceptor di3 = findInterceptor(c3, DelayInterceptor.class); waitForStateTransfer(initialTopologyId + 8, c1, c2, c3); DelayInterceptor di4 = findInterceptor(c4, DelayInterceptor.class); waitForStateTransfer(initialTopologyId + 12, c1, c2, c3, c4);
private void testRetryAfterJoinTransactional(LockingMode lockingMode, Class<?> commandClass) throws Exception { EmbeddedCacheManager cm1 = addClusterEnabledCacheManager(buildConfig(lockingMode, commandClass, false)); final Cache<Object, Object> c1 = cm1.getCache(); DelayInterceptor di1 = findInterceptor(c1, DelayInterceptor.class); int initialTopologyId = c1.getAdvancedCache().getDistributionManager().getCacheTopology().getTopologyId(); DelayInterceptor di2 = findInterceptor(c2, DelayInterceptor.class); waitForStateTransfer(initialTopologyId + 4, c1, c2); DelayInterceptor di3 = findInterceptor(c3, DelayInterceptor.class); waitForStateTransfer(initialTopologyId + 8, c1, c2, c3); DelayInterceptor di4 = findInterceptor(c4, DelayInterceptor.class); waitForStateTransfer(initialTopologyId + 12, c1, c2, c3, c4);