Package org.jboss.cache.loader

Examples of org.jboss.cache.loader.DummyInMemoryCacheLoader$DummyNode


      assert c.getCacheLoaderManager() != null;
      assert c.getCacheLoaderManager().getCacheLoader() == null;

      CacheLoaderConfig clc = new CacheLoaderConfig();
      CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
      iclc.setCacheLoader(new DummyInMemoryCacheLoader());
      clc.addIndividualCacheLoaderConfig(iclc);
      c.getConfiguration().setCacheLoaderConfig(clc);

      c.start();
      assert c.getCacheLoaderManager() != null;
View Full Code Here


      CacheSPI modifierImpl = (CacheSPI) modifier;
      CacheSPI observerImpl = (CacheSPI) observer;

      modifier.put(parent, K, V);

      DummyInMemoryCacheLoader loader = loaderTL.get();
     
      // test that this exists in the (shared) loader
      assert loader.get(parent) != null;
      assert loader.get(parent).size() > 0;

      modifier.removeNode(parent);

      // assert that tombstones exist on both instances
      assert modifierImpl.peek(parent, true, true) != null;
      assert observerImpl.peek(parent, true, true) != null;
      assert modifierImpl.peek(parent, false, false) == null;
      assert observerImpl.peek(parent, false, false) == null;

      // make sure this does not exist in the loader; since it HAS been removed
      assert loader.get(parent) == null;

      NodeSPI observerNode = (NodeSPI) observer.getRoot().getChild(parent);
      assert observerNode == null : "Should be removed";

      // now try a put on a with a newer data version; should work
View Full Code Here

      cache.start();

      CacheSPI spi = (CacheSPI) cache;

      DummyInMemoryCacheLoader loader = (DummyInMemoryCacheLoader) spi.getCacheLoaderManager().getCacheLoader();
      loaderTL.set(loader);

      return cache;
   }
View Full Code Here

      cache.destroy();
      cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig(pasv, "/", DummyInMemoryCacheLoader.class.getName(), "debug=true", false, false, false, false));
      cache.start();

      DummyInMemoryCacheLoader loader = (DummyInMemoryCacheLoader) cache.getCacheLoaderManager().getCacheLoader();

      rootNode.put("key", "value");

      if (!pasv)
      {
         Map m = loader.get(Fqn.ROOT);
         assertNotNull("Should not be null", m);
         assertEquals("value", m.get("key"));
      }

      Node<Object, Object> nodeA = rootNode.addChild(A);
      nodeA.put(k, vA);
      Node<Object, Object> nodeB = rootNode.addChild(B);
      nodeB.put(k, vB);
      Node<Object, Object> nodeC = nodeA.addChild(C);
      nodeC.put(k, vC);
      Node<Object, Object> nodeD = nodeC.addChild(D);
      nodeD.put(k, vD);
      Node<Object, Object> nodeE = nodeD.addChild(E);
      nodeE.put(k, vE);
      cache.evict(Fqn.ROOT, true);

      // move
      if (useTx) tm.begin();
      cache.move(nodeC.getFqn(), nodeB.getFqn());
      if (useTx) tm.commit();

      // after eviction, the node objects we hold are probably stale.
      nodeA = rootNode.getChild(A);
      nodeB = rootNode.getChild(B);
      nodeC = nodeB.getChild(C);
      log.info("nodeC get child B ");
      nodeD = nodeC.getChild(D);
      log.info("nodeD get child E ");
      nodeE = nodeD.getChild(E);

      Fqn old_C = C;
      Fqn old_D = Fqn.fromRelativeFqn(old_C, D);
      Fqn old_E = Fqn.fromRelativeFqn(old_D, E);

      // test data
      assertEquals(vA, nodeA.get(k));
      assertEquals(vB, nodeB.get(k));
      assertEquals(vC, nodeC.get(k));
      assertEquals(vD, nodeD.get(k));
      assertEquals(vE, nodeE.get(k));

      // parentage
      assertEquals(rootNode, nodeA.getParent());
      assertEquals(rootNode, nodeB.getParent());
      assertEquals(nodeB, nodeC.getParent());
      assertEquals(nodeC, nodeD.getParent());
      assertEquals(nodeD, nodeE.getParent());


      if (pasv) cache.evict(Fqn.ROOT, true);

      //now inspect the loader.
      assertEquals(vA, loader.get(nodeA.getFqn()).get(k));
      assertEquals(vB, loader.get(nodeB.getFqn()).get(k));
      assertEquals(vC, loader.get(nodeC.getFqn()).get(k));
      assertEquals(vD, loader.get(nodeD.getFqn()).get(k));
      assertEquals(vE, loader.get(nodeE.getFqn()).get(k));

      assertNull(loader.get(old_C));
      assertNull(loader.get(old_D));
      assertNull(loader.get(old_E));

   }
View Full Code Here

   {
      cache.destroy();
      cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig(pasv, "", DummyInMemoryCacheLoader.class.getName(), null, false, false, false, false));
      cache.start();

      DummyInMemoryCacheLoader loader = (DummyInMemoryCacheLoader) cache.getCacheLoaderManager().getCacheLoader();

      rootNode.put("key", "value");

      if (!pasv)
      {
         Map m = loader.get(Fqn.ROOT);
         assertNotNull("Should not be null", m);
         assertEquals("value", m.get("key"));
      }

      nodeA = rootNode.addChild(A);
      nodeA.put(k, vA);
      nodeB = rootNode.addChild(B);
      nodeB.put(k, vB);
      nodeC = nodeA.addChild(C);
      nodeC.put(k, vC);
      nodeD = nodeC.addChild(D);
      nodeD.put(k, vD);
      nodeE = nodeD.addChild(E);
      nodeE.put(k, vE);
      /*
      Node nodeF = nodeE.addChild(Fqn.fromString("F"));
      nodeF.put(k, vE);
      Node nodeG = nodeF.addChild(Fqn.fromString("G"));
      nodeG.put(k, vE);
      */

      assertNotNull(cache.peek(A, false));
      assertNotNull(cache.peek(B, false));
      assertNull(cache.peek(C, false));
      assertNotNull(cache.peek(new Fqn<String>(A, C), false));
      assertNotNull(cache.peek(new Fqn<String>(new Fqn<String>(A, C), D), false));
      assertNotNull(cache.peek(new Fqn<String>(new Fqn<String>(new Fqn<String>(A, C), D), E), false));

      // test data
      assertEquals(vA, nodeA.get(k));
      assertEquals(vB, nodeB.get(k));
      assertEquals(vC, nodeC.get(k));
      assertEquals(vD, nodeD.get(k));
      assertEquals(vE, nodeE.get(k));

      // parentage
      assertEquals(rootNode, nodeA.getParent());
      assertEquals(rootNode, nodeB.getParent());
      assertEquals(nodeA, nodeC.getParent());
      assertEquals(nodeC, nodeD.getParent());
      assertEquals(nodeD, nodeE.getParent());

      System.out.println("Loader" + loader);

      cache.evict(Fqn.ROOT, true);

      // move
      if (useTx) tm.begin();
      cache.move(nodeC.getFqn(), nodeB.getFqn());

      //      Fqn[] fqns = {A, B, new Fqn(B, C), new Fqn(new Fqn(B, C), D), new Fqn(new Fqn(new Fqn(B, C), D), E)};
      //      System.out.println("*** LOADER BEFORE COMMIT ");
      //      for (Fqn f: fqns)
      //      {
      //         System.out.println("  Fqn: " + f);
      //         System.out.println("  Contents in loader: " + loader.get(f));
      //      }
      if (useTx) tm.commit();
      //      System.out.println("*** LOADER AFTER COMMIT ");
      //      for (Fqn f: fqns)
      //      {
      //         System.out.println("  Fqn: " + f);
      //         System.out.println("  Contents in loader: " + loader.get(f));
      //      }

      // after eviction, the node objects we hold are probably stale.
      nodeA = rootNode.getChild(A);
      nodeB = rootNode.getChild(B);
      nodeC = nodeB.getChild(C);
      log.info("nodeC get child B ");
      nodeD = nodeC.getChild(D);
      log.info("nodeD get child E ");
      nodeE = nodeD.getChild(E);

      Fqn<String> old_C = new Fqn<String>(C);
      Fqn<String> old_D = new Fqn<String>(old_C, D);
      Fqn<String> old_E = new Fqn<String>(old_D, E);

      assertNotNull(cache.peek(A, false));
      assertNotNull(cache.peek(B, false));
      assertNull(cache.peek(C, false));
      assertNull(cache.peek(new Fqn<String>(A, C), false));
      assertNotNull(cache.peek(new Fqn<String>(B, C), false));

      assertNotNull(cache.peek(new Fqn<String>(new Fqn<String>(B, C), D), false));
      assertNotNull(cache.peek(new Fqn<String>(new Fqn<String>(new Fqn<String>(B, C), D), E), false));

      // test data
      assertEquals(vA, nodeA.get(k));
      assertEquals(vB, nodeB.get(k));
      assertEquals(vC, nodeC.get(k));
      assertEquals(vD, nodeD.get(k));
      assertEquals(vE, nodeE.get(k));

      // parentage
      assertEquals(rootNode, nodeA.getParent());
      assertEquals(rootNode, nodeB.getParent());
      assertEquals(nodeB, nodeC.getParent());
      assertEquals(nodeC, nodeD.getParent());
      assertEquals(nodeD, nodeE.getParent());

      if (pasv) cache.evict(Fqn.ROOT, true);

      //now inspect the loader.
      assertEquals(vA, loader.get(nodeA.getFqn()).get(k));
      assertEquals(vB, loader.get(nodeB.getFqn()).get(k));
      assertEquals(vC, loader.get(nodeC.getFqn()).get(k));
      assertEquals(vD, loader.get(nodeD.getFqn()).get(k));
      assertEquals(vE, loader.get(nodeE.getFqn()).get(k));

      assertNull(loader.get(old_C));
      assertNull(loader.get(old_D));
      assertNull(loader.get(old_E));

   }
View Full Code Here

      assert c.getCacheLoaderManager() != null;
      assert c.getCacheLoaderManager().getCacheLoader() == null;

      CacheLoaderConfig clc = new CacheLoaderConfig();
      CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
      iclc.setCacheLoader(new DummyInMemoryCacheLoader());
      clc.addIndividualCacheLoaderConfig(iclc);
      c.getConfiguration().setCacheLoaderConfig(clc);

      c.start();
      assert c.getCacheLoaderManager() != null;
View Full Code Here

TOP

Related Classes of org.jboss.cache.loader.DummyInMemoryCacheLoader$DummyNode

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.