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

Manik Surtani msurtani at jboss.com
Fri Jan 5 06:42:53 EST 2007


  User: msurtani
  Date: 07/01/05 06:42:53

  Modified:    tests/functional/org/jboss/cache/notifications 
                        RemoteCacheListenerTest.java
  Log:
  - Configurations are now cloned before being used by the factory to guarantee ownership
  - Cloning configurations also resets RuntimeConfiguration of the clone
  - RemoteCacheListenerTest updated for completeness and thoroughness
  
  Revision  Changes    Path
  1.11      +177 -113  JBossCache/tests/functional/org/jboss/cache/notifications/RemoteCacheListenerTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RemoteCacheListenerTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/notifications/RemoteCacheListenerTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- RemoteCacheListenerTest.java	4 Jan 2007 17:52:20 -0000	1.10
  +++ RemoteCacheListenerTest.java	5 Jan 2007 11:42:53 -0000	1.11
  @@ -49,8 +49,8 @@
   
      protected boolean optLocking = false;
   
  -   private Cache cache, cache1;
  -   private EventLog eventLog = new EventLog();
  +   private Cache cache1, cache2;
  +   private EventLog eventLog1 = new EventLog(), eventLog2 = new EventLog();
      private Fqn fqn = Fqn.fromString("/test");
   
      protected void setUp() throws Exception
  @@ -62,17 +62,29 @@
         if (optLocking) c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
         c.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         c.setFetchInMemoryState(false);
  -      cache = DefaultCacheFactory.getInstance().createCache(c);
  +
  +      // we need this because notifications emitted by the notification interceptor are done during the commit call.
  +      // If we want to check notifications on remote nodes we need to make sure the commit completes before we test anything.
  +      c.setSyncCommitPhase(true);
  +
  +      // more time to help with debugging
  +      c.setSyncReplTimeout(60000);
  +
         cache1 = DefaultCacheFactory.getInstance().createCache(c);
  -      eventLog.events.clear();
  -      cache1.addCacheListener(eventLog);
  +      cache2 = DefaultCacheFactory.getInstance().createCache(c);
  +
  +      eventLog1.events.clear();
  +      eventLog2.events.clear();
  +
  +      cache1.addCacheListener(eventLog1);
  +      cache2.addCacheListener(eventLog2);
      }
   
      protected void tearDown() throws Exception
      {
         super.tearDown();
  -      TransactionManager tm = null;
  -      if ((tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager()) != null)
  +      TransactionManager tm;
  +      if ((tm = cache1.getConfiguration().getRuntimeConfig().getTransactionManager()) != null)
         {
            if (tm.getTransaction() != null)
            {
  @@ -86,7 +98,7 @@
               }
            }
         }
  -      if ((tm = cache1.getConfiguration().getRuntimeConfig().getTransactionManager()) != null)
  +      if ((tm = cache2.getConfiguration().getRuntimeConfig().getTransactionManager()) != null)
         {
            if (tm.getTransaction() != null)
            {
  @@ -101,163 +113,215 @@
            }
         }
   
  -      cache.stop();
  -      cache.destroy();
         cache1.stop();
         cache1.destroy();
  +      cache2.stop();
  +      cache2.destroy();
      }
   
      // simple tests first
   
      public void testCreation() throws Exception
      {
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  -      cache.put(fqn, "key", "value");
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
  +      cache1.put(fqn, "key", "value");
         Map data = new HashMap();
         data.put("key", "value");
   
  -      //expected
  -      List<CacheListenerEvent> expected = new ArrayList<CacheListenerEvent>();
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, true, false, null));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, false, false, null));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, false, Collections.emptyMap()));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, false, data));
  +      //expectedRemote
  +      List<CacheListenerEvent> expectedLocal = new ArrayList<CacheListenerEvent>();
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, true, true, null));
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, false, true, null));
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, true, Collections.emptyMap()));
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, true, data));
  +
  +      //expectedRemote
  +      List<CacheListenerEvent> expectedRemote = new ArrayList<CacheListenerEvent>();
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, true, false, null));
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, false, false, null));
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, false, Collections.emptyMap()));
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, false, data));
   
  -      assertEquals(expected, eventLog.events);
  -      assertEquals("value", cache.get(fqn, "key"));
  +      assertEquals(expectedLocal, eventLog1.events);
  +      assertEquals(expectedRemote, eventLog2.events);
  +      assertEquals("value", cache1.get(fqn, "key"));
      }
   
      public void testOnlyModification() throws Exception
      {
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  -      cache.put(fqn, "key", "value");
  +      assertNull(cache1.get(fqn, "key"));
  +      assertNull(cache2.get(fqn, "key"));
  +
  +      cache1.put(fqn, "key", "value");
         Map oldData = new HashMap();
         oldData.put("key", "value");
   
  -      assertEquals("value", cache.get(fqn, "key"));
         assertEquals("value", cache1.get(fqn, "key"));
  +      assertEquals("value", cache2.get(fqn, "key"));
   
         // clear event log
  -      eventLog.events.clear();
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      eventLog1.events.clear();
  +      eventLog2.events.clear();
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog1.events);
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
   
         // modify existing node
  -      cache.put(fqn, "key", "value2");
  +      cache1.put(fqn, "key", "value2");
         Map newData = new HashMap();
         newData.put("key", "value2");
   
  -      //expected
  -      List<CacheListenerEvent> expected = new ArrayList<CacheListenerEvent>();
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, false, oldData));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, false, newData));
  +      //expectedLocal
  +      List<CacheListenerEvent> expectedLocal = new ArrayList<CacheListenerEvent>();
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, true, oldData));
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, true, newData));
  +
  +      //expectedRemote
  +      List<CacheListenerEvent> expectedRemote = new ArrayList<CacheListenerEvent>();
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, false, oldData));
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, false, newData));
   
  -      assertEquals(expected, eventLog.events);
  +      assertEquals(expectedLocal, eventLog1.events);
  +      assertEquals(expectedRemote, eventLog2.events);
      }
   
   
      public void testOnlyRemoval() throws Exception
      {
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  -      cache.put(fqn, "key", "value");
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
  +      cache1.put(fqn, "key", "value");
         Map oldData = new HashMap();
         oldData.put("key", "value");
   
  -      assertEquals("value", cache.get(fqn, "key"));
         assertEquals("value", cache1.get(fqn, "key"));
  +      assertEquals("value", cache2.get(fqn, "key"));
   
         // clear event log
  -      eventLog.events.clear();
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      eventLog1.events.clear();
  +      eventLog2.events.clear();
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog1.events);
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
   
         // modify existing node
  -      cache.removeNode(fqn);
  +      cache1.removeNode(fqn);
   
  -      //expected
  -      List<CacheListenerEvent> expected = new ArrayList<CacheListenerEvent>();
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_REMOVED, fqn, true, false, oldData));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_REMOVED, fqn, false, false, null));
  +      //expectedLocal
  +      List<CacheListenerEvent> expectedLocal = new ArrayList<CacheListenerEvent>();
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_REMOVED, fqn, true, true, oldData));
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_REMOVED, fqn, false, true, null));
  +
  +      //expectedRemote
  +      List<CacheListenerEvent> expectedRemote = new ArrayList<CacheListenerEvent>();
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_REMOVED, fqn, true, false, oldData));
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_REMOVED, fqn, false, false, null));
   
  -      assertEquals(expected, eventLog.events);
  +      assertEquals(expectedLocal, eventLog1.events);
  +      assertEquals(expectedRemote, eventLog2.events);
   
         // test that the node has in fact been removed.
  -      assertNull("Should be null", cache.getRoot().getChild(fqn));
  +      assertNull("Should be null", cache1.getRoot().getChild(fqn));
      }
   
   
      public void testRemoveData() throws Exception
      {
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  -      cache.put(fqn, "key", "value");
  -      cache.put(fqn, "key2", "value2");
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
  +      cache1.put(fqn, "key", "value");
  +      cache1.put(fqn, "key2", "value2");
         Map oldData = new HashMap();
         oldData.put("key", "value");
         oldData.put("key2", "value2");
   
         // clear event log
  -      eventLog.events.clear();
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      eventLog1.events.clear();
  +      eventLog2.events.clear();
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog1.events);
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
   
         // modify existing node
  -      cache.remove(fqn, "key2");
  +      cache1.remove(fqn, "key2");
         Map removed = new HashMap();
         removed.put("key2", "value2");
   
  -      //expected
  -      List<CacheListenerEvent> expected = new ArrayList<CacheListenerEvent>();
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, false, oldData));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, false, removed));
  +      //expectedLocal
  +      List<CacheListenerEvent> expectedLocal = new ArrayList<CacheListenerEvent>();
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, true, oldData));
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, true, removed));
  +
  +      //expectedRemote
  +      List<CacheListenerEvent> expectedRemote = new ArrayList<CacheListenerEvent>();
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, false, oldData));
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, false, removed));
   
  -      assertEquals(expected, eventLog.events);
  +      assertEquals(expectedLocal, eventLog1.events);
  +      assertEquals(expectedRemote, eventLog2.events);
      }
   
      public void testPutMap() throws Exception
      {
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
         Map oldData = new HashMap();
         oldData.put("key", "value");
         oldData.put("key2", "value2");
   
  -      assertNull(cache.getRoot().getChild(fqn));
         assertNull(cache1.getRoot().getChild(fqn));
  +      assertNull(cache2.getRoot().getChild(fqn));
   
         // clear event log
  -      eventLog.events.clear();
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  -
  -      // modify existing node
  -      cache.put(fqn, oldData);
  -
  -      //expected
  -      List<CacheListenerEvent> expected = new ArrayList<CacheListenerEvent>();
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, true, false, null));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, false, false, null));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, false, Collections.emptyMap()));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, false, oldData));
  +      eventLog1.events.clear();
  +      eventLog2.events.clear();
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog1.events);
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
  +
  +      cache1.put(fqn, oldData);
  +
  +      //expectedLocal
  +      List<CacheListenerEvent> expectedLocal = new ArrayList<CacheListenerEvent>();
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, true, true, null));
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, false, true, null));
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, true, Collections.emptyMap()));
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, true, oldData));
  +
  +      //expectedRemote
  +      List<CacheListenerEvent> expectedRemote = new ArrayList<CacheListenerEvent>();
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, true, false, null));
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_CREATED, fqn, false, false, null));
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, false, Collections.emptyMap()));
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, false, oldData));
   
  -      assertEquals(expected, eventLog.events);
  +      assertEquals(expectedLocal, eventLog1.events);
  +      assertEquals(expectedRemote, eventLog2.events);
      }
   
      public void testMove()
      {
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
         Fqn newParent = Fqn.fromString("/a");
  -      cache.put(fqn, "key", "value");
  -      cache.put(newParent, "key", "value");
  +      cache1.put(fqn, "key", "value");
  +      cache1.put(newParent, "key", "value");
   
  -      Node n1 = cache.getRoot().getChild(fqn);
  -      Node n2 = cache.getRoot().getChild(newParent);
  +      Node n1 = cache1.getRoot().getChild(fqn);
  +      Node n2 = cache1.getRoot().getChild(newParent);
   
  -      eventLog.events.clear(); // clear events
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      eventLog1.events.clear();
  +      eventLog2.events.clear(); // clear events
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog1.events);
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
   
  -      cache.move(n1.getFqn(), n2.getFqn());
  -      //expected
  +      cache1.move(n1.getFqn(), n2.getFqn());
         Fqn newFqn = new Fqn(newParent, fqn.getLastElement());
  -      List<CacheListenerEvent> expected = new ArrayList<CacheListenerEvent>();
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, true, false, null));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, newFqn, true, false, null));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, false, null));
  -      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, newFqn, false, false, null));
  +
  +      //expectedLocal
  +      List<CacheListenerEvent> expectedLocal = new ArrayList<CacheListenerEvent>();
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MOVED, fqn, newFqn, true, true));
  +      expectedLocal.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MOVED, fqn, newFqn, false, true));
  +
  +      //expectedRemote
  +      List<CacheListenerEvent> expectedRemote = new ArrayList<CacheListenerEvent>();
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MOVED, fqn, newFqn, true, false));
  +      expectedRemote.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MOVED, fqn, newFqn, false, false));
  +
  +      assertEquals(expectedLocal, eventLog1.events);
  +      assertEquals(expectedRemote, eventLog2.events);
      }
   
      // -- now the transactional ones
  @@ -267,10 +331,10 @@
   
      public void testTxCreationCommit() throws Exception
      {
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
         tm.begin();
  -      cache.put(fqn, "key", "value");
  -//      assertEquals("Events log should be empty until commit time", 0, eventLog.events.size());
  +      cache1.put(fqn, "key", "value");
  +//      assertEquals("Events log should be empty until commit time", 0, eventLog2.events.size());
         tm.commit();
   
         Map data = new HashMap();
  @@ -283,35 +347,35 @@
         expected.add(new CacheListenerEvent(RemoteCacheListenerTest.ListenerMethod.NODE_MODIFIED, fqn, true, false, Collections.emptyMap()));
         expected.add(new CacheListenerEvent(RemoteCacheListenerTest.ListenerMethod.NODE_MODIFIED, fqn, false, false, data));
   
  -      assertEquals(expected, eventLog.events);
  -      assertEquals("value", cache.get(fqn, "key"));
  +      assertEquals(expected, eventLog2.events);
  +      assertEquals("value", cache1.get(fqn, "key"));
      }
   
      public void testTxCreationRollback() throws Exception
      {
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
         tm.begin();
  -      cache.put(fqn, "key", "value");
  -      assertEquals("Events log should be empty until commit time", 0, eventLog.events.size());
  +      cache1.put(fqn, "key", "value");
  +      assertEquals("Events log should be empty until commit time", 0, eventLog2.events.size());
         tm.rollback();
  -      assertEquals("Events log should be empty until commit time", 0, eventLog.events.size());
  +      assertEquals("Events log should be empty until commit time", 0, eventLog2.events.size());
      }
   
   
      public void testTxOnlyModification() throws Exception
      {
         fail("implement me");
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  -      cache.put(fqn, "key", "value");
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
  +      cache1.put(fqn, "key", "value");
         Map oldData = new HashMap();
         oldData.put("key", "value");
   
         // clear event log
  -      eventLog.events.clear();
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      eventLog2.events.clear();
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
   
         // modify existing node
  -      cache.put(fqn, "key", "value2");
  +      cache1.put(fqn, "key", "value2");
         Map newData = new HashMap();
         newData.put("key", "value2");
   
  @@ -320,55 +384,55 @@
         expected.add(new Event(ListenerMethod.NODE_MODIFIED, fqn, true, true, oldData));
         expected.add(new Event(ListenerMethod.NODE_MODIFIED, fqn, false, true, newData));
   
  -      assertEquals(expected, eventLog.events);
  +      assertEquals(expected, eventLog2.events);
      }
   
   
      public void testTxOnlyRemoval() throws Exception
      {
         fail("implement me");
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  -      cache.put(fqn, "key", "value");
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
  +      cache1.put(fqn, "key", "value");
         Map oldData = new HashMap();
         oldData.put("key", "value");
   
  -      assertEquals("value", cache.get(fqn, "key"));
  +      assertEquals("value", cache1.get(fqn, "key"));
   
         // clear event log
  -      eventLog.events.clear();
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      eventLog2.events.clear();
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
   
         // modify existing node
  -      cache.removeNode(fqn);
  +      cache1.removeNode(fqn);
   
         //expected
         List<Event> expected = new ArrayList<Event>();
         expected.add(new Event(ListenerMethod.NODE_REMOVED, fqn, true, true, oldData));
         expected.add(new Event(ListenerMethod.NODE_REMOVED, fqn, false, true, null));
   
  -      assertEquals(expected, eventLog.events);
  +      assertEquals(expected, eventLog2.events);
   
         // test that the node has in fact been removed.
  -      assertNull("Should be null", cache.getChild(fqn));
  +      assertNull("Should be null", cache1.getChild(fqn));
      }
   
   
      public void testTxRemoveData() throws Exception
      {
         fail("implement me");
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  -      cache.put(fqn, "key", "value");
  -      cache.put(fqn, "key2", "value2");
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
  +      cache1.put(fqn, "key", "value");
  +      cache1.put(fqn, "key2", "value2");
         Map oldData = new HashMap();
         oldData.put("key", "value");
         oldData.put("key2", "value2");
   
         // clear event log
  -      eventLog.events.clear();
  -      assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
  +      eventLog2.events.clear();
  +      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
   
         // modify existing node
  -      cache.remove(fqn, "key2");
  +      cache1.remove(fqn, "key2");
         Map newData = new HashMap();
         newData.put("key", "value");
   
  @@ -377,7 +441,7 @@
         expected.add(new Event(ListenerMethod.NODE_MODIFIED, fqn, true, true, oldData));
         expected.add(new Event(ListenerMethod.NODE_MODIFIED, fqn, false, true, newData));
   
  -      assertEquals(expected, eventLog.events);
  +      assertEquals(expected, eventLog2.events);
      }
   
      public void testTxMove()
  
  
  



More information about the jboss-cvs-commits mailing list