Package org.infinispan.manager

Examples of org.infinispan.manager.CacheContainer


              "<infinispan>" +
              "<global><transport /></global>" +
              "<default><clustering><sync /><async /></clustering></default></infinispan>";

      InputStream stream = new ByteArrayInputStream(xml.getBytes());
      CacheContainer cc = TestCacheManagerFactory.fromStream(stream);
      cc.getCache();
   }
View Full Code Here


      super.onFinish(testCxt);
      checkCleanedUp(testCxt);
   }
  
   private void checkCleanedUp(ITestContext testCxt) {
      CacheContainer cm = TestCacheManagerFactory.createClusteredCacheManager(new Configuration());
      try {
         cm.start();
         try {
            TestingUtil.blockUntilViewReceived(cm.getCache(), 1, 2000, true);
         } catch (RuntimeException re) {
            failedTestDescriptions.add(
                     "CacheManagers alive after test! - " + testCxt.getName() + " " + re.getMessage()
                     );
         }
View Full Code Here

   /**
    * Transforms and tests the transformation of a complex file.
    */
   private void testAllFile(String coherenceFileName) throws Exception {
      ClassLoader existingCl = Thread.currentThread().getContextClassLoader();
      CacheContainer dcm = null;
      Cache<Object, Object> sampleDistributedCache2 = null;
      try {
         ClassLoader delegatingCl = new Jbc2InfinispanTransformerTest.TestClassLoader(existingCl);
         Thread.currentThread().setContextClassLoader(delegatingCl);
         String fileName = getFileName(coherenceFileName);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         convertor.parse(fileName, baos, ConfigFilesConvertor.TRANSFORMATIONS.get(ConfigFilesConvertor.COHERENCE_35X), Thread.currentThread().getContextClassLoader());
         dcm = TestCacheManagerFactory.fromStream(new ByteArrayInputStream(baos.toByteArray()));
         Cache<Object,Object> defaultCache = dcm.getCache();
         defaultCache.put("key", "value");
         Cache<Object, Object> cache = dcm.getCache("dist-*");
         cache.put("a","v");

      } finally {
         Thread.currentThread().setContextClassLoader(existingCl);
         TestingUtil.killCaches(sampleDistributedCache2);
View Full Code Here

            containerName = parts[0];
            cacheName = parts[1];
         }
      }
     
      CacheContainer container = this.registry.getCacheContainer(containerName);
      this.cache = (cacheName == null) ? container.<SSOKey, Object>getCache() : container.<SSOKey, Object>getCache(cacheName);
     
      if (!this.cache.getStatus().allowInvocations())
      {
         this.cache.start();
      }
View Full Code Here

      }
      return hitCountInterceptor;
   }

   protected void assertOnlyServerHit(SocketAddress serverAddress) {
      CacheContainer cacheContainer = hrServ2CacheManager.get(serverAddress);
      HitCountInterceptor interceptor = getHitCountInterceptor(cacheContainer.getCache());
      assert interceptor.getHits() == 1 : "Expected one hit but received " + interceptor.getHits();
      for (CacheContainer cm : hrServ2CacheManager.values()) {
         if (cm != cacheContainer) {
            interceptor = getHitCountInterceptor(cm.getCache());
            assert interceptor.getHits() == 0 : "Expected 0 hits but got " + interceptor.getHits();
View Full Code Here

   public void testHashFunctionReturnsSameValues() {
      for (int i = 0; i < 1000; i++) {
         byte[] key = generateKey(i);
         TcpTransport transport = (TcpTransport) tcpConnectionFactory.getTransport(key);
         SocketAddress serverAddress = transport.getServerAddress();
         CacheContainer cacheContainer = hrServ2CacheManager.get(serverAddress);
         assertNotNull("For server address " + serverAddress + " found " + cacheContainer + ". Map is: " + hrServ2CacheManager, cacheContainer);
         DistributionManager distributionManager = cacheContainer.getCache().getAdvancedCache().getDistributionManager();
         Address clusterAddress = cacheContainer.getCache().getAdvancedCache().getRpcManager().getAddress();

         ConsistentHash serverCh = distributionManager.getReadConsistentHash();
         int numSegments = serverCh.getNumSegments();
         int keySegment = serverCh.getSegment(key);
         Address serverOwner = serverCh.locatePrimaryOwnerForSegment(keySegment);
View Full Code Here

         tcpConnectionFactory.releaseTransport(transport);
      }
   }

   private void assertCacheContainsKey(SocketAddress serverAddress, byte[] keyBytes) {
      CacheContainer cacheContainer = hrServ2CacheManager.get(serverAddress);
      Cache<Object, Object> cache = cacheContainer.getCache();
      DataContainer dataContainer = cache.getAdvancedCache().getDataContainer();
      assert dataContainer.keySet().contains(new ByteArrayKey(keyBytes));
   }
View Full Code Here

   }
  
   public void add(CacheContainerRegistryConfigurationEntry entry) throws NamingException
   {
      CacheContainerConfiguration configuration = new CacheContainerConfigurationAdapter(entry.getConfiguration());
      CacheContainer container = this.factory.createCacheContainer(configuration);

      Map<String, String> aliases = this.mapAliases(entry);
      if (!aliases.isEmpty())
      {
         container = new AliasAwareCacheContainer(container, aliases);
View Full Code Here

   }

   @Override
   public void init()
   {
      CacheContainer container = this.registry.getCacheContainer(this.containerName);
      Cache<String, Binding> cache = (this.cacheName == null) ? container.<String, Binding>getCache() : container.<String, Binding>getCache(this.cacheName);
      this.cache = this.treeCacheFactory.createTreeCache(cache);
     
      if (!cache.getStatus().allowInvocations())
      {
         this.cache.start();
View Full Code Here

   public void testHashFunctionReturnsSameValues() {
      for (int i = 0; i < 1000; i++) {
         byte[] key = generateKey(i);
         TcpTransport transport = (TcpTransport) tcpConnectionFactory.getTransport(key);
         SocketAddress serverAddress = transport.getServerAddress();
         CacheContainer cacheContainer = hrServ2CacheManager.get(serverAddress);
         assertNotNull("For server address " + serverAddress + " found " + cacheContainer + ". Map is: " + hrServ2CacheManager, cacheContainer);
         DistributionManager distributionManager = cacheContainer.getCache().getAdvancedCache().getDistributionManager();
         Address clusterAddress = cacheContainer.getCache().getAdvancedCache().getRpcManager().getAddress();

         ConsistentHash serverCh = distributionManager.getReadConsistentHash();
         int numSegments = serverCh.getNumSegments();
         int keySegment = serverCh.getSegment(key);
         Address serverOwner = serverCh.locatePrimaryOwnerForSegment(keySegment);
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.