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

Manik Surtani msurtani at jboss.com
Thu Jan 4 12:40:07 EST 2007


  User: msurtani
  Date: 07/01/04 12:40:07

  Modified:    tests/functional/org/jboss/cache/notifications 
                        RemoteCacheListenerTest.java
  Log:
  removed initial state transfer from start up
  
  Revision  Changes    Path
  1.9       +34 -9     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.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- RemoteCacheListenerTest.java	3 Jan 2007 22:51:58 -0000	1.8
  +++ RemoteCacheListenerTest.java	4 Jan 2007 17:40:07 -0000	1.9
  @@ -31,7 +31,6 @@
   import org.jboss.cache.factories.DefaultCacheFactory;
   import org.jboss.cache.lock.IsolationLevel;
   
  -import javax.transaction.Transaction;
   import javax.transaction.TransactionManager;
   import java.util.ArrayList;
   import java.util.Collections;
  @@ -51,7 +50,6 @@
      protected boolean optLocking = false;
   
      private Cache cache, cache1;
  -   private TransactionManager tm;
      private EventLog eventLog = new EventLog();
      private Fqn fqn = Fqn.fromString("/test");
   
  @@ -63,10 +61,9 @@
         c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
         if (optLocking) c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
         c.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  +      c.setFetchInMemoryState(false);
         cache = DefaultCacheFactory.getInstance().createCache(c);
  -
         cache1 = DefaultCacheFactory.getInstance().createCache(c);
  -      tm = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
         eventLog.events.clear();
         cache1.addCacheListener(eventLog);
      }
  @@ -74,8 +71,36 @@
      protected void tearDown() throws Exception
      {
         super.tearDown();
  -      Transaction t = tm.getTransaction();
  -      if (t != null) t.rollback();
  +      TransactionManager tm = null;
  +      if ((tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager()) != null)
  +      {
  +         if (tm.getTransaction() != null)
  +         {
  +            try
  +            {
  +               tm.rollback();
  +            }
  +            catch (Exception e)
  +            {
  +               // do nothing
  +            }
  +         }
  +      }
  +      if ((tm = cache1.getConfiguration().getRuntimeConfig().getTransactionManager()) != null)
  +      {
  +         if (tm.getTransaction() != null)
  +         {
  +            try
  +            {
  +               tm.rollback();
  +            }
  +            catch (Exception e)
  +            {
  +               // do nothing
  +            }
  +         }
  +      }
  +
         cache.stop();
         cache.destroy();
         cache1.stop();
  @@ -170,13 +195,13 @@
   
         // modify existing node
         cache.remove(fqn, "key2");
  -      Map newData = new HashMap();
  -      newData.put("key", "value");
  +      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, newData));
  +      expected.add(new CacheListenerEvent(CacheListenerEvent.ListenerMethod.NODE_MODIFIED, fqn, false, false, removed));
   
         assertEquals(expected, eventLog.events);
      }
  
  
  



More information about the jboss-cvs-commits mailing list