Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 55   Methods: 4
NCLOC: 35   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
BdbjeCacheLoaderTest.java - 93.3% 75% 89.5%
coverage coverage
 1    package org.jboss.cache.loader;
 2   
 3    import junit.framework.Test;
 4    import junit.framework.TestSuite;
 5    import org.jboss.cache.Fqn;
 6    import org.jboss.cache.misc.TestingUtil;
 7   
 8    /**
 9    * Runs the same tests as {@link FileCacheLoaderTest}, but with Berkeley DB instead of a file-based CacheLoader
 10    *
 11    * @author Bela Ban
 12    * @version $Id: BdbjeCacheLoaderTest.java,v 1.21 2007/06/08 10:49:28 msurtani Exp $
 13    */
 14    public class BdbjeCacheLoaderTest extends CacheLoaderTestsBase
 15    {
 16  62 protected void configureCache() throws Exception
 17    {
 18  62 String tmpDir = System.getProperty("java.io.tmpdir", "/tmp");
 19  62 String tmpCLLoc = tmpDir + "/JBossCache-FileCacheLoaderTest";
 20   
 21  62 cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.bdbje.BdbjeCacheLoader", "location=" + tmpCLLoc, false, true, false));
 22  62 TestingUtil.recursiveFileRemove(tmpCLLoc);
 23    }
 24   
 25  1 public void testTransaction() throws Exception
 26    {
 27    // to help recreate the issue in
 28    // http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048003#4048003
 29   
 30  1 Fqn fqn = Fqn.fromString("/a/b/c");
 31  1 String key = "key", value = "value";
 32   
 33  1 cache.put(fqn, key, value);
 34  1 cache.getTransactionManager().begin();
 35  1 assertEquals(value, cache.get(fqn, key));
 36  1 cache.getTransactionManager().commit();
 37   
 38    // now repeat this.
 39   
 40  1 cache.getTransactionManager().begin();
 41  1 assertEquals(value, cache.get(fqn, key));
 42  1 cache.getTransactionManager().commit();
 43    }
 44   
 45  1 public static Test suite()
 46    {
 47  1 return new TestSuite(BdbjeCacheLoaderTest.class);
 48    }
 49   
 50  0 public static void main(String[] args)
 51    {
 52  0 junit.textui.TestRunner.run(suite());
 53    }
 54   
 55    }