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

Manik Surtani msurtani at jboss.com
Wed Oct 18 07:07:54 EDT 2006


  User: msurtani
  Date: 06/10/18 07:07:54

  Modified:    tests/functional/org/jboss/cache/notifications 
                        CacheListenerTest.java
  Log:
  * added more tests for the move() API
  * added a nodeMoved listener event
  * moved some methods from CacheSPI to Cache
  
  Revision  Changes    Path
  1.5       +38 -12    JBossCache/tests/functional/org/jboss/cache/notifications/CacheListenerTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheListenerTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/notifications/CacheListenerTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- CacheListenerTest.java	16 Sep 2006 00:23:36 -0000	1.4
  +++ CacheListenerTest.java	18 Oct 2006 11:07:54 -0000	1.5
  @@ -13,6 +13,7 @@
   import org.jboss.cache.Cache;
   import org.jboss.cache.CacheSPI;
   import org.jboss.cache.Fqn;
  +import org.jboss.cache.Node;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.factories.DefaultCacheFactory;
   import org.jboss.cache.lock.IsolationLevel;
  @@ -167,7 +168,25 @@
   
      public void testMove()
      {
  -      fail("implement me");
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      Fqn newParent = Fqn.fromString("/a");
  +      cache.put(fqn, "key", "value");
  +      cache.put(newParent, "key", "value");
  +
  +      Node n1 = cache.getChild(fqn);
  +      Node n2 = cache.getChild(newParent);
  +
  +      eventLog.events.clear(); // clear events
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +
  +      n1.move(n2);
  +      //expected
  +      Fqn newFqn = new Fqn(newParent, fqn.getLast());
  +      List<Event> expected = new ArrayList<Event>();
  +      expected.add(new Event(ListenerMethod.NODE_MODIFIED, fqn, true, false, null));
  +      expected.add(new Event(ListenerMethod.NODE_MODIFIED, newFqn, true, false, null));
  +      expected.add(new Event(ListenerMethod.NODE_MODIFIED, fqn, false, false, null));
  +      expected.add(new Event(ListenerMethod.NODE_MODIFIED, newFqn, false, false, null));
      }
   
      // -- now the transactional ones
  @@ -309,6 +328,14 @@
            events.add(e);
         }
   
  +      public void nodeMoved(Fqn from, Fqn to, boolean pre)
  +      {
  +         Event e = new Event(ListenerMethod.NODE_MOVED, from, pre, false, null);
  +         events.add(e);
  +         e = new Event(ListenerMethod.NODE_MOVED, to, pre, false, null);
  +         events.add(e);
  +      }
  +
   
         public String toString()
         {
  @@ -377,7 +404,6 @@
   
      public enum ListenerMethod
      {
  -      NODE_CREATED, NODE_REMOVED, NODE_VISITED, NODE_MODIFIED}
  -
  -   ;
  +      NODE_CREATED, NODE_REMOVED, NODE_VISITED, NODE_MODIFIED, NODE_MOVED
  +   }
   }
  
  
  



More information about the jboss-cvs-commits mailing list