Clover coverage report -
Coverage timestamp: Wed Jan 31 2007 15:38:53 EST
file stats: LOC: 494   Methods: 20
NCLOC: 392   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
InterceptorChainFactoryTest.java 50% 99.7% 95% 99%
coverage coverage
 1    package org.jboss.cache.factories;
 2   
 3    import junit.framework.Assert;
 4    import junit.framework.Test;
 5    import junit.framework.TestSuite;
 6    import org.jboss.cache.CacheImpl;
 7    import org.jboss.cache.DefaultCacheFactory;
 8    import org.jboss.cache.config.BuddyReplicationConfig;
 9    import org.jboss.cache.config.CacheLoaderConfig;
 10    import org.jboss.cache.config.EvictionConfig;
 11    import org.jboss.cache.interceptors.*;
 12    import org.jboss.cache.xml.XmlHelper;
 13    import org.w3c.dom.Element;
 14   
 15    import java.util.Iterator;
 16    import java.util.List;
 17   
 18    public class InterceptorChainFactoryTest extends InterceptorChainTestBase
 19    {
 20    CacheImpl cache = null;
 21   
 22  14 protected void setUp() throws Exception
 23    {
 24  14 super.setUp();
 25  14 cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
 26  14 cache.getConfiguration().setCacheMode("LOCAL");
 27    }
 28   
 29  14 protected void tearDown() throws Exception
 30    {
 31  14 super.tearDown();
 32  14 if (cache != null)
 33    {
 34  14 cache.stop();
 35  14 cache.destroy();
 36    }
 37    }
 38   
 39   
 40  1 public void testBareConfig() throws Exception
 41    {
 42  1 cache.getConfiguration().setExposeManagementStatistics(false);
 43  1 Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
 44  1 List<Interceptor> list = InterceptorChainFactory.asList(chain);
 45  1 Iterator<Interceptor> interceptors = list.iterator();
 46   
 47  1 System.out.println("testBareConfig interceptors are:\n" + list);
 48  1 assertNotNull(list);
 49  1 assertEquals(6, list.size());
 50   
 51  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 52  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 53  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 54  1 assertEquals(UnlockInterceptor.class, interceptors.next().getClass());
 55  1 assertEquals(PessimisticLockInterceptor.class, interceptors.next().getClass());
 56  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 57   
 58  1 assertInterceptorLinkage(list);
 59    }
 60   
 61   
 62  1 public void testTxConfig() throws Exception
 63    {
 64  1 cache.getConfiguration().setExposeManagementStatistics(false);
 65  1 cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
 66   
 67  1 Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
 68  1 List<Interceptor> list = InterceptorChainFactory.asList(chain);
 69  1 Iterator<Interceptor> interceptors = list.iterator();
 70   
 71  1 System.out.println("testTxConfig interceptors are:\n" + list);
 72  1 assertNotNull(list);
 73  1 assertEquals(6, list.size());
 74   
 75  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 76  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 77  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 78  1 assertEquals(UnlockInterceptor.class, interceptors.next().getClass());
 79  1 assertEquals(PessimisticLockInterceptor.class, interceptors.next().getClass());
 80  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 81   
 82  1 assertInterceptorLinkage(list);
 83    }
 84   
 85  4 protected CacheLoaderConfig getCacheLoaderConfig(boolean pasv, boolean fetchPersistentState) throws Exception
 86    {
 87  4 String xml = " <config>\n" +
 88    " \n" +
 89    " <passivation>" + pasv + "</passivation>\n" +
 90    " <preload></preload>\n" +
 91    "\n" +
 92    " <cacheloader>\n" +
 93    " <class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
 94    " <properties>\n" +
 95    " location=/tmp\n" +
 96    " </properties>\n" +
 97    " <async>false</async>\n" +
 98    " <fetchPersistentState>" + fetchPersistentState + "</fetchPersistentState>\n" +
 99    " <ignoreModifications>false</ignoreModifications>\n" +
 100    " </cacheloader>\n" +
 101    " \n" +
 102    " </config>";
 103  4 Element element = XmlHelper.stringToElement(xml);
 104  4 return XmlConfigurationParser.parseCacheLoaderConfig(element);
 105    }
 106   
 107  1 public void testSharedCacheLoaderConfig() throws Exception
 108    {
 109  1 cache.getConfiguration().setExposeManagementStatistics(false);
 110  1 cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
 111  1 cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(false, false));
 112  1 cache.getConfiguration().setCacheMode("REPL_ASYNC");
 113  1 cache.getConfiguration().setFetchInMemoryState(false);
 114  1 cache.create();
 115  1 Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
 116  1 List<Interceptor> list = InterceptorChainFactory.asList(chain);
 117  1 Iterator<Interceptor> interceptors = list.iterator();
 118   
 119  1 System.out.println("testSharedCacheLoaderConfig interceptors are:\n" + list);
 120  1 assertNotNull(list);
 121   
 122  1 assertEquals(9, list.size());
 123   
 124  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 125  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 126  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 127  1 assertEquals(CacheStoreInterceptor.class, interceptors.next().getClass());
 128  1 assertEquals(ReplicationInterceptor.class, interceptors.next().getClass());
 129  1 assertEquals(UnlockInterceptor.class, interceptors.next().getClass());
 130  1 assertEquals(CacheLoaderInterceptor.class, interceptors.next().getClass());
 131  1 assertEquals(PessimisticLockInterceptor.class, interceptors.next().getClass());
 132  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 133   
 134  1 assertInterceptorLinkage(list);
 135    }
 136   
 137  1 public void testUnsharedCacheLoaderConfig() throws Exception
 138    {
 139  1 cache.getConfiguration().setExposeManagementStatistics(false);
 140  1 cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
 141  1 cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(false, true));
 142  1 cache.getConfiguration().setCacheMode("REPL_ASYNC");
 143  1 cache.getConfiguration().setFetchInMemoryState(false);
 144  1 cache.create();
 145  1 Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
 146  1 List<Interceptor> list = InterceptorChainFactory.asList(chain);
 147  1 Iterator<Interceptor> interceptors = list.iterator();
 148   
 149  1 System.out.println("testUnsharedCacheLoaderConfig interceptors are:\n" + list);
 150  1 assertNotNull(list);
 151   
 152  1 assertEquals(9, list.size());
 153   
 154  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 155  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 156  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 157  1 assertEquals(ReplicationInterceptor.class, interceptors.next().getClass());
 158  1 assertEquals(UnlockInterceptor.class, interceptors.next().getClass());
 159  1 assertEquals(CacheLoaderInterceptor.class, interceptors.next().getClass());
 160  1 assertEquals(CacheStoreInterceptor.class, interceptors.next().getClass());
 161  1 assertEquals(PessimisticLockInterceptor.class, interceptors.next().getClass());
 162  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 163   
 164  1 assertInterceptorLinkage(list);
 165    }
 166   
 167  1 public void testTxAndRepl() throws Exception
 168    {
 169  1 cache.getConfiguration().setExposeManagementStatistics(false);
 170  1 cache.getConfiguration().setCacheMode("repl_sync");
 171  1 cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
 172  1 Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
 173  1 List<Interceptor> list = InterceptorChainFactory.asList(chain);
 174  1 Iterator<Interceptor> interceptors = list.iterator();
 175   
 176  1 System.out.println("testTxAndRepl interceptors are:\n" + list);
 177  1 assertNotNull(list);
 178   
 179  1 assertEquals(7, list.size());
 180   
 181  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 182  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 183  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 184  1 assertEquals(ReplicationInterceptor.class, interceptors.next().getClass());
 185  1 assertEquals(UnlockInterceptor.class, interceptors.next().getClass());
 186  1 assertEquals(PessimisticLockInterceptor.class, interceptors.next().getClass());
 187  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 188   
 189  1 assertInterceptorLinkage(list);
 190    }
 191   
 192   
 193  1 public void testOptimisticChain() throws Exception
 194    {
 195  1 CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
 196  1 cache.getConfiguration().setExposeManagementStatistics(false);
 197  1 cache.getConfiguration().setNodeLockingOptimistic(true);
 198   
 199  1 Interceptor next = new InterceptorChainFactory().buildInterceptorChain(cache);
 200   
 201    // test the chain size.
 202  1 List<Interceptor> list = InterceptorChainFactory.asList(next);
 203  1 Iterator<Interceptor> interceptors = list.iterator();
 204   
 205  1 Assert.assertEquals(8, list.size());
 206   
 207  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 208  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 209  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 210  1 assertEquals(OptimisticLockingInterceptor.class, interceptors.next().getClass());
 211  1 assertEquals(OptimisticValidatorInterceptor.class, interceptors.next().getClass());
 212  1 assertEquals(OptimisticCreateIfNotExistsInterceptor.class, interceptors.next().getClass());
 213  1 assertEquals(OptimisticNodeInterceptor.class, interceptors.next().getClass());
 214  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 215   
 216  1 assertInterceptorLinkage(list);
 217    }
 218   
 219  1 public void testOptimisticReplicatedChain() throws Exception
 220    {
 221  1 CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
 222  1 cache.getConfiguration().setExposeManagementStatistics(false);
 223  1 cache.getConfiguration().setNodeLockingOptimistic(true);
 224  1 cache.getConfiguration().setCacheMode("REPL_SYNC");
 225   
 226  1 Interceptor next = new InterceptorChainFactory().buildInterceptorChain(cache);
 227   
 228    // test the chain size.
 229  1 List<Interceptor> list = InterceptorChainFactory.asList(next);
 230  1 Iterator<Interceptor> interceptors = list.iterator();
 231   
 232  1 Assert.assertEquals(9, list.size());
 233   
 234  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 235  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 236  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 237  1 assertEquals(OptimisticReplicationInterceptor.class, interceptors.next().getClass());
 238  1 assertEquals(OptimisticLockingInterceptor.class, interceptors.next().getClass());
 239  1 assertEquals(OptimisticValidatorInterceptor.class, interceptors.next().getClass());
 240  1 assertEquals(OptimisticCreateIfNotExistsInterceptor.class, interceptors.next().getClass());
 241  1 assertEquals(OptimisticNodeInterceptor.class, interceptors.next().getClass());
 242  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 243   
 244  1 assertInterceptorLinkage(list);
 245    }
 246   
 247  1 public void testOptimisticCacheLoaderChain() throws Exception
 248    {
 249  1 CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
 250  1 cache.getConfiguration().setExposeManagementStatistics(false);
 251  1 cache.getConfiguration().setNodeLockingOptimistic(true);
 252  1 cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(false, false));
 253  1 cache.create();
 254  1 Interceptor next = new InterceptorChainFactory().buildInterceptorChain(cache);
 255   
 256    // test the chain size.
 257  1 List<Interceptor> list = InterceptorChainFactory.asList(next);
 258  1 Iterator<Interceptor> interceptors = list.iterator();
 259   
 260  1 Assert.assertEquals(10, list.size());
 261   
 262  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 263  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 264  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 265  1 assertEquals(CacheStoreInterceptor.class, interceptors.next().getClass());
 266  1 assertEquals(CacheLoaderInterceptor.class, interceptors.next().getClass());
 267  1 assertEquals(OptimisticLockingInterceptor.class, interceptors.next().getClass());
 268  1 assertEquals(OptimisticValidatorInterceptor.class, interceptors.next().getClass());
 269  1 assertEquals(OptimisticCreateIfNotExistsInterceptor.class, interceptors.next().getClass());
 270  1 assertEquals(OptimisticNodeInterceptor.class, interceptors.next().getClass());
 271  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 272   
 273  1 assertInterceptorLinkage(list);
 274    }
 275   
 276  1 public void testOptimisticPassivationCacheLoaderChain() throws Exception
 277    {
 278  1 CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
 279  1 cache.getConfiguration().setExposeManagementStatistics(false);
 280  1 cache.getConfiguration().setNodeLockingOptimistic(true);
 281  1 cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(true, false));
 282  1 cache.create();
 283  1 Interceptor next = new InterceptorChainFactory().buildInterceptorChain(cache);
 284   
 285    // test the chain size.
 286  1 List<Interceptor> list = InterceptorChainFactory.asList(next);
 287  1 Iterator<Interceptor> interceptors = list.iterator();
 288   
 289  1 Assert.assertEquals(10, list.size());
 290   
 291   
 292  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 293  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 294  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 295  1 assertEquals(PassivationInterceptor.class, interceptors.next().getClass());
 296  1 assertEquals(ActivationInterceptor.class, interceptors.next().getClass());
 297  1 assertEquals(OptimisticLockingInterceptor.class, interceptors.next().getClass());
 298  1 assertEquals(OptimisticValidatorInterceptor.class, interceptors.next().getClass());
 299  1 assertEquals(OptimisticCreateIfNotExistsInterceptor.class, interceptors.next().getClass());
 300  1 assertEquals(OptimisticNodeInterceptor.class, interceptors.next().getClass());
 301  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 302   
 303  1 assertInterceptorLinkage(list);
 304    }
 305   
 306  1 public void testInvalidationInterceptorChain() throws Exception
 307    {
 308  1 CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
 309  1 cache.getConfiguration().setExposeManagementStatistics(false);
 310  1 cache.getConfiguration().setCacheMode("REPL_ASYNC");
 311   
 312  1 Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
 313   
 314    // test the chain size.
 315  1 List<Interceptor> list = InterceptorChainFactory.asList(chain);
 316  1 Iterator<Interceptor> interceptors = list.iterator();
 317   
 318  1 Assert.assertEquals(7, list.size());
 319   
 320  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 321  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 322  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 323  1 assertEquals(ReplicationInterceptor.class, interceptors.next().getClass());
 324  1 assertEquals(UnlockInterceptor.class, interceptors.next().getClass());
 325  1 assertEquals(PessimisticLockInterceptor.class, interceptors.next().getClass());
 326  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 327   
 328    // ok, my replication chain looks good.
 329   
 330    // now for my invalidation chain.
 331  1 cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
 332  1 cache.getConfiguration().setExposeManagementStatistics(false);
 333  1 cache.getConfiguration().setCacheMode("INVALIDATION_ASYNC");
 334  1 chain = new InterceptorChainFactory().buildInterceptorChain(cache);
 335   
 336    // test the chain size.
 337  1 list = InterceptorChainFactory.asList(chain);
 338  1 interceptors = list.iterator();
 339   
 340  1 Assert.assertEquals(7, list.size());
 341   
 342  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 343  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 344  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 345  1 assertEquals(InvalidationInterceptor.class, interceptors.next().getClass());
 346  1 assertEquals(UnlockInterceptor.class, interceptors.next().getClass());
 347  1 assertEquals(PessimisticLockInterceptor.class, interceptors.next().getClass());
 348  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 349   
 350  1 assertInterceptorLinkage(list);
 351    }
 352   
 353  1 public void testCacheMgmtConfig() throws Exception
 354    {
 355  1 cache.getConfiguration().setExposeManagementStatistics(true);
 356  1 Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
 357  1 List<Interceptor> list = InterceptorChainFactory.asList(chain);
 358  1 Iterator<Interceptor> interceptors = list.iterator();
 359   
 360  1 System.out.println("testCacheMgmtConfig interceptors are:\n" + list);
 361  1 assertNotNull(list);
 362  1 assertEquals(7, list.size());
 363   
 364  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 365  1 assertEquals(CacheMgmtInterceptor.class, interceptors.next().getClass());
 366  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 367  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 368  1 assertEquals(UnlockInterceptor.class, interceptors.next().getClass());
 369  1 assertEquals(PessimisticLockInterceptor.class, interceptors.next().getClass());
 370  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 371   
 372  1 assertInterceptorLinkage(list);
 373   
 374    }
 375   
 376  1 public void testEvictionInterceptorConfig() throws Exception
 377    {
 378  1 cache.getConfiguration().setEvictionConfig(new EvictionConfig()
 379    {
 380  1 public boolean isValidConfig()
 381    {
 382  1 return true;
 383    }
 384    }
 385    );
 386  1 Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
 387  1 List<Interceptor> list = InterceptorChainFactory.asList(chain);
 388  1 Iterator<Interceptor> interceptors = list.iterator();
 389   
 390  1 System.out.println("testEvictionInterceptorConfig interceptors are:\n" + list);
 391  1 assertNotNull(list);
 392  1 assertEquals(8, list.size());
 393   
 394  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 395  1 assertEquals(CacheMgmtInterceptor.class, interceptors.next().getClass());
 396  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 397  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 398  1 assertEquals(UnlockInterceptor.class, interceptors.next().getClass());
 399  1 assertEquals(PessimisticLockInterceptor.class, interceptors.next().getClass());
 400  1 assertEquals(EvictionInterceptor.class, interceptors.next().getClass());
 401  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 402   
 403  1 assertInterceptorLinkage(list);
 404    }
 405   
 406  1 public void testBuddyReplicationOptLocking() throws Exception
 407    {
 408  1 String xmlString = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
 409    "<buddyCommunicationTimeout>600000</buddyCommunicationTimeout>\n" +
 410    " <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>\n" +
 411    " <buddyLocatorProperties>numBuddies = 1</buddyLocatorProperties>\n";
 412   
 413  1 xmlString += "<buddyPoolName>buddyPoolName</buddyPoolName>";
 414  1 xmlString += "</config>";
 415  1 Element element = XmlHelper.stringToElement(xmlString);
 416  1 BuddyReplicationConfig brc = XmlConfigurationParser.parseBuddyReplicationConfig(element);
 417  1 cache.getConfiguration().setBuddyReplicationConfig(brc);
 418   
 419  1 cache.getConfiguration().setCacheMode("REPL_SYNC");
 420  1 cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
 421  1 cache.create();// initialise various subsystems such as BRManager
 422  1 Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
 423   
 424  1 List<Interceptor> list = InterceptorChainFactory.asList(chain);
 425  1 Iterator<Interceptor> interceptors = list.iterator();
 426   
 427  1 System.out.println("testEvictionInterceptorConfig interceptors are:\n" + list);
 428  1 assertNotNull(list);
 429  1 assertEquals(11, list.size());
 430   
 431  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 432  1 assertEquals(CacheMgmtInterceptor.class, interceptors.next().getClass());
 433  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 434  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 435  1 assertEquals(OptimisticReplicationInterceptor.class, interceptors.next().getClass());
 436  1 assertEquals(DataGravitatorInterceptor.class, interceptors.next().getClass());
 437  1 assertEquals(OptimisticLockingInterceptor.class, interceptors.next().getClass());
 438  1 assertEquals(OptimisticValidatorInterceptor.class, interceptors.next().getClass());
 439  1 assertEquals(OptimisticCreateIfNotExistsInterceptor.class, interceptors.next().getClass());
 440  1 assertEquals(OptimisticNodeInterceptor.class, interceptors.next().getClass());
 441  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 442   
 443  1 assertInterceptorLinkage(list);
 444    }
 445   
 446  1 public void testBuddyReplicationPessLocking() throws Exception
 447    {
 448  1 String xmlString = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
 449    "<buddyCommunicationTimeout>600000</buddyCommunicationTimeout>\n" +
 450    " <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>\n" +
 451    " <buddyLocatorProperties>numBuddies = 1</buddyLocatorProperties>\n";
 452   
 453  1 xmlString += "<buddyPoolName>buddyPoolName</buddyPoolName>";
 454  1 xmlString += "</config>";
 455  1 Element element = XmlHelper.stringToElement(xmlString);
 456  1 BuddyReplicationConfig brc = XmlConfigurationParser.parseBuddyReplicationConfig(element);
 457  1 cache.getConfiguration().setBuddyReplicationConfig(brc);
 458   
 459  1 cache.getConfiguration().setCacheMode("REPL_SYNC");
 460  1 cache.create();// initialise various subsystems such as BRManager
 461  1 Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
 462   
 463  1 List<Interceptor> list = InterceptorChainFactory.asList(chain);
 464  1 Iterator<Interceptor> interceptors = list.iterator();
 465   
 466  1 System.out.println("testEvictionInterceptorConfig interceptors are:\n" + list);
 467  1 assertNotNull(list);
 468  1 assertEquals(9, list.size());
 469   
 470  1 assertEquals(InvocationContextInterceptor.class, interceptors.next().getClass());
 471  1 assertEquals(CacheMgmtInterceptor.class, interceptors.next().getClass());
 472  1 assertEquals(TxInterceptor.class, interceptors.next().getClass());
 473  1 assertEquals(NotificationInterceptor.class, interceptors.next().getClass());
 474  1 assertEquals(ReplicationInterceptor.class, interceptors.next().getClass());
 475  1 assertEquals(UnlockInterceptor.class, interceptors.next().getClass());
 476  1 assertEquals(DataGravitatorInterceptor.class, interceptors.next().getClass());
 477  1 assertEquals(PessimisticLockInterceptor.class, interceptors.next().getClass());
 478  1 assertEquals(CallInterceptor.class, interceptors.next().getClass());
 479   
 480  1 assertInterceptorLinkage(list);
 481    }
 482   
 483   
 484  1 public static Test suite()
 485    {
 486  1 return new TestSuite(InterceptorChainFactoryTest.class);
 487    }
 488   
 489  0 public static void main(String[] args)
 490    {
 491  0 junit.textui.TestRunner.run(suite());
 492    }
 493   
 494    }