Package org.jboss.cache

Examples of org.jboss.cache.Node


   }

   public void testLazyLoadingOnNodeRemoveChild() throws Exception
   {
      cache.getTransactionManager().begin();
      Node node = cache.getRoot().getChild(parent);
      node.removeChild(child.getLastElement());
      assert !node.hasChild(child.getLastElement()) : "Node should have removed child";
      WorkspaceNode n = getWorkspaceNode(parent);
      assert !n.isChildrenLoaded() : "Should not have loaded children";
      cache.getTransactionManager().commit();
   }
View Full Code Here


      assertDataLoaded(child);
      cache.get(child, "foo2"); // does not exist, will trigger a load
      assertDataLoaded(child);

      // should not load
      Node node = cache.getRoot().getChild(parent);
      assertDataLoaded(child);
      assertDataNotLoaded(parent);

      // needs to load children at this stage in case there are other children that have been evicted.
      Set children = node.getChildren(); //getchildrennames /parent
      assertEquals(1, children.size());
      assertDataLoaded(child);
      cache.get(child, "foo"); //get /parent/child
      assertDataLoaded(child);
View Full Code Here

      // evict the parent
      cache.evict(parent, false);
      assertNull(cache.peek(parent, false));

      // now get node.
      Node n = cache.getRoot().getChild(parent);
      assertNotNull(n);
      assertDataNotLoaded(parent);

      verify(mockCacheLoader);
   }
View Full Code Here

      // evict the parent
      cache.evict(parent, false);
      assertNull(cache.peek(parent, false));

      // now get node.
      Node n = cache.getRoot().getChild(parent);
      assertNotNull(n);
      assertDataNotLoaded(parent);

      // should not load node but should change isDataLoaded to true
      // will trigger a removedata() though
      n.clearData();

      assertDataLoaded(parent);
      verify(mockCacheLoader);
   }
View Full Code Here

      return config;
   }

   public Set<?> getChildrenNames(Fqn fqn) throws Exception
   {
      Node node = delegate.getRoot().getChild(fqn);
      if (node == null) return null;

      Set cn = node.getChildrenNames();

      // the cache loader contract is a bit different from the cache when it comes to dealing with childrenNames
      if (cn.isEmpty()) return null;
      return cn;
   }
View Full Code Here

      delegate.removeNode(fqn);
   }

   public void removeData(Fqn fqn) throws Exception
   {
      Node node = delegate.getRoot().getChild(fqn);
      if (node != null) node.clearData();
   }
View Full Code Here

      int maxCountBase = 0;
      int maxCountData = 0;
      boolean sawBaseDecrease = false;
      boolean sawDataDecrease = false;
      long start = System.currentTimeMillis();
      Node root = cache2.getRoot();
      while ((System.currentTimeMillis() - start) < 10000)
      {
         parent = root.getChild(Fqn.fromString("/org/jboss/test/data"));
         children = parent.getChildren();
         if (children != null)
         {
            int dataCount = children.size();
            if (dataCount < maxCountData)
View Full Code Here

      cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
      cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
      cache.start();
      cache.put(FQN, KEY, VALUE);
      cache.put(FQN + "/d", KEY, VALUE);
      Node node = cache.peek(FQN, false, false);
      assertTrue(node != null && node.getKeys().contains(KEY));
      assertEquals(VALUE, cache.get(FQN, KEY));
      assertEquals(0, cache.getNumberOfLocksHeld());
   }
View Full Code Here

      cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
      cache.start();
      tm = startTransaction();
      cache.put(FQN, KEY, VALUE);
      cache.put(FQN + "/d", KEY, VALUE);
      Node node = cache.peek(FQN, false, false);
      assertTrue(node != null && node.getKeys().contains(KEY));
      assertEquals(VALUE, cache.get(FQN, KEY));
      assertEquals(0, cache.getNumberOfLocksHeld());
      tm.commit();
   }
View Full Code Here

      cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
      cache.start();
      tm = startTransaction();
      cache.put(FQN, KEY, VALUE);
      cache.put(FQN + "/d", KEY, VALUE);
      Node node = cache.peek(FQN, false, false);
      assertTrue(node != null && node.getKeys().contains(KEY));
      assertEquals(VALUE, cache.get(FQN, KEY));
      assertEquals(5, cache.getNumberOfLocksHeld());
      tm.commit();
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.