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

Vladmir Blagojevic vladimir.blagojevic at jboss.com
Tue Mar 27 06:05:31 EDT 2007


  User: vblagojevic
  Date: 07/03/27 06:05:31

  Modified:    tests/functional/org/jboss/cache/statetransfer 
                        StateTransfer200Test.java
  Log:
  fixed testCacheLoaderFailure
  
  Revision  Changes    Path
  1.18      +15 -34    JBossCache/tests/functional/org/jboss/cache/statetransfer/StateTransfer200Test.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: StateTransfer200Test.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/statetransfer/StateTransfer200Test.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -b -r1.17 -r1.18
  --- StateTransfer200Test.java	26 Mar 2007 14:37:49 -0000	1.17
  +++ StateTransfer200Test.java	27 Mar 2007 10:05:31 -0000	1.18
  @@ -24,7 +24,7 @@
    * Tests that state transfer works properly if the version is 2.0.0.GA.
    *
    * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
  - * @version $Revision: 1.17 $
  + * @version $Revision: 1.18 $
    */
   public class StateTransfer200Test extends VersionedTestBase
   {
  @@ -109,47 +109,28 @@
   
      public void testCacheLoaderFailure() throws Exception
      {
  -      CacheSPI cache1 = null, cache2 = null;
  -      try
  -      {
  -         cache1 = createCache("cache1", false, false, "org.jboss.cache.statetransfer.CorruptedFileCacheLoader", false, true);
  +	  CacheSPI cache1 = createCache("cache1", false, false, "org.jboss.cache.statetransfer.CorruptedFileCacheLoader", false, true);
   
            cache1.put(A_B, "name", JOE);
            cache1.put(A_B, "age", TWENTY);
            cache1.put(A_C, "name", BOB);
            cache1.put(A_C, "age", FORTY);
   
  -         cache1.evict(A_B, true);
  -         assertNull(cache1.peek(A_B, false));
  -
  -         cache2 = null;
  -         //      try
  -         //      {
  +      CacheSPI cache2 = null;
  +      try
  +      {
            cache2 = createCache("cache2", false, false, true, false, false);
            cache2.create();
            cache2.start();
  -         // Remote node swallows the exception - cache2 does not see this!!  See CacheImpl.MessageListenerAdapter.getState()
  -         //         fail("Should have caused an exception");
  -         //      }
  -         //      catch (Exception e)
  -         //      {
  -         //         assertNotNull(e);
  -         //      }
  -
  -         // when persistent transfer fails as in this case state recipient cacheloader should be wiped clean.
  -         // but transient state, when applied, will also be stored in the CL.
  -         assertNotNull("/a/c is not in cache loader, transient state should have come across ", cache2.get(A_C, "name"));
  -         //assertNull("/a/b is in cache loader, persistent state should not have come across ", cache2.get(A_B, "name"));
  -         // even the above does come across though, since the CorruptedFleCacheLoader first loads state and THEN throws the exception.  State
  -         // already now exists in the stream, and since the exception is swallowed, the stream is still used to retrieve state.
  -         // This test looks more and more pointless if we're swallowing the remote exception intentionally.  :-)
  -         assertNotNull("/a/b is in cache loader, persistent state should not have come across ", cache2.get(A_B, "name"));
  -
  +         fail("Should have caused an exception");
         }
  -      finally
  +      catch (Exception e)
         {
  -         cache1.removeNode(Fqn.ROOT);
  +         assertNotNull(e);
         }
  +
  +      //when persistent transfer fails as in this case state recipient cacheloader should be wiped clean
  +      assertFalse("/a/b is not in cache loader ", cache2.getCacheLoaderManager().getCacheLoader().exists(A_B));
      }
   
   
  
  
  



More information about the jboss-cvs-commits mailing list