Package org.jboss.cache.loader.testloaders

Examples of org.jboss.cache.loader.testloaders.DummyInMemoryCacheLoader


   @BeforeTest
   public void setUp() throws Exception
   {
      CacheLoaderConfig cacheLoaderConfig = UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "", DummyInMemoryCacheLoader.class.getName(), "", false, true, false, false, false);
      // assign the cache loader explicitly so it will stick between restarts
      cacheLoaderConfig.getFirstCacheLoaderConfig().setCacheLoader(new DummyInMemoryCacheLoader());
      Configuration cfg = new Configuration();
      cfg.setCacheLoaderConfig(cacheLoaderConfig);
      cache = new UnitTestCacheFactory().createCache(cfg, getClass());
      cache.put(fqn, key, "value");
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

      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.testloaders.DummyInMemoryCacheLoader

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.