Clover coverage report -
Coverage timestamp: Wed Jan 31 2007 15:38:53 EST
file stats: LOC: 93   Methods: 8
NCLOC: 64   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
GetKeysTest.java - 96.6% 87.5% 94.6%
coverage coverage
 1    /*
 2    * JBoss, the OpenSource J2EE webOS
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache;
 8   
 9   
 10    import junit.framework.Test;
 11    import junit.framework.TestCase;
 12    import junit.framework.TestSuite;
 13   
 14    import java.io.ByteArrayOutputStream;
 15    import java.io.ObjectOutputStream;
 16    import java.util.Set;
 17   
 18   
 19    /**
 20    * @author <a href="mailto:bela@jboss.org">Bela Ban</a>
 21    * @version $Id: GetKeysTest.java,v 1.5 2007/01/11 13:49:06 msurtani Exp $
 22    */
 23    public class GetKeysTest extends TestCase
 24    {
 25    CacheImpl cache;
 26   
 27  2 public GetKeysTest(String s)
 28    {
 29  2 super(s);
 30    }
 31   
 32  2 public void setUp() throws Exception
 33    {
 34  2 super.setUp();
 35    }
 36   
 37  2 public void tearDown() throws Exception
 38    {
 39  2 super.tearDown();
 40    }
 41   
 42  1 public void testGetKeys() throws Exception
 43    {
 44  1 cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache();
 45  1 cache.put("/a/b/c", "name", "Bela Ban");
 46  1 cache.put("/a/b/c", "age", 40);
 47  1 cache.put("/a/b/c", "city", "Kreuzlingen");
 48   
 49  1 Set keys = cache.getKeys("/a/b/c");
 50  1 log("keys are " + keys);
 51  1 assertNotNull(keys);
 52  1 assertEquals(3, keys.size());
 53   
 54  1 ByteArrayOutputStream outstream = new ByteArrayOutputStream(20);
 55  1 ObjectOutputStream out = new ObjectOutputStream(outstream);
 56  1 out.writeObject(keys);// must be serializable
 57    }
 58   
 59  1 public void testGetChildren() throws Exception
 60    {
 61  1 cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache();
 62  1 cache.put("/a/b/c", null);
 63  1 cache.put("/a/b/c/1", null);
 64  1 cache.put("/a/b/c/2", null);
 65  1 cache.put("/a/b/c/3", null);
 66   
 67  1 Set children = cache.getChildrenNames("/a/b/c");
 68  1 log("children are " + children);
 69  1 assertNotNull(children);
 70  1 assertEquals(3, children.size());
 71   
 72  1 ByteArrayOutputStream outstream = new ByteArrayOutputStream(20);
 73  1 ObjectOutputStream out = new ObjectOutputStream(outstream);
 74  1 out.writeObject(children);// must be serializable
 75    }
 76   
 77   
 78  2 void log(String msg)
 79    {
 80  2 System.out.println("-- " + msg);
 81    }
 82   
 83  1 public static Test suite()
 84    {
 85  1 return new TestSuite(GetKeysTest.class);
 86    }
 87   
 88  0 public static void main(String[] args)
 89    {
 90  0 junit.textui.TestRunner.run(suite());
 91    }
 92   
 93    }