[infinispan-commits] Infinispan SVN: r810 - trunk/core/src/test/java/org/infinispan/config.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Sep 14 06:48:50 EDT 2009


Author: galder.zamarreno at jboss.com
Date: 2009-09-14 06:48:50 -0400 (Mon, 14 Sep 2009)
New Revision: 810

Modified:
   trunk/core/src/test/java/org/infinispan/config/ConfigurationCloneTest.java
Log:
Each test method should be defining a different cache. Add a test that emulates previous interaction between testCloningAfterStart and testCloningBeforeStart methods and make sure the correct error message is returned. This currently fails due to new override application code written by Vladimir. Need to make sure he has a look to this.

Modified: trunk/core/src/test/java/org/infinispan/config/ConfigurationCloneTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/config/ConfigurationCloneTest.java	2009-09-14 04:45:32 UTC (rev 809)
+++ trunk/core/src/test/java/org/infinispan/config/ConfigurationCloneTest.java	2009-09-14 10:48:50 UTC (rev 810)
@@ -40,8 +40,8 @@
       Configuration clone = defaultConfig.clone();
       assert clone.equals(defaultConfig);
       clone.setEvictionMaxEntries(Integer.MAX_VALUE);
-      cacheManager.defineConfiguration("new-default", clone);
-      cacheManager.getCache("new-default");
+      cacheManager.defineConfiguration("testCloningBeforeStart-default", clone);
+      cacheManager.getCache("testCloningBeforeStart-default");
    }
 
    public void testCloningAfterStart() {
@@ -49,7 +49,29 @@
       Configuration clone = defaultConfig.clone();
       assert clone.equals(defaultConfig);
       clone.setEvictionMaxEntries(Integer.MAX_VALUE);
-      cacheManager.defineConfiguration("new-default", clone);
-      cacheManager.getCache("new-default");
+      cacheManager.defineConfiguration("testCloningAfterStart-default", clone);
+      cacheManager.getCache("testCloningAfterStart-default");
    }
+   
+   public void testDoubleCloning() {
+      Configuration defaultConfig = cacheManager.defineConfiguration("testDoubleCloning-default", new Configuration());
+      Configuration clone = defaultConfig.clone();
+      assert clone.equals(defaultConfig);
+      clone.setEvictionMaxEntries(Integer.MAX_VALUE);
+      cacheManager.defineConfiguration("testDoubleCloning-new-default", clone);
+      cacheManager.getCache("testDoubleCloning-new-default");
+
+      Configuration otherDefaultConfig = cacheManager.getCache("testDoubleCloning-default").getConfiguration();
+      Configuration otherClone = otherDefaultConfig.clone();
+      assert otherClone.equals(otherDefaultConfig);
+      otherClone.setEvictionMaxEntries(Integer.MAX_VALUE - 1);
+      
+      try {
+         cacheManager.defineConfiguration("testDoubleCloning-new-default", otherClone);
+      } catch (ConfigurationException e) {
+         String message = e.getMessage();
+         assert message.contains("[maxEntries]") : "Exception should indicate that it's Eviction maxEntries that we're trying to override but it says: " + message;
+      }
+      
+   }
 }



More information about the infinispan-commits mailing list