Clover coverage report -
Coverage timestamp: Wed Jan 31 2007 15:38:53 EST
file stats: LOC: 79   Methods: 5
NCLOC: 57   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ChainingCacheLoaderBasicTest.java 50% 75% 80% 71.4%
coverage coverage
 1    /*
 2    * JBoss, Home of Professional Open Source
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache.loader;
 8   
 9    import junit.framework.Test;
 10    import junit.framework.TestSuite;
 11   
 12    import org.jboss.cache.config.CacheLoaderConfig;
 13    import org.jboss.cache.factories.XmlConfigurationParser;
 14    import org.jboss.cache.xml.XmlHelper;
 15    import org.w3c.dom.Element;
 16   
 17    import java.io.File;
 18   
 19    /**
 20    * Tests basic functionality of a chaining cache loader with 2 different loaders
 21    *
 22    * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
 23    */
 24    public class ChainingCacheLoaderBasicTest extends CacheLoaderTestsBase
 25    {
 26    private String loc1 = System.getProperty("java.io.tmpdir", ".") + File.separator + "JBossCache-ChainingCacheLoaderBasicTest-1";
 27    private String loc2 = System.getProperty("java.io.tmpdir", ".") + File.separator + "JBossCache-ChainingCacheLoaderBasicTest-2";
 28   
 29  59 public ChainingCacheLoaderBasicTest()
 30    {
 31  59 File dir1 = new File(loc1);
 32  59 File dir2 = new File(loc2);
 33   
 34  0 if (!dir1.exists()) dir1.mkdirs();
 35  0 if (!dir2.exists()) dir2.mkdirs();
 36    }
 37   
 38  59 protected void configureCache() throws Exception
 39    {
 40  59 cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(loc1, loc2));
 41    }
 42   
 43  59 protected CacheLoaderConfig getCacheLoaderConfig(String loc1, String loc2) throws Exception
 44    {
 45  59 String xml = "<config>\n" +
 46    "<passivation>false</passivation>\n" +
 47    "<preload></preload>\n" +
 48    "<cacheloader>\n" +
 49    "<class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
 50    "<properties>" +
 51    " location=" + loc1 + "\n" +
 52    "</properties>\n" +
 53    "<async>false</async>\n" +
 54    "<fetchPersistentState>true</fetchPersistentState>\n" +
 55    "</cacheloader>\n" +
 56    "<cacheloader>\n" +
 57    "<class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
 58    "<properties>" +
 59    " location=" + loc2 + "\n" +
 60    "</properties>\n" +
 61    "<async>false</async>\n" +
 62    "<fetchPersistentState>false</fetchPersistentState>\n" +
 63    "</cacheloader>\n" +
 64    "</config>";
 65  59 Element element = XmlHelper.stringToElement(xml);
 66  59 return XmlConfigurationParser.parseCacheLoaderConfig(element);
 67    }
 68   
 69  1 public static Test suite()
 70    {
 71  1 return new TestSuite(ChainingCacheLoaderBasicTest.class);
 72    }
 73   
 74   
 75  0 public static void main(String[] args)
 76    {
 77  0 junit.textui.TestRunner.run(suite());
 78    }
 79    }