[jbosscache-commits] JBoss Cache SVN: r4527 - in core/trunk/src: main/java/org/jboss/cache/interceptors and 2 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Oct 2 12:38:00 EDT 2007


Author: mircea.markus
Date: 2007-10-02 12:38:00 -0400 (Tue, 02 Oct 2007)
New Revision: 4527

Modified:
   core/trunk/src/main/java/org/jboss/cache/AbstractNode.java
   core/trunk/src/main/java/org/jboss/cache/Node.java
   core/trunk/src/main/java/org/jboss/cache/NodeSPI.java
   core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
   core/trunk/src/main/java/org/jboss/cache/RegionManager.java
   core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
   core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
   core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
Log:
JBCACHE-1154 - residency is now neither replicable nor transactionable 

Modified: core/trunk/src/main/java/org/jboss/cache/AbstractNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/AbstractNode.java	2007-10-02 16:22:14 UTC (rev 4526)
+++ core/trunk/src/main/java/org/jboss/cache/AbstractNode.java	2007-10-02 16:38:00 UTC (rev 4527)
@@ -17,11 +17,6 @@
    protected Fqn fqn;
    protected boolean resident;
 
-   /**
-    * Under this key the {@link #resident} attribute will be keept within the data map.
-    */
-   public static final String JBOSSCACHE_INTERNAL_RESIDENT = "_jbosscache.internal.resident";
-
    public boolean isDeleted()
    {
       return deleted;
@@ -49,20 +44,13 @@
 
    public void setResident(boolean resident)
    {
-      if (!resident)
-      {
-         remove((K)JBOSSCACHE_INTERNAL_RESIDENT);
-      } else
-      {
-         put((K)JBOSSCACHE_INTERNAL_RESIDENT, (V)Boolean.TRUE);
-      }
+      this.resident = resident;
    }
 
 
    public boolean isResident()
    {
-      //hack - see setResident internals for details
-      return Boolean.TRUE.equals(get((K)JBOSSCACHE_INTERNAL_RESIDENT));
+      return resident;
    }
 
 

Modified: core/trunk/src/main/java/org/jboss/cache/Node.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Node.java	2007-10-02 16:22:14 UTC (rev 4526)
+++ core/trunk/src/main/java/org/jboss/cache/Node.java	2007-10-02 16:38:00 UTC (rev 4527)
@@ -282,8 +282,8 @@
     * "keep LRU 10 nodes" - the resident nodes won't be counted within those 10 nodes,
     * and also won't be evicted when the threshold is reached.
     * N.B. calling this method won't have any effect on node's eviction, e.g. we won't consider this node as being
-    * 'used' in a LRU scenario. If the cache is used in a replicated environment then the resident property is also
-    * replicated across the cluster(just like attribute map)
+    * 'used' in a LRU scenario. If the cache is used in a replicated environment then the resident property is NOT
+    * replicated across the cluster. Also the property is not transactionable. 
     */
    boolean isResident();
 

Modified: core/trunk/src/main/java/org/jboss/cache/NodeSPI.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeSPI.java	2007-10-02 16:22:14 UTC (rev 4526)
+++ core/trunk/src/main/java/org/jboss/cache/NodeSPI.java	2007-10-02 16:38:00 UTC (rev 4527)
@@ -437,10 +437,4 @@
     * @return true if the node has one or more child nodes; false otherwise.
     */
    boolean hasChildrenDirect();
-
-
-   /**
-    * Same as {@link #isResident()} but it bypasses the interceptors chain.
-    */
-   boolean isResidentDirect();
 }

Modified: core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionImpl.java	2007-10-02 16:22:14 UTC (rev 4526)
+++ core/trunk/src/main/java/org/jboss/cache/RegionImpl.java	2007-10-02 16:38:00 UTC (rev 4527)
@@ -148,11 +148,7 @@
                     " Region: " + fqn +
                     " You will need to reduce the wakeUpIntervalSeconds parameter.");
          }
-
-         if (!regionManager.isNodeResident(event.getFqn()))
-         {
-            nodeEventQueue.put(event);
-         }
+         nodeEventQueue.put(event);
       }
       catch (InterruptedException e)
       {

Modified: core/trunk/src/main/java/org/jboss/cache/RegionManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionManager.java	2007-10-02 16:22:14 UTC (rev 4526)
+++ core/trunk/src/main/java/org/jboss/cache/RegionManager.java	2007-10-02 16:38:00 UTC (rev 4527)
@@ -813,20 +813,4 @@
    {
       return this.cache;
    }
-
-   /**
-    * Will check to see if the given node is resident or not.
-    * N.B. This method MUST not raise any eviction events (i.e. do not call any intercepted methods on the cache, but
-    * rather use direct calls). Otherwise an endless loop of events being generated/consumed will take place, as this
-    * is called in the context of consuming events.
-    */
-   public boolean isNodeResident(Fqn fqn)
-   {
-      if (cache == null)
-      {
-         return false;
-      }
-      NodeSPI theNode = cache.getRoot().getChildDirect(fqn);
-      return theNode == null ? false : theNode.isResidentDirect();
-   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2007-10-02 16:22:14 UTC (rev 4526)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2007-10-02 16:38:00 UTC (rev 4527)
@@ -15,7 +15,11 @@
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
 
-import java.util.*;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
@@ -65,7 +69,6 @@
    private final Map<K, V> data = new HashMap<K, V>();
 
    private boolean lockForChildInsertRemove;
-   private int realSize;
 
    /**
     * Constructs a new node with an FQN of Root.
@@ -191,17 +194,8 @@
    public Map<K, V> getData()
    {
       if (cache == null) return Collections.emptyMap();
-      Map<K, V> realData = cache.getData(getFqn());
-      if (!realData.containsKey(JBOSSCACHE_INTERNAL_RESIDENT))
-      {
-         return realData;
-      }
-      else
-      {
-         Map clearedData = new HashMap(realData);
-         clearedData.remove(JBOSSCACHE_INTERNAL_RESIDENT);
-         return Collections.unmodifiableMap(clearedData);
-      }
+      return cache.getData(getFqn());
+
 /*
       Map<K, V> dMap = new HashMap<K, V>();
       for (K k : cache.getKeys(getFqn()))
@@ -384,13 +378,7 @@
 
    public void clearData()
    {
-      Map realData = getDataDirect();
-      boolean isResident = isResidentDirect();
       cache.removeData(getFqn());
-      if (isResident)
-      {
-         setResident(true);
-      }
    }
 
    public void clearDataDirect()
@@ -435,21 +423,8 @@
 
    public Set<K> getKeys()
    {
-      Set<K> realSet = cache.getKeys(getFqn());
-      if (realSet == null)
-      {
-         Collections.<K>emptySet();
-      }
-      if (!realSet.contains(JBOSSCACHE_INTERNAL_RESIDENT))
-      {
-         return realSet;
-      }
-      else
-      {
-         Set clearedData = new HashSet(realSet);
-         clearedData.remove(JBOSSCACHE_INTERNAL_RESIDENT);
-         return Collections.unmodifiableSet(clearedData);
-      }
+      Set<K> keys = cache.getKeys(getFqn());
+      return keys == null ? Collections.<K>emptySet() : Collections.<K>unmodifiableSet(keys);
    }
 
    public Set<K> getKeysDirect()
@@ -519,11 +494,7 @@
 
    public int dataSize()
    {
-      realSize = cache.getKeys(getFqn()).size();
-      if (getDataDirect().containsKey(JBOSSCACHE_INTERNAL_RESIDENT)) {
-         realSize--;
-      }
-      return realSize;
+      return cache.getKeys(getFqn()).size();
    }
 
    public boolean removeChild(Object childName)
@@ -710,11 +681,6 @@
       return children != null && children.size() != 0;
    }
 
-   public boolean isResidentDirect()
-   {
-      return getDataDirect().containsKey(JBOSSCACHE_INTERNAL_RESIDENT);
-   }
-
    public Set<NodeSPI<K, V>> getChildrenDirect(boolean includeMarkedForRemoval)
    {
       if (includeMarkedForRemoval)

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2007-10-02 16:22:14 UTC (rev 4526)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2007-10-02 16:38:00 UTC (rev 4527)
@@ -118,6 +118,13 @@
          return;
       }
 
+      NodeSPI<?,?> nodeSPI = cache.peek(event.getFqn(), false);
+      //we do not trigger eviction events for resident nodes
+      if (nodeSPI != null && nodeSPI.isResident())
+      {
+         return;
+      }
+
       this.doEventUpdatesOnRegionManager(event);
 
       if (log.isTraceEnabled())
@@ -198,10 +205,6 @@
          Object args[] = mc.getArgs();
          Fqn fqn = (Fqn) args[0];
          Object key = args[1];
-         /*see hack comment inside PutKeyEvictionMethodHandler.extractEvictedEventNode */
-         if (UnversionedNode.JBOSSCACHE_INTERNAL_RESIDENT.equals(key)) {
-            return null;
-         }
          if (fqn != null && key != null
                  && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.VISIT_NODE_EVENT))
          {
@@ -336,15 +339,6 @@
          Object[] args = mc.getArgs();
          Fqn fqn = (Fqn) args[1];
          Object key = args[2];
-         //hack - for seting an node as resident we won't create a an eviction event.
-         //this is an implementation restriction, as this method(i.e. isEvited) is intensively called internally
-         //by the eviction code, which would result in events being produced -> that when consumed would produce
-         // other events (due to call to Node.isResident). The isResidentDirect call cannot be used here
-         //the resident information is stored in the node attributes map directly
-         if (UnversionedNode.JBOSSCACHE_INTERNAL_RESIDENT.equals(key))
-         {
-            return null;
-         }
          if (fqn != null && key != null
                  && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.ADD_ELEMENT_EVENT))
          {

Modified: core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java	2007-10-02 16:22:14 UTC (rev 4526)
+++ core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java	2007-10-02 16:38:00 UTC (rev 4527)
@@ -6,8 +6,7 @@
  */
 package org.jboss.cache;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.*;
 
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectOutputStream;
@@ -60,6 +59,24 @@
       out.writeObject(children);// must be serializable
    }
 
+   @Test(groups = {"functional"})
+   public void testGetKeysOnNode()
+   {
+      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+      cache.put("/a/b/c", "key", "value");
+      Node node = cache.getRoot().getChild(Fqn.fromString("/a/b/c"));
+      Set keySet = node.getKeys();
+      try
+      {
+
+         keySet.add("asd");
+         fail();
+      } catch (Exception e)
+      {
+         //expected
+      }
+   }
+
    void log(String msg)
    {
       System.out.println("-- " + msg);

Modified: core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java	2007-10-02 16:22:14 UTC (rev 4526)
+++ core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java	2007-10-02 16:38:00 UTC (rev 4527)
@@ -18,7 +18,7 @@
 import org.jboss.cache.loader.DummyCacheLoader;
 import org.jboss.cache.lock.IsolationLevel;
 
-import javax.transaction.TransactionManager;
+import javax.transaction.*;
 import java.util.List;
 import java.util.ArrayList;
 
@@ -42,6 +42,7 @@
    public void setUp()
    {
       cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
+      cacheConfig.setCacheMode(Configuration.CacheMode.LOCAL);
       cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(cacheConfig, false);
       cache.getConfiguration().getEvictionConfig().setWakeupIntervalSeconds(1);
       createNewRegion();
@@ -55,8 +56,8 @@
    {
       EvictionConfig evConfig = cache.getConfiguration().getEvictionConfig();
       EvictionRegionConfig evRegConfig = new EvictionRegionConfig();
-      evRegConfig.setRegionFqn(Fqn.fromString("/"+TEST_NODES_ROOT));
-      evRegConfig.setEventQueueSize(3);
+      evRegConfig.setRegionFqn(Fqn.fromString("/" + TEST_NODES_ROOT));
+      evRegConfig.setEventQueueSize(100);
       LRUConfiguration lruConfig = new LRUConfiguration();
       lruConfig.setMaxAgeSeconds(100000);
       lruConfig.setTimeToLiveSeconds(100000);
@@ -72,7 +73,10 @@
       cache.stop();
       for (Cache c : caches)
       {
-         if (c!= null) c.stop();
+         if (c != null)
+         {
+            c.stop();
+         }
       }
    }
 
@@ -111,113 +115,15 @@
    }
 
    /**
-    * The 'resident' attribute of the Node.getData() is not exposed to the user.
-    * This information won't be visible to the ouside clients if they are not using the
-    * resident attribute. This would ensure a 100% backward comatibility. New clients would need to be aware of this
-    * extra attribute, though.
-    */
-   public void testInternalStateNotVisibleOutsideOnGet()
-   {
-      cache.put(getSubFqn("/a"), "k_a", "v_a");
-      cache.get(getSubFqn("/a")).setResident(true);
-      assertEquals(cache.getRoot().getChild(getSubFqn("/a")).getData().keySet().size(), 1);
-      assertEquals(cache.getRoot().getChild(getSubFqn("/a")).getKeys().size(), 1);
-      assertTrue(cache.getRoot().getChild(getSubFqn("/a")).isResident());
-
-      cache.get(getSubFqn("/a")).setResident(false);
-      assertFalse(cache.getRoot().getChild(getSubFqn("/a")).isResident());
-      assertEquals(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").getData().keySet().size(), 1);
-      assertEquals(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").getKeys().size(), 1);
-
-      cache.remove(getSubFqn("/a"), "k_a");
-      assertEquals(cache.get(getSubFqn("/a")).getData().keySet().size(), 0);
-      assertFalse(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").isResident());
-
-      cache.get(getSubFqn("/a")).setResident(true);
-      assertEquals(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").getData().keySet().size(), 0);
-      assertEquals(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").getKeys().size(), 0);
-      assertTrue(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").isResident());
-   }
-
-
-   /**
-    * When Node.clearData is called the node does not lose its residency metadata.
-    */
-   public void testInternalStateNotVisibleOutsideOnClearData()
-   {
-      Fqn theNode = Fqn.fromString("/a_a");
-      cache.put(theNode, "key", "value");
-      cache.getRoot().getChild(theNode).setResident(true);
-      cache.getRoot().getChild(theNode).clearData();
-      assertFalse(cache.getRoot().getChild(theNode).getKeys().contains("key"));
-      assertTrue(cache.getRoot().getChild(theNode).isResident());
-   }
-
-   /**
-    * When Node.getKeys is called, the given key set does not contain the 'resident' metadata.
-    */
-   public void testInternalStateNotVisibleOutsideOnGetKeys()
-   {
-      Fqn theNode = Fqn.fromString("/a_a");
-      cache.put(theNode, "key", "value");
-
-      assertEquals(cache.getRoot().getChild(theNode).getKeys().size(), 1);
-
-      cache.getRoot().getChild(theNode).setResident(true);
-      assertEquals(cache.getRoot().getChild(theNode).getKeys().size(), 1);
-   }
-
-   /**
-    * When Node.dataSize is called the returned value does not reflect metadata information.
-    */
-   public void testInternalStateNotVisibleOutsideOnDataSize()
-   {
-      Fqn theNode = Fqn.fromString("/a_a");
-      cache.put(theNode, "key", "value");
-
-      assertEquals(cache.getRoot().getChild(theNode).dataSize(), 1);
-
-      cache.getRoot().getChild(theNode).setResident(true);
-      assertEquals(cache.getRoot().getChild(theNode).dataSize(), 1);
-   }
-
-
-   /**
-    * When replication is on, we want to make sure that the operation will subscribe to the global
-    * replication strategy.
-    */
-   public void testNodeResidencyInformationIsReplicated()
-   {
-      Cache first = DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC));
-      Cache second = DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC));
-      caches = new Cache[]{first, second};
-      TestingUtil.blockUntilViewsReceived(caches, 5000);
-
-      System.out.println("Caches started!");
-
-      Fqn fqn = Fqn.fromString("/a/b");
-      first.put(fqn, "key", "value");
-      assertNotNull(second.get(fqn, "key"));
-
-      first.getRoot().getChild(fqn).setResident(true);
-      assertTrue(second.getRoot().getChild(fqn).isResident());
-
-      second.getRoot().getChild(fqn).setResident(false);
-      assertFalse(first.getRoot().getChild(fqn).isResident());
-   }
-
-   /**
     * If a node is marked as resident, and a get is made on that given node then an VISITED event would normally be
     * added to the eviction queue. In a LRU scenario, this will cause another node to be evicted given that the size of
     * the eviction queue is bounded. This test makes sure that this scenario will not hapen.
-    * //todo - check why it does not work fine in suite, but works individually
     */
    public void testNoEvictionEventsForResidentNodes() throws InterruptedException
    {
       cache.put(getSubFqn("/a"), "k_a", "v_a");
       cache.put(getSubFqn("/b"), "k_b", "v_b");
 
-      //cache node reference here as getting a node will trigger an read event
       cache.get(getSubFqn("/a")).setResident(true);
       cache.get(getSubFqn("/b")).setResident(true);
 
@@ -253,51 +159,32 @@
    }
 
    /**
-    * Underlying metadata information is held as Strings. As Node is parametrized class with keys and values, and there
-    * is an explicit downcast to String in code, this is just a check to make sure no cast exceptions are being thrown.
-    * Note: this is rather a paranoia check as type info is lost during type erasure and underlying map supports
-    * objects - superclass of Strings
+    * Check the behavior whilst using optimistic locking.
     */
-   public void testNoStringCache()
-   {
-      CacheFactory<Integer, Float> cacheFactory = DefaultCacheFactory.getInstance();
-      Configuration cc = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
-      Cache<Integer, Float> cache = cacheFactory.createCache(cc, true);
-      cache.put(getSubFqn("/a"), 1, 5.3f);
-      cache.put(getSubFqn("/b"), 1, 2.3f);
-      cache.put(getSubFqn("/c"), 1, 7.3f);
-      cache.getRoot().getChild(getSubFqn("/a")).setResident(true);
-      cache.getRoot().getChild(getSubFqn("/b")).setResident(false);
-      cache.getRoot().getChild(getSubFqn("/c")).setResident(true);
-      assertTrue(cache.getRoot().getChild(getSubFqn("/a")).isResident());
-      assertFalse(cache.getRoot().getChild(getSubFqn("/b")).isResident());
-      assertTrue(cache.getRoot().getChild(getSubFqn("/c")).isResident());
-      cache.stop();
-   }
-
-   /**
-    * When using optimistic locking , check to see that at commit time the cache is successfully updated.
-    * //todo - this test fails only if setup is called prio it. Should be something with nesting tx context- take a look
-    */
    public void testResidencyAndOptimisticLocking() throws Exception
    {
 
       Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
+      config.setCacheMode(Configuration.CacheMode.LOCAL);
       config.setNodeLockingOptimistic(true);
       CacheImpl cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(config, true);
-//      CacheImpl cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/optimistic-eviction.xml");
 
       cache.put(Fqn.fromString("/a/b"), "key", "value");
       TransactionManager txManager = cache.getTransactionManager();
       txManager.begin();
       cache.getRoot().getChild(Fqn.fromString("/a/b")).setResident(true);
+      cache.getRoot().getChild(Fqn.fromString("/a/b")).put("k2", "v2");
+      assertEquals(cache.getRoot().getChild(Fqn.fromString("/a/b")).getKeys().size(), 2);
       txManager.rollback();
-      assertFalse(cache.getRoot().getChild(Fqn.fromString("/a/b")).isResident());
+      assertTrue(cache.getRoot().getChild(Fqn.fromString("/a/b")).isResident());
 
       txManager.begin();
-      cache.getRoot().getChild(Fqn.fromString("/a/b")).setResident(true);
+      cache.getRoot().getChild(Fqn.fromString("/a/b")).setResident(false);
+      cache.getRoot().getChild(Fqn.fromString("/a/b")).put("k2", "v2");
+      assertEquals(cache.getRoot().getChild(Fqn.fromString("/a/b")).getKeys().size(), 2);
       txManager.commit();
-      assertTrue(cache.getRoot().getChild(Fqn.fromString("/a/b")).isResident());
+      assertFalse(cache.getRoot().getChild(Fqn.fromString("/a/b")).isResident());
+      assertEquals(cache.getRoot().getChild(Fqn.fromString("/a/b")).getKeys().size(), 2);
 
       try
       {
@@ -311,6 +198,26 @@
       }
    }
 
+   public void testResidencyAndPesimistickLocking() throws Exception
+   {
+      cache.put(Fqn.fromString("/a/b"), "key", "value");
+      TransactionManager txManager = cache.getTransactionManager();
+      txManager.begin();
+      cache.getRoot().getChild(Fqn.fromString("/a/b")).setResident(true);
+      cache.getRoot().getChild(Fqn.fromString("/a/b")).put("k2", "v2");
+      assertEquals(cache.getRoot().getChild(Fqn.fromString("/a/b")).getKeys().size(), 2);
+      txManager.rollback();
+      assertTrue(cache.getRoot().getChild(Fqn.fromString("/a/b")).isResident());
+
+      txManager.begin();
+      cache.getRoot().getChild(Fqn.fromString("/a/b")).setResident(false);
+      cache.getRoot().getChild(Fqn.fromString("/a/b")).put("k2", "v2");
+      assertEquals(cache.getRoot().getChild(Fqn.fromString("/a/b")).getKeys().size(), 2);
+      txManager.commit();
+      assertFalse(cache.getRoot().getChild(Fqn.fromString("/a/b")).isResident());
+      assertEquals(cache.getRoot().getChild(Fqn.fromString("/a/b")).getKeys().size(), 2);
+   }
+
    private Fqn getSubFqn(String str)
    {
       return Fqn.fromString("/" + TEST_NODES_ROOT + str);




More information about the jbosscache-commits mailing list