Package org.jboss.cache

Examples of org.jboss.cache.UnitTestCacheFactory


   static boolean notificationsReceived = true;

   @BeforeMethod
   public void setUp() throws CloneNotSupportedException
   {
      UnitTestCacheFactory cf = new UnitTestCacheFactory<Object, Object>();
      Configuration conf = new Configuration();
      conf.setCacheMode(Configuration.CacheMode.REPL_SYNC);
      BuddyReplicationConfig brc = new BuddyReplicationConfig();
      brc.setEnabled(true);
      conf.setBuddyReplicationConfig(brc);

      c1 = cf.createCache(conf, false, getClass());
      c2 = cf.createCache(conf.clone(), false, getClass());
      c3 = cf.createCache(conf.clone(), false, getClass());

      c1.start();
      c2.start();
      c3.start();
View Full Code Here


      CacheLoaderConfig cacheLoaderConfig = UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(passivation, "", DummyInMemoryCacheLoader.class.getName(), "", false, true, false, false, false);
      Configuration cfg = new Configuration();
      cfg.setNodeLockingScheme(getNodeLockingScheme());
      cfg.setCacheLoaderConfig(cacheLoaderConfig);
      cfg.getRuntimeConfig().setTransactionManager(new DummyTransactionManager());
      Cache<String, String> cache = new UnitTestCacheFactory().createCache(cfg, getClass());
      cache.put(fqn, key, "value");

      // evict the node, so we have to go to the loader to do anything with it
      cache.evict(fqn);
      return cache;
View Full Code Here

@Test(groups = "functional", testName = "notifications.CacheListenerRemovalTest")
public class CacheListenerRemovalTest
{
   public void testListenerRemoval()
   {
      Cache cache = new UnitTestCacheFactory().createCache(getClass());
      AtomicInteger i = new AtomicInteger(0);
      try
      {
         assert 0 == cache.getCacheListeners().size();
         Listener l = new Listener(i);
View Full Code Here

      return c;
   }

   public void testSimpleStateTransfer() throws Exception
   {
      first = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props1), getClass());
      first.put("/a/b/c", "key", "value");
      first.put("/a/b/d", "key", "value");
      first.put("/a/b/e", "key", "value");
      second = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props2), getClass());
      assert second.get("/a/b/c", "key").equals("value");
      assert second.get("/a/b/d", "key").equals("value");
      assert second.get("/a/b/e", "key").equals("value");
      JDBCCacheLoader cacheLoader = (JDBCCacheLoader) second.getCacheLoaderManager().getCacheLoader();
      assert cacheLoader.exists(Fqn.fromString("/a"));
View Full Code Here

   @Test (enabled = false)
   public void testMoreState() throws Exception
   {
      long startTime = System.currentTimeMillis();

      first = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props1), getClass());
      long cacheStartTime = System.currentTimeMillis() - startTime;
      for (int i = 0; i < 5012; i++)
      {
         first.put("a/b/" + i, "k", "v");
      }
      startTime = System.currentTimeMillis();
      second = (CacheSPI) new UnitTestCacheFactory().createCache(getConfiguration(props2), getClass());

      long stateTranferTime = System.currentTimeMillis() - startTime - cacheStartTime;
      System.out.println("stateTranferTime = " + stateTranferTime);
      for (int i = 0; i < 5012; i += 100)
      {
View Full Code Here

   Cache cache;

   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {
      cache = new UnitTestCacheFactory().createCache(getClass());
   }  
View Full Code Here

   private void doTest(Configuration c)
   {
      Cache cache = null;
      try
      {
         cache = new UnitTestCacheFactory().createCache(c);

         EvictionRegionConfig erc = cache.getRegion(Fqn.ROOT, false).getEvictionRegionConfig();
         assert erc.getEvictionAlgorithmConfig() instanceof FIFOAlgorithmConfig;
         assert erc.getEvictionActionPolicyClassName().equals(DefaultEvictionActionPolicy.class.getName());
View Full Code Here

   private void doTest(NodeLockingScheme nls, boolean set)
   {
      Cache c = null;
      try
      {
         c = new UnitTestCacheFactory().createCache(false);
         c.getConfiguration().setNodeLockingScheme(nls);
         c.getConfiguration().setLockParentForChildInsertRemove(set);
         if (nls.isVersionedScheme())
            c.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
         c.start();
View Full Code Here

   public void testChannelInjectionPreference() throws Exception
   {
      muxHelper.configureCacheForMux(cache);

      Channel channel = new JChannel(new UnitTestCacheFactory().mangleClusterConfiguration(
              UnitTestCacheConfigurationFactory.getClusterConfigFromProperties(JChannel.DEFAULT_PROTOCOL_STACK)));

      RuntimeConfig rtcfg = cache.getConfiguration().getRuntimeConfig();
      rtcfg.setChannel(channel);
View Full Code Here

         }
      }
      cachesTL.set(null);
      System.gc();
     
      new UnitTestCacheFactory().cleanUp();
     
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.UnitTestCacheFactory

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.