Package org.jboss.cache.interceptors.base

Examples of org.jboss.cache.interceptors.base.CommandInterceptor


   @BeforeMethod
   public void setUp() throws Exception
   {
      pojo = new SamplePojo(21, "test");
      cache = createCache();
      CommandInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
      dummy = new MockInterceptor();

      interceptor.setNext(dummy);

      TestingUtil.replaceInterceptorChain(cache, interceptor);

      setupTransactionsInInvocationCtx(cache);
   }
View Full Code Here


   {
      List<CommandInterceptor> interceptors = cache.getInterceptorChain();
      assertEquals("Expecting 6 interceptors", 6, interceptors.size());
      assertInterceptorLinkage(interceptors);

      CommandInterceptor x = new TestInterceptor();
      cache.addInterceptor(x, 0);

      interceptors = cache.getInterceptorChain();
      assertEquals("Expecting 7 interceptors", 7, interceptors.size());
      assertInterceptorLinkage(interceptors);
View Full Code Here

   {
      List<CommandInterceptor> interceptors = cache.getInterceptorChain();
      assertEquals("Expecting 6 interceptors", 6, interceptors.size());
      assertInterceptorLinkage(interceptors);

      CommandInterceptor x = new TestInterceptor();
      cache.addInterceptor(x, 6);

      interceptors = cache.getInterceptorChain();
      assertEquals("Expecting 7 interceptors", 7, interceptors.size());
      assertInterceptorLinkage(interceptors);
View Full Code Here

   {
      List<CommandInterceptor> interceptors = cache.getInterceptorChain();
      assertEquals("Expecting 6 interceptors", 6, interceptors.size());
      assertInterceptorLinkage(interceptors);

      CommandInterceptor x = new TestInterceptor();
      cache.addInterceptor(x, 3);

      interceptors = cache.getInterceptorChain();
      assertEquals("Expecting 7 interceptors", 7, interceptors.size());
      assertInterceptorLinkage(interceptors);
View Full Code Here

   {
      List<CommandInterceptor> interceptors = cache.getInterceptorChain();
      assertEquals("Expecting 6 interceptors", 6, interceptors.size());
      assertInterceptorLinkage(interceptors);

      CommandInterceptor x = new TestInterceptor();
      try
      {
         cache.addInterceptor(x, 9);
         fail("Should throw an exception");
      }
View Full Code Here

   }

   public void testRemoveAtHead()
   {
      List<CommandInterceptor> interceptors = cache.getInterceptorChain();
      CommandInterceptor afterHead = interceptors.get(1);
      assertEquals("Expecting 6 interceptors", 6, interceptors.size());
      assertInterceptorLinkage(interceptors);

      cache.removeInterceptor(0);
View Full Code Here

   }

   public void testRemoveAtTail()
   {
      List<CommandInterceptor> interceptors = cache.getInterceptorChain();
      CommandInterceptor beforeTail = interceptors.get(4);
      assertEquals("Expecting 6 interceptors", 6, interceptors.size());
      assertInterceptorLinkage(interceptors);

      cache.removeInterceptor(5);
View Full Code Here

*/
public abstract class InterceptorChainTestBase
{
   protected void assertInterceptorLinkage(List<CommandInterceptor> list)
   {
      CommandInterceptor previous = null;
      for (CommandInterceptor i : list)
      {
         if (previous == null)
         {
            previous = i;
            continue;
         }

         assertEquals("Expecting the next interceptor after " + previous + " to be " + i, i, previous.getNext());

         previous = i;
      }
   }
View Full Code Here

   @BeforeMethod
   public void setUp() throws Exception
   {
      cache = createCache();
      CommandInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
      CommandInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
      dummy = new MockInterceptor();

      interceptor.setNext(nodeInterceptor);
      nodeInterceptor.setNext(dummy);

      TestingUtil.replaceInterceptorChain(cache, interceptor);
   }
View Full Code Here

   public void testConcurrentPut() throws Exception
   {
      final String slowThreadName = "SLOW";
      final String fastThreadName = "FAST";
      CommandInterceptor slowdownInterceptor = new CommandInterceptor()
      {
         public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
         {
            if (Thread.currentThread().getName().equals(slowThreadName))
            {
View Full Code Here

TOP

Related Classes of org.jboss.cache.interceptors.base.CommandInterceptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.