TreeCache cache = createReplicatedCache(TreeCache.REPL_SYNC);
Interceptor txInterceptor = new TxInterceptor();
txInterceptor.setCache(cache);
Interceptor replicationInterceptor = new OptimisticReplicationInterceptor();
replicationInterceptor.setCache(cache);
Interceptor createInterceptor = new OptimisticCreateIfNotExistsInterceptor();
createInterceptor.setCache(cache);
OptimisticNodeInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
nodeInterceptor.setCache(cache);
MockInterceptor dummy = new MockInterceptor();
dummy.setCache(cache);
txInterceptor.setNext(replicationInterceptor);
replicationInterceptor.setNext(createInterceptor);
createInterceptor.setNext(nodeInterceptor);
nodeInterceptor.setNext(dummy);
cache.setInterceptorChain(txInterceptor);
TreeCache cache2 = createReplicatedCache(TreeCache.REPL_SYNC);
Interceptor txInterceptor2 = new TxInterceptor();
txInterceptor2.setCache(cache2);
Interceptor replicationInterceptor2 = new OptimisticReplicationInterceptor();
replicationInterceptor2.setCache(cache2);
Interceptor createInterceptor2 = new OptimisticCreateIfNotExistsInterceptor();
createInterceptor2.setCache(cache2);
OptimisticNodeInterceptor nodeInterceptor2 = new OptimisticNodeInterceptor();
nodeInterceptor2.setCache(cache2);
MockFailureInterceptor dummy2 = new MockFailureInterceptor();
List failures = new ArrayList();
failures.add(MethodDeclarations.optimisticPrepareMethod);
dummy2.setFailurelist(failures);
dummy2.setCache(cache2);
txInterceptor2.setNext(replicationInterceptor2);
replicationInterceptor2.setNext(createInterceptor2);
createInterceptor2.setNext(nodeInterceptor2);
nodeInterceptor2.setNext(dummy2);
cache2.setInterceptorChain(txInterceptor2);