Clover coverage report -
Coverage timestamp: Wed Jan 31 2007 15:38:53 EST
file stats: LOC: 94   Methods: 6
NCLOC: 72   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
FileCacheLoaderTest.java 100% 95.2% 83.3% 93.9%
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   
 7    /**
 8    * Created by IntelliJ IDEA.
 9    * User: bela
 10    * Date: Jun 9, 2004
 11    * Time: 9:05:19 AM
 12    */
 13    public class FileCacheLoaderTest extends CacheLoaderTestsBase
 14    {
 15   
 16  62 protected void configureCache() throws Exception
 17    {
 18  62 cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", "", false, true, false));
 19    }
 20   
 21  1 public void testIsCharacterPortableLocation()
 22    {
 23  1 FileCacheLoader fcl = new FileCacheLoader();
 24   
 25  1 Object[][] data = new Object[][] {
 26    {"C:\\here\\there.txt", true},
 27    {"/home/here/there", true},
 28    {"/home/*/jboss", false},
 29    {"C:\\>/jgroups/jboss", false},
 30    {"/cache/jboss<", false},
 31    {"/pojocache|/galder", false},
 32    {"/pojocache/gal\"der", false}};
 33   
 34  1 for (int i=0; i < data.length; i++)
 35    {
 36  7 String path = (String)data[i][0];
 37  7 boolean expected = (Boolean)data[i][1];
 38  7 assertEquals(path, expected, fcl.isCharacterPortableLocation(path));
 39    }
 40    }
 41   
 42  1 public void testIsCharacterPortableTree()
 43    {
 44  1 FileCacheLoader fcl = new FileCacheLoader();
 45   
 46  1 Object[][] data = new Object[][] {
 47    {Fqn.fromString("/a/b/c/d/e"), true},
 48    {Fqn.fromString("/a/*/c/d/e"), false},
 49    {Fqn.fromString("/a/b/>/d/e"), false},
 50    {Fqn.fromString("/a/</c/d/e"), false},
 51    {Fqn.fromString("/|/b/c/d/e"), false},
 52    {Fqn.fromString("/|/b/c/d/e"), false},
 53    {Fqn.fromString("/a/b/c/d/\""), false},
 54    {Fqn.fromString("/a/b/c/d/\\"), false},
 55    {Fqn.fromString("/a/b/c/d///"), true},
 56    {Fqn.fromString("/a/b/c/:/e"), false}, };
 57   
 58  1 for (int i=0; i < data.length; i++)
 59    {
 60  10 Fqn fqn = (Fqn)data[i][0];
 61  10 boolean expected = (Boolean)data[i][1];
 62  10 assertEquals(fqn.toString(), expected, fcl.isCharacterPortableTree(fqn));
 63    }
 64    }
 65   
 66  1 public void testIsLengthPortablePath()
 67    {
 68  1 FileCacheLoader fcl = new FileCacheLoader();
 69   
 70  1 Object[][] data = new Object[][] {
 71    {"C:\\here\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\web_services\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\webservices\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\data.dat", true},
 72    {"C:\\there\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\web_services\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\webservices\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\data.dat", true},
 73    {"C:\\deerme\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\web_services\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\webservices\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\data.dat", false}};
 74   
 75  1 for (int i=0; i < data.length; i++)
 76    {
 77  3 String path = (String)data[i][0];
 78  3 boolean expected = (Boolean)data[i][1];
 79  3 assertEquals(path, expected, fcl.isLengthPortablePath(path));
 80    }
 81    }
 82   
 83  1 public static Test suite()
 84    {
 85  1 return new TestSuite(FileCacheLoaderTest.class);
 86    }
 87   
 88   
 89  0 public static void main(String[] args)
 90    {
 91  0 junit.textui.TestRunner.run(suite());
 92    }
 93   
 94    }