{
TreeCache cache = new TreeCache();
cache.setUseInterceptorMbeans(false);
cache.setCacheMode(TreeCache.REPL_ASYNC);
Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
// test the chain size.
List chainAsList = InterceptorChainFactory.asList(chain);
Assert.assertEquals(5, chainAsList.size());
Assert.assertEquals(TxInterceptor.class, chain.getClass());
chain = chain.getNext();
Assert.assertEquals(ReplicationInterceptor.class, chain.getClass());
chain = chain.getNext();
Assert.assertEquals(UnlockInterceptor.class, chain.getClass());
chain = chain.getNext();
Assert.assertEquals(PessimisticLockInterceptor.class, chain.getClass());
chain = chain.getNext();
Assert.assertEquals(CallInterceptor.class, chain.getClass());
// ok, my replication chain looks good.
// now for my invalidation chain.
cache = new TreeCache();
cache.setUseInterceptorMbeans(false);
cache.setCacheMode(TreeCache.INVALIDATION_ASYNC);
chain = new InterceptorChainFactory().buildInterceptorChain(cache);
// test the chain size.
chainAsList = InterceptorChainFactory.asList(chain);
Assert.assertEquals(5, chainAsList.size());