[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/interceptors ...
Manik Surtani
msurtani at jboss.com
Thu Aug 24 12:30:10 EDT 2006
User: msurtani
Date: 06/08/24 12:30:10
Added: tests/functional/org/jboss/cache/interceptors
InterceptorCacheReferenceTest.java
Log:
fixed
- notifications with opt locking
- single cache spi instance being created when using opt locking (in TreeCache)
- added interceptor cache reference test
Revision Changes Path
1.1 date: 2006/08/24 16:30:10; author: msurtani; state: Exp;JBossCache/tests/functional/org/jboss/cache/interceptors/InterceptorCacheReferenceTest.java
Index: InterceptorCacheReferenceTest.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.cache.interceptors;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.DefaultCacheFactory;
import junit.framework.TestCase;
/**
* Tests that all interceptors in a given interceptor chain have the same cache instance.
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
*/
public class InterceptorCacheReferenceTest extends TestCase
{
public void testPessLocking() throws Exception
{
Configuration c = new Configuration();
c.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
Cache cache = new DefaultCacheFactory().createCache(c);
assertInterceptorsHaveSameCache((CacheSPI) cache);
cache.stop();
}
public void testOptLocking() throws Exception
{
Configuration c = new Configuration();
c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
Cache cache = new DefaultCacheFactory().createCache(c);
assertInterceptorsHaveSameCache((CacheSPI) cache);
cache.stop();
}
private void assertInterceptorsHaveSameCache(CacheSPI c) throws Exception
{
for (Interceptor i : c.getInterceptorChain())
{
System.out.println("Testing " + i);
assertSame(c, i.cache);
}
}
}
More information about the jboss-cvs-commits
mailing list