1 package org.jboss.cache.optimistic; 2 3 import org.jboss.cache.CacheSPI; 4 import org.jboss.cache.interceptors.Interceptor; 5 import org.jboss.cache.marshall.MethodCall; 6 7 import java.util.ArrayList ; 8 import java.util.List ; 9 10 18 public class MockFailureInterceptor extends Interceptor 19 { 20 21 22 public void setCache(CacheSPI cache) 23 { 24 super.setCache(cache); 25 } 26 27 28 private List allCalled = new ArrayList (); 29 private List failurelist = new ArrayList (); 30 31 public Object invoke(MethodCall m) throws Throwable 32 { 33 if (failurelist.contains(m.getMethod())) 34 { 35 throw new Exception ("Failure in method" + m); 36 } 37 38 allCalled.add(m.getMethod()); 39 40 return null; 41 } 42 43 44 47 public List getFailurelist() 48 { 49 return failurelist; 50 } 51 52 55 public void setFailurelist(List failurelist) 56 { 57 this.failurelist = failurelist; 58 } 59 60 63 public List getAllCalled() 64 { 65 return allCalled; 66 } 67 68 71 public void setAllCalled(List called) 72 { 73 this.allCalled = called; 74 } 75 } | Popular Tags |