[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/optimistic ...
Manik Surtani
msurtani at jboss.com
Wed Jan 17 11:24:07 EST 2007
User: msurtani
Date: 07/01/17 11:24:07
Added: tests/functional/org/jboss/cache/optimistic
HasChildTest.java
Log:
JBCACHE-565
Revision Changes Path
1.1 date: 2007/01/17 16:24:07; author: msurtani; state: Exp;JBossCache/tests/functional/org/jboss/cache/optimistic/HasChildTest.java
Index: HasChildTest.java
===================================================================
package org.jboss.cache.optimistic;
import org.jboss.cache.CacheImpl;
import org.jboss.cache.Fqn;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
/**
* Tests the hasChild() API
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
* @since 2.0.0
*/
public class HasChildTest extends AbstractOptimisticTestCase
{
private CacheImpl cache;
private TransactionManager txMgr;
private Fqn f = Fqn.fromString("/a");
protected void setUp() throws Exception
{
cache = createCache();
txMgr = cache.getTransactionManager();
}
protected void tearDown()
{
destroyCache(cache);
}
public HasChildTest(String name)
{
super(name);
}
public void testExists() throws Exception
{
cache.put(f, "k", "v");
assertTrue(cache.getRoot().hasChild(f));
cache.remove(f);
assertFalse(cache.getRoot().hasChild(f));
txMgr.begin();
cache.put(f, "k", "v");
assertTrue(cache.getRoot().hasChild(f));
Transaction t = txMgr.suspend();
assertFalse(cache.getRoot().hasChild(f));
txMgr.resume(t);
assertTrue(cache.getRoot().hasChild(f));
txMgr.commit();
assertTrue(cache.getRoot().hasChild(f));
txMgr.begin();
assertTrue(cache.getRoot().hasChild(f));
cache.remove(f);
assertFalse(cache.getRoot().hasChild(f));
t = txMgr.suspend();
assertTrue(cache.getRoot().hasChild(f));
txMgr.resume(t);
assertFalse(cache.getRoot().hasChild(f));
txMgr.commit();
assertFalse(cache.getRoot().hasChild(f));
}
}
More information about the jboss-cvs-commits
mailing list