Package org.infinispan.manager

Examples of org.infinispan.manager.CacheContainer


   public void testAll() throws Exception {
      log.info("*** testAll()");

      // Bind a listener to the "local" cache
      // Our region factory makes its CacheManager available to us
      CacheContainer localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL);
      // Cache localCache = localManager.getCache("entity");
      Cache localCustomerCache = localManager.getCache(Customer.class.getName());
      Cache localContactCache = localManager.getCache(Contact.class.getName());
      Cache localCollectionCache = localManager.getCache(Customer.class.getName() + ".contacts");
      MyListener localListener = new MyListener("local");
      localCustomerCache.addListener(localListener);
      localContactCache.addListener(localListener);
      localCollectionCache.addListener(localListener);
      TransactionManager localTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestCase.LOCAL);

      // Bind a listener to the "remote" cache
      CacheContainer remoteManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.REMOTE);
      Cache remoteCustomerCache = remoteManager.getCache(Customer.class.getName());
      Cache remoteContactCache = remoteManager.getCache(Contact.class.getName());
      Cache remoteCollectionCache = remoteManager.getCache(Customer.class.getName() + ".contacts");
      MyListener remoteListener = new MyListener("remote");
      remoteCustomerCache.addListener(remoteListener);
      remoteContactCache.addListener(remoteListener);
      remoteCollectionCache.addListener(remoteListener);
      TransactionManager remoteTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestCase.REMOTE);
View Full Code Here


      DualNodeJtaTransactionManagerImpl.cleanupTransactions();
   }

   public void testRefreshAfterExternalChange() throws Exception {
      // First session factory uses a cache
      CacheContainer localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL);
      localCache = localManager.getCache(Account.class.getName());
      TransactionManager localTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestCase.LOCAL);
      SessionFactory localFactory = getEnvironment().getSessionFactory();

      // Second session factory doesn't; just needs a transaction manager
      // However, start at least the cache to avoid issues with replication and cache not being there
View Full Code Here

    * @throws Exception
    */
   public void testIsolatedSetup() throws Exception {
      // Bind a listener to the "local" cache
      // Our region factory makes its CacheManager available to us
      CacheContainer localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL);
      Cache localReplicatedCache = localManager.getCache("replicated-entity");

      // Bind a listener to the "remote" cache
      CacheContainer remoteManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.REMOTE);
      Cache remoteReplicatedCache = remoteManager.getCache("replicated-entity");

      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      Thread.currentThread().setContextClassLoader(cl.getParent());
      log.info("TCCL is " + cl.getParent());

View Full Code Here

   @Override
   public SharedLocalYieldingClusterLockManager getLockManager(Cache<?, ?> cache)
   {
      if (!cache.getConfiguration().getCacheMode().isClustered()) return null;
     
      CacheContainer container = cache.getCacheManager();
     
      String cacheName = cache.getName();
      LockManagerKey key = new LockManagerKey(container, cacheName);
     
      synchronized (lockManagers)
View Full Code Here

              "</globalJmxStatistics>" +
              "</global>" +
              "<default><jmxStatistics enabled=\"true\"/></default>" +
              "</infinispan>";
      InputStream stream = new ByteArrayInputStream(cfg.getBytes());
      CacheContainer cc = null;
      try {
         cc = TestCacheManagerFactory.fromStream(stream);
         cc.getCache();
         assert "value".equals(TestLookup.p.get("key"));
      } finally {
         TestingUtil.killCacheManagers(cc);
      }
   }
View Full Code Here

         TestingUtil.killCacheManagers(cc);
      }
   }

   public void testProgrammaticCustomMBeanServerLookupProperties() {
      CacheContainer cc = null;
      try {
         GlobalConfiguration gc = new GlobalConfiguration();
         TestLookup mbsl = new TestLookup();
         gc.setMBeanServerLookupInstance(mbsl);
         Properties p = new Properties();
         p.setProperty("key", "value");
         gc.setMBeanServerProperties(p);
         Configuration cfg = new Configuration();
         cfg.setExposeJmxStatistics(true);
         cc = TestCacheManagerFactory.createCacheManager(gc, cfg);
         cc.getCache();
         assert "value".equals(mbsl.localProps.get("key"));
      } finally {
         TestingUtil.killCacheManagers(cc);
      }
   }
View Full Code Here

   @Override
   protected void createCacheManagers() throws Throwable {
      GlobalConfiguration globalCfg1 = GlobalConfiguration.getClusteredDefault();
      GlobalConfiguration globalCfg2 = GlobalConfiguration.getClusteredDefault();
      CacheContainer cm1 = TestCacheManagerFactory.createCacheManager(globalCfg1);
      CacheContainer cm2 = TestCacheManagerFactory.createCacheManager(globalCfg2);
      registerCacheManager(cm1, cm2);
      Configuration cfg = getDefaultClusteredConfig(Configuration.CacheMode.REPL_SYNC);
      defineConfigurationOnAllManagers(CACHE_NAME, cfg);
      waitForClusterToForm(CACHE_NAME);
   }
View Full Code Here

      GlobalConfiguration globalConfiguration = GlobalConfiguration.getClusteredDefault();
      globalConfiguration.setExposeGlobalJmxStatistics(true);
      globalConfiguration.setAllowDuplicateDomains(true);
      globalConfiguration.setJmxDomain(JMX_DOMAIN);
      globalConfiguration.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
      CacheContainer cacheManager1 = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(globalConfiguration);
      cacheManager1.start();
      GlobalConfiguration globalConfiguration2 = GlobalConfiguration.getClusteredDefault();
      globalConfiguration2.setExposeGlobalJmxStatistics(true);
      globalConfiguration2.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
      globalConfiguration2.setJmxDomain(JMX_DOMAIN);
      globalConfiguration2.setAllowDuplicateDomains(true);
      CacheContainer cacheManager2 = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(globalConfiguration2);
      cacheManager2.start();
      registerCacheManager(cacheManager1, cacheManager2);
      name1 = getCacheManagerObjectName(JMX_DOMAIN);
      name2 = getCacheManagerObjectName(JMX_DOMAIN2);
      server = PerThreadMBeanServerLookup.getThreadMBeanServer();
      Configuration config = getDefaultClusteredConfig(Configuration.CacheMode.REPL_SYNC);
View Full Code Here

   public void testManagerStopRemovesCacheMBean(Method m) throws Exception {
      final String otherJmxDomain = getMethodSpecificJmxDomain(m, JMX_DOMAIN);
      ObjectName defaultOn = getCacheObjectName(otherJmxDomain);
      ObjectName galderOn = getCacheObjectName(otherJmxDomain, "galder(local)");
      ObjectName managerON = getCacheManagerObjectName(otherJmxDomain);
      CacheContainer otherContainer = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(otherJmxDomain);
      server.invoke(managerON, "startCache", new Object[]{}, new String[]{});
      server.invoke(managerON, "startCache", new Object[]{"galder"}, new String[]{String.class.getName()});
      assert ComponentStatus.RUNNING.toString().equals(server.getAttribute(defaultOn, "CacheStatus"));
      assert ComponentStatus.RUNNING.toString().equals(server.getAttribute(galderOn, "CacheStatus"));
      otherContainer.stop();
      try {
         log.info(server.getMBeanInfo(managerON));
         assert false : "Failure expected, " + managerON + " shouldn't be registered in mbean server";
      } catch (InstanceNotFoundException e) {
      }
View Full Code Here

      }
   }


   public void testDuplicateJmxDomainOnlyCacheExposesJmxStatistics() throws Exception {
      CacheContainer otherContainer = null;
      try {
         otherContainer = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(JMX_DOMAIN, false, true);
         otherContainer.getCache();
         assert false : "Failure expected, " + JMX_DOMAIN + " is a duplicate!";
      } catch (CacheException e) {
         assert e instanceof JmxDomainConflictException;
      } finally {
         TestingUtil.killCacheManagers(otherContainer);
View Full Code Here

TOP

Related Classes of org.infinispan.manager.CacheContainer

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.