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

Manik Surtani msurtani at jboss.com
Thu Jan 11 08:49:22 EST 2007


  User: msurtani
  Date: 07/01/11 08:49:22

  Modified:    tests/functional/org/jboss/cache/options/cachemodelocal 
                        CacheModeLocalTestBase.java
  Log:
  Changed CacheImpl ctor to be protected, and changed cache factories accordingly
  
  Revision  Changes    Path
  1.10      +59 -2     JBossCache/tests/functional/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheModeLocalTestBase.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- CacheModeLocalTestBase.java	31 Dec 2006 02:08:39 -0000	1.9
  +++ CacheModeLocalTestBase.java	11 Jan 2007 13:49:22 -0000	1.10
  @@ -9,6 +9,7 @@
   import junit.framework.Assert;
   import junit.framework.TestCase;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration;
   
  @@ -45,7 +46,7 @@
         // force a tear down if the test runner didn't run one before (happens in IDEA)
         if (cache1 != null || cache2 != null) tearDown();
   
  -      cache1 = new CacheImpl();
  +      cache1 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache1.getConfiguration().setClusterName("test");
         cache1.getConfiguration().setInitialStateRetrievalTimeout(1000);
         cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  @@ -53,7 +54,7 @@
         cache1.getConfiguration().setCacheMode(cacheMode);
         cache1.start();
   
  -      cache2 = new CacheImpl();
  +      cache2 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache2.getConfiguration().setClusterName("test");
         cache2.getConfiguration().setInitialStateRetrievalTimeout(1000);
         cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  @@ -117,9 +118,13 @@
   
         // cache 2 should as well
         if (!isInvalidation)
  +      {
            Assert.assertEquals("value", cache2.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertNull("should be invalidated", cache2.get(fqn, key));
  +      }
   
         // now cache2
         cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
  @@ -133,10 +138,14 @@
         delay();
         Assert.assertEquals("value2", cache2.get(fqn, key));
         if (!isInvalidation)
  +      {
            Assert.assertEquals("value2", cache1.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertNull("should be invalidated", cache1.get(fqn, key));
      }
  +   }
   
      public void testPutData() throws Exception
      {
  @@ -159,9 +168,13 @@
         Assert.assertEquals("value", cache1.get(fqn, key));
         // cache 2 should as well
         if (!isInvalidation)
  +      {
            Assert.assertEquals("value", cache2.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertNull("should be invalidated", cache2.get(fqn, key));
  +      }
   
         // now cache2
         map.put(key, "value2");
  @@ -176,10 +189,14 @@
         delay();
         Assert.assertEquals("value2", cache2.get(fqn, key));
         if (!isInvalidation)
  +      {
            Assert.assertEquals("value2", cache1.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertNull("should be invalidated", cache1.get(fqn, key));
      }
  +   }
   
      public void testRemoveNode() throws Exception
      {
  @@ -190,9 +207,13 @@
         delay();
         Assert.assertEquals("value", cache1.get(fqn, key));
         if (isInvalidation)
  +      {
            Assert.assertNull("Should be null", cache2.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertEquals("value", cache2.get(fqn, key));
  +      }
   
         cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
         cache1.removeNode(fqn);
  @@ -202,18 +223,26 @@
         Assert.assertNull("should be null", cache1.get(fqn, key));
         // Not in cache2
         if (isInvalidation)
  +      {
            Assert.assertNull("Should be null", cache2.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertEquals("value", cache2.get(fqn, key));
  +      }
   
         // replace cache entries
         cache1.put(fqn, key, "value");
         delay();
         Assert.assertEquals("value", cache1.get(fqn, key));
         if (isInvalidation)
  +      {
            Assert.assertNull("Should be null", cache2.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertEquals("value", cache2.get(fqn, key));
  +      }
   
         // now try again with passing the default options
         cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
  @@ -233,9 +262,13 @@
         delay();
         Assert.assertEquals("value", cache1.get(fqn, key));
         if (isInvalidation)
  +      {
            Assert.assertNull("Should be null", cache2.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertEquals("value", cache2.get(fqn, key));
  +      }
   
         cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
         cache1.remove(fqn, key);
  @@ -245,18 +278,26 @@
         Assert.assertNull("should be null", cache1.get(fqn, key));
         // Not in cache2
         if (isInvalidation)
  +      {
            Assert.assertNull("Should be null", cache2.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertEquals("value", cache2.get(fqn, key));
  +      }
   
         // replace cache entries
         cache1.put(fqn, key, "value");
         delay();
         Assert.assertEquals("value", cache1.get(fqn, key));
         if (isInvalidation)
  +      {
            Assert.assertNull("Should be null", cache2.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertEquals("value", cache2.get(fqn, key));
  +      }
   
         // now try again with passing the default options
         cache1.getInvocationContext().getOptionOverrides().reset();
  @@ -282,9 +323,13 @@
         Assert.assertEquals("value2", cache1.get(fqn, key));
   
         if (!isInvalidation)
  +      {
            Assert.assertEquals("value1", cache2.get(fqn, key));
  +      }
         else
  +      {
            assertNull(cache2.get(fqn, key));
  +      }
   
         // now try again with passing the default options
         mgr.begin();
  @@ -299,9 +344,13 @@
   
         // cache 2 should as well
         if (!isInvalidation)
  +      {
            Assert.assertEquals("value", cache2.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertNull("should be invalidated", cache2.get(fqn, key));
  +      }
   
         // now cache2
         mgr = cache2.getTransactionManager();
  @@ -316,9 +365,13 @@
         Assert.assertEquals("value2", cache2.get(fqn, key));
   
         if (!isInvalidation)
  +      {
            assertEquals("value3", cache1.get(fqn, key));
  +      }
         else
  +      {
            assertNull(cache1.get(fqn, key));
  +      }
   
         mgr.begin();
         cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
  @@ -329,9 +382,13 @@
         delay();
         Assert.assertEquals("value2", cache2.get(fqn, key));
         if (!isInvalidation)
  +      {
            Assert.assertEquals("value2", cache1.get(fqn, key));
  +      }
         else
  +      {
            Assert.assertNull("should be invalidated", cache1.get(fqn, key));
  +      }
   
      }
   
  
  
  



More information about the jboss-cvs-commits mailing list