[jboss-dev-forums] [Design of JBossCache] - Node removal not working with Invalidation?

bstansberry@jboss.com do-not-reply at jboss.com
Tue Oct 16 17:04:22 EDT 2007


I'm seeing weird behavior in my unit tests of Hibernate/JBC integration with invalidation, so thought I'd look for JBC testsuite tests of node removal with invalidation.  Didn't find any.  So, wrote the following which fails at the commented point.

Basically, a node removal doesn't seem to propagate.  An equivalent test with replication instead of invalidation passed.

Am I missing something obvious here? If not I'll check in the test and raise a JIRA.


  |    public void testPessimisticNodeRemoval() throws Exception
  |    {
  |       nodeRemovalTest(false);
  |    }
  | 
  |    public void testOptimisticNodeRemoval() throws Exception
  |    {
  |       nodeRemovalTest(true);
  |    }
  |    
  |    @SuppressWarnings("unchecked")
  |    private void nodeRemovalTest(boolean optimistic) throws Exception
  |    {
  |       CacheImpl<Object, Object> cache1 = null;
  |       CacheImpl<Object, Object> cache2 = null;
  |       try
  |       {
  |          cache1 = createCache(optimistic);
  |          cache2 = createCache(optimistic);
  |          
  |          Node root1 = cache1.getRoot();
  |          Node root2 = cache2.getRoot();
  |          
  |          // this fqn is relative, but since it is from the root it may as well be absolute
  |          Fqn<String> fqn = Fqn.fromString("/test/fqn");
  |          cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
  |          root1.addChild(fqn);
  |          assertTrue(root1.hasChild(fqn));
  |          cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
  |          root2.addChild(fqn);
  |          assertTrue(root2.hasChild(fqn));
  |    
  |          assertEquals(true, cache1.removeNode(fqn));
  |          assertFalse(root1.hasChild(fqn));
  | 
  |          // THIS ASSERTION FAILS!
  |          assertFalse(root2.hasChild(fqn));
  | 
  |          assertEquals(false, cache1.removeNode(fqn));
  | 
  |       finally 
  |       {
  |          // stop caches, etc.            
  |       }      
  |    }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095794#4095794

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095794



More information about the jboss-dev-forums mailing list