[jboss-cvs] JBossCache/tests/functional/org/jboss/cache ...

Manik Surtani msurtani at jboss.com
Sat Dec 30 12:49:54 EST 2006


  User: msurtani
  Date: 06/12/30 12:49:54

  Modified:    tests/functional/org/jboss/cache          CallbackTest.java
                        GetKeysTest.java LifeCycleTest.java
                        TreeNodeTest.java HungChannelTest.java FqnTest.java
                        TreeCacheFunctionalTest.java
  Added:       tests/functional/org/jboss/cache         
                        UnversionedNodeTest.java
  Removed:     tests/functional/org/jboss/cache          NodeImplTest.java
  Log:
  Major changes to restructure cache and node object model
  
  Revision  Changes    Path
  1.14      +11 -11    JBossCache/tests/functional/org/jboss/cache/CallbackTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CallbackTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/CallbackTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- CallbackTest.java	6 Sep 2006 15:31:01 -0000	1.13
  +++ CallbackTest.java	30 Dec 2006 17:49:54 -0000	1.14
  @@ -14,11 +14,11 @@
    * Tests whether modifications within callbacks (TreeCacheListener) are handled correctly
    *
    * @author Bela Ban
  - * @version $Id: CallbackTest.java,v 1.13 2006/09/06 15:31:01 msurtani Exp $
  + * @version $Id: CallbackTest.java,v 1.14 2006/12/30 17:49:54 msurtani Exp $
    */
   public class CallbackTest extends TestCase
   {
  -   TreeCache cache = null, cache2;
  +   CacheImpl cache = null, cache2;
      Transaction tx = null;
      final Fqn FQN_A = Fqn.fromString("/a");
      final Fqn FQN_B = Fqn.fromString("/b");
  @@ -121,8 +121,8 @@
      }
   
      /*public void testSyncReplicationWith2Caches() throws Exception, NotSupportedException {
  -      cache=createCache(TreeCache.REPL_SYNC, IsolationLevel.SERIALIZABLE);
  -      cache2=createCache(TreeCache.REPL_SYNC, IsolationLevel.SERIALIZABLE);
  +      cache=createCache(CacheImpl.REPL_SYNC, IsolationLevel.SERIALIZABLE);
  +      cache2=createCache(CacheImpl.REPL_SYNC, IsolationLevel.SERIALIZABLE);
         cache.setSyncCommitPhase(true);
         cache2.setSyncCommitPhase(true);
   
  @@ -164,9 +164,9 @@
   }*/
   
   
  -   TreeCache createCache(Configuration.CacheMode mode, IsolationLevel level) throws Exception
  +   CacheImpl createCache(Configuration.CacheMode mode, IsolationLevel level) throws Exception
      {
  -      TreeCache c = new TreeCache();
  +      CacheImpl c = new CacheImpl();
         c.getConfiguration().setCacheMode(mode);
         c.getConfiguration().setIsolationLevel(level);
         c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  @@ -201,10 +201,10 @@
   
      class GetListener extends AbstractCacheListener
      {
  -      TreeCache c;
  +      CacheImpl c;
         Fqn my_fqn;
   
  -      public GetListener(TreeCache c, Fqn my_fqn)
  +      public GetListener(CacheImpl c, Fqn my_fqn)
         {
            this.c = c;
            this.my_fqn = my_fqn;
  @@ -216,7 +216,7 @@
            {
               try
               {
  -               TreeNode n = c.get(this.my_fqn);
  +               Node n = c.get(this.my_fqn);
                  assertNotNull(n);
               }
               catch (CacheException e)
  @@ -230,9 +230,9 @@
   
      class PutListener extends AbstractCacheListener
      {
  -      TreeCache c;
  +      CacheImpl c;
   
  -      public PutListener(TreeCache c)
  +      public PutListener(CacheImpl c)
         {
            this.c = c;
         }
  
  
  
  1.3       +4 -4      JBossCache/tests/functional/org/jboss/cache/GetKeysTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: GetKeysTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/GetKeysTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- GetKeysTest.java	6 Sep 2006 15:31:01 -0000	1.2
  +++ GetKeysTest.java	30 Dec 2006 17:49:54 -0000	1.3
  @@ -18,11 +18,11 @@
   
   /**
    * @author <a href="mailto:bela at jboss.org">Bela Ban</a>
  - * @version $Id: GetKeysTest.java,v 1.2 2006/09/06 15:31:01 msurtani Exp $
  + * @version $Id: GetKeysTest.java,v 1.3 2006/12/30 17:49:54 msurtani Exp $
    */
   public class GetKeysTest extends TestCase
   {
  -   TreeCache cache;
  +   CacheImpl cache;
   
      public GetKeysTest(String s)
      {
  @@ -41,7 +41,7 @@
   
      public void testGetKeys() throws Exception
      {
  -      cache = new TreeCache();
  +      cache = new CacheImpl();
         cache.create();
         cache.start();
         cache.put("/a/b/c", "name", "Bela Ban");
  @@ -60,7 +60,7 @@
   
      public void testGetChildren() throws Exception
      {
  -      cache = new TreeCache();
  +      cache = new CacheImpl();
         cache.create();
         cache.start();
         cache.put("/a/b/c", null);
  
  
  
  1.6       +11 -11    JBossCache/tests/functional/org/jboss/cache/LifeCycleTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LifeCycleTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/LifeCycleTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- LifeCycleTest.java	15 Dec 2006 14:22:25 -0000	1.5
  +++ LifeCycleTest.java	30 Dec 2006 17:49:54 -0000	1.6
  @@ -13,10 +13,10 @@
   import javax.transaction.Transaction;
   
   /**
  - * Tests restart (stop-destroy-create-start) of TreeCache
  + * Tests restart (stop-destroy-create-start) of CacheImpl
    *
    * @author Bela Ban
  - * @version $Id: LifeCycleTest.java,v 1.5 2006/12/15 14:22:25 msurtani Exp $
  + * @version $Id: LifeCycleTest.java,v 1.6 2006/12/30 17:49:54 msurtani Exp $
    */
   public class LifeCycleTest extends TestCase
   {
  @@ -25,7 +25,7 @@
   
      public void testLocalRestartNoTransactions() throws Exception
      {
  -      TreeCache cache = createCache(Configuration.CacheMode.LOCAL);
  +      CacheImpl cache = createCache(Configuration.CacheMode.LOCAL);
         cache.create();
         cache.start();
   
  @@ -44,7 +44,7 @@
   
      public void testLocalRestartWithTransactions() throws Exception
      {
  -      TreeCache cache = createCache(Configuration.CacheMode.LOCAL);
  +      CacheImpl cache = createCache(Configuration.CacheMode.LOCAL);
         cache.create();
         cache.start();
   
  @@ -67,7 +67,7 @@
   
      public void testStartNoCreate() throws Exception
      {
  -      TreeCache cache = createCache(Configuration.CacheMode.LOCAL);
  +      CacheImpl cache = createCache(Configuration.CacheMode.LOCAL);
         cache.start();
   
         cache.put("/a/b/c", null);
  @@ -84,7 +84,7 @@
   
      public void testReStartNoCreate() throws Exception
      {
  -      TreeCache cache = createCache(Configuration.CacheMode.LOCAL);
  +      CacheImpl cache = createCache(Configuration.CacheMode.LOCAL);
         cache.start();
         cache.stop();
         cache.start();
  @@ -101,9 +101,9 @@
         assertEquals(0, cache.getNumberOfLocksHeld());
      }
   
  -   TreeCache createCache(Configuration.CacheMode cache_mode) throws Exception
  +   CacheImpl createCache(Configuration.CacheMode cache_mode) throws Exception
      {
  -      TreeCache retval = new TreeCache();
  +      CacheImpl retval = new CacheImpl();
         retval.getConfiguration().setCacheMode(cache_mode);
         retval.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         return retval;
  @@ -119,19 +119,19 @@
      }
   
   
  -   void startCache(TreeCache c) throws Exception
  +   void startCache(CacheImpl c) throws Exception
      {
         c.create();
         c.start();
      }
   
  -   void stopCache(TreeCache c)
  +   void stopCache(CacheImpl c)
      {
         c.stop();
         c.destroy();
      }
   
  -   void restartCache(TreeCache c) throws Exception
  +   void restartCache(CacheImpl c) throws Exception
      {
         stopCache(c);
         startCache(c);
  
  
  
  1.4       +9 -9      JBossCache/tests/functional/org/jboss/cache/TreeNodeTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeNodeTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/TreeNodeTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- TreeNodeTest.java	20 Nov 2006 03:53:55 -0000	1.3
  +++ TreeNodeTest.java	30 Dec 2006 17:49:54 -0000	1.4
  @@ -5,19 +5,19 @@
   import junit.framework.TestSuite;
   
   /**
  - * Tests restart (stop-destroy-create-start) of TreeCache
  + * Tests restart (stop-destroy-create-start) of CacheImpl
    *
    * @author Bela Ban
  - * @version $Id: TreeNodeTest.java,v 1.3 2006/11/20 03:53:55 genman Exp $
  + * @version $Id: TreeNodeTest.java,v 1.4 2006/12/30 17:49:54 msurtani Exp $
    */
   public class TreeNodeTest extends TestCase
   {
  -   TreeCache cache;
  +   CacheImpl cache;
   
      protected void setUp() throws Exception
      {
         super.setUp();
  -      cache = new TreeCache();
  +      cache = new CacheImpl();
         startCache(cache);
      }
   
  @@ -31,16 +31,16 @@
      {
         Object key = new Integer(1);
         cache.put("/a/b/c", key, "test");
  -      DataNode node;
  +      Node node;
         node = cache.get("/a/b");
         assertFalse(node.getChildren().isEmpty());
  -      assertTrue(node.getChild("c") != null);
  +      assertTrue(node.getChild(new Fqn("c")) != null);
   
         Fqn fqn = Fqn.fromString("/e/f");
         cache.put(fqn, "1", "1");
         node = cache.get("/e");
         assertFalse(node.getChildren().isEmpty());
  -      assertTrue(node.getChild("f") != null);
  +      assertTrue(node.getChild(new Fqn("f")) != null);
   
      }
   
  @@ -84,13 +84,13 @@
       * }
       */
   
  -   void startCache(TreeCache c) throws Exception
  +   void startCache(CacheImpl c) throws Exception
      {
         c.create();
         c.start();
      }
   
  -   void stopCache(TreeCache c)
  +   void stopCache(CacheImpl c)
      {
         c.stop();
         c.destroy();
  
  
  
  1.3       +2 -2      JBossCache/tests/functional/org/jboss/cache/HungChannelTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: HungChannelTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/HungChannelTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- HungChannelTest.java	11 Oct 2006 13:20:27 -0000	1.2
  +++ HungChannelTest.java	30 Dec 2006 17:49:54 -0000	1.3
  @@ -18,11 +18,11 @@
    */
   public class HungChannelTest extends TestCase
   {
  -   private TreeCache cache;
  +   private CacheImpl cache;
   
      protected void setUp() throws Exception
      {
  -      cache = new TreeCache();
  +      cache = new CacheImpl();
         cache.getConfiguration().setCacheMode("REPL_SYNC");
      }
   
  
  
  
  1.17      +4 -4      JBossCache/tests/functional/org/jboss/cache/FqnTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FqnTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/FqnTest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- FqnTest.java	31 Oct 2006 06:57:29 -0000	1.16
  +++ FqnTest.java	30 Dec 2006 17:49:54 -0000	1.17
  @@ -20,7 +20,7 @@
    * Tests {@link Fqn}.
    *
    * @author <a href="mailto:bela at jboss.org">Bela Ban</a> May 9, 2003
  - * @version $Revision: 1.16 $
  + * @version $Revision: 1.17 $
    */
   public class FqnTest extends TestCase
   {
  @@ -310,7 +310,7 @@
      public void testRemovalNonString() throws Exception
      {
         Fqn f = new Fqn(new Object[]{"test", new Integer(1)});
  -//       TreeCache tc = new TreeCache();
  +//       CacheImpl tc = new CacheImpl();
   //       tc.getConfiguration().setCacheMode("LOCAL");
   //       tc.start();
         Configuration c = new Configuration();
  @@ -320,12 +320,12 @@
         cache.put(f, "key", "value");
   
         assertEquals("value", cache.get(f, "key"));
  -      assertTrue(cache.hasChild(f));
  +      assertTrue(cache.getRoot().hasChild(f));
   
         cache.removeNode(f);
   
         assertNull(cache.get(f, "key"));
  -      assertFalse(cache.hasChild(f));
  +      assertFalse(cache.getRoot().hasChild(f));
      }
   
      public void testGetChildFqn()
  
  
  
  1.6       +4 -4      JBossCache/tests/functional/org/jboss/cache/TreeCacheFunctionalTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCacheFunctionalTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/TreeCacheFunctionalTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- TreeCacheFunctionalTest.java	6 Sep 2006 15:31:01 -0000	1.5
  +++ TreeCacheFunctionalTest.java	30 Dec 2006 17:49:54 -0000	1.6
  @@ -10,14 +10,14 @@
   import java.util.HashMap;
   
   /**
  - * Simple functional tests for TreeCache
  + * Simple functional tests for CacheImpl
    *
    * @author Bela Ban
  - * @version $Id: TreeCacheFunctionalTest.java,v 1.5 2006/09/06 15:31:01 msurtani Exp $
  + * @version $Id: TreeCacheFunctionalTest.java,v 1.6 2006/12/30 17:49:54 msurtani Exp $
    */
   public class TreeCacheFunctionalTest extends TestCase
   {
  -   TreeCache cache = null;
  +   CacheImpl cache = null;
      Transaction tx = null;
      final Fqn FQN = Fqn.fromString("/myNode");
      final String KEY = "key";
  @@ -28,7 +28,7 @@
      protected void setUp() throws Exception
      {
         super.setUp();
  -      cache = new TreeCache();
  +      cache = new CacheImpl();
         cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
         cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
  
  
  
  1.1      date: 2006/12/30 17:49:54;  author: msurtani;  state: Exp;JBossCache/tests/functional/org/jboss/cache/UnversionedNodeTest.java
  
  Index: UnversionedNodeTest.java
  ===================================================================
  package org.jboss.cache;
  
  import junit.framework.TestCase;
  
  import java.util.Collections;
  
  public class UnversionedNodeTest extends TestCase
  {
     UnversionedNode node = new UnversionedNode(Fqn.ROOT);
  
     public void testBasic()
     {
        assertEquals(Collections.emptyMap(), node.getData());
        assertEquals(Collections.emptySet(), node.getChildren());
     }
     /*
     public void testOrder()
     {  
        node.orderData();
        // bypass invocation chain
        Map m = node.getNodeSPI().getRawData();
        m.put("a", "x");
        m.put("b", "x");
        m.put("c", "x");
        
        SortedMap sm = (SortedMap) node.getData();
        assertEquals(null, sm.comparator());
        assertEquals("a", sm.firstKey());
        assertEquals("c", sm.lastKey());
     }
        
     public void testOrder2()
     {  
        node.orderChildren();
        SortedMap<Object, Node> sm = (SortedMap) node.getChildrenMap();
        Node a = new UnversionedNode(new Fqn("a"));
        Node b = new UnversionedNode(new Fqn("b"));
        Node c = new UnversionedNode(new Fqn("c"));
        sm.put("a", a);
        sm.put("b", b);
        sm.put("c", c);
        SortedSet<Node> ss = (SortedSet) node.getChildren();
        assertEquals(a, ss.first());
        assertEquals(c, ss.last());
     }
     */
  
  }
  
  
  



More information about the jboss-cvs-commits mailing list