Package org.infinispan

Examples of org.infinispan.Cache


   @ManagedAttribute(description = "The total number of running caches, including the default cache.")
   @Metric(displayName = "Number of running caches", displayType = DisplayType.SUMMARY)
   public String getRunningCacheCount() {
      int running = 0;
      for (CacheWrapper cachew : caches.values()) {
         Cache cache = cachew.cache;
         if (cache != null && cache.getStatus() == ComponentStatus.RUNNING)
            running++;
      }
      return String.valueOf(running);
   }
View Full Code Here


      AssertJUnit.assertEquals(3, counter);
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testSearchWithWrongCache() throws ParseException {
      Cache cache = mock(CacheImpl.class);
      when(cache.getAdvancedCache()).thenReturn(null);

      SearchManager manager = Search.getSearchManager(cache);
   }
View Full Code Here

   @Override
   protected void createCacheManagers() throws Throwable {
      caches = TestQueryHelperFactory.createTopologyAwareCacheNodes(NUM_NODES, CacheMode.DIST_SYNC, false, true, false);

      for(Object cache : caches) {
         Cache cacheObj = (Cache) cache;
         EmbeddedCacheManager cm1 = cacheObj.getCacheManager();
         ConfigurationBuilder cacheCfg1 = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, false);
         cm1.defineConfiguration(InfinispanIntegration.DEFAULT_INDEXESDATA_CACHENAME, cacheCfg1.build());
         cm1.defineConfiguration(InfinispanIntegration.DEFAULT_LOCKING_CACHENAME, cacheCfg1.build());

         cacheManagers.add(cm1);
View Full Code Here

   protected void createCacheManagers() throws Throwable {
      EmbeddedCacheManager cacheManager = null;
      for (int i = 0; i < NUM_NODES; i++) {
         cacheManager = TestCacheManagerFactory.fromXml("dynamic-indexing-distribution.xml");
         registerCacheManager(cacheManager);
         Cache cache = cacheManager.getCache();
         caches.add(cache);
      }
      waitForClusterToForm(neededCacheNames);
   }
View Full Code Here

      //Used to verify remoting is fine with non serializable keys
      return new NonSerializableKeyType(keyId);
   }

   protected void rebuildIndexes() throws Exception {
      Cache cache = caches.get(0);
      SearchManager searchManager = Search.getSearchManager(cache);
      searchManager.getMassIndexer().start();
   }
View Full Code Here

               .mBeanServerLookup(new PerThreadMBeanServerLookup());

         EmbeddedCacheManager cm = TestCacheManagerFactory
               .createClusteredCacheManager(holder, true);
         registerCacheManager(cm);
         Cache cache = cm.getCache();
         caches.add(cache);
      }
      waitForClusterToForm(neededCacheNames);
   }
View Full Code Here

      query.disableFullTextFilter("personFilter");
      AssertJUnit.assertEquals(2, query.getResultSize());
   }

   public void testSearchKeyTransformer() throws Exception {
      Cache cache1 = caches().get(0);
      Cache cache2 = caches().get(1);

      SearchManager manager = Search.getSearchManager(cache1);
      SearchManager manager1 = Search.getSearchManager(cache2);
      manager.registerKeyTransformer(CustomKey3.class, CustomKey3Transformer.class);
      manager1.registerKeyTransformer(CustomKey3.class, CustomKey3Transformer.class);

      prepareTestedObjects();

      TransactionManager transactionManager = cache1.getAdvancedCache().getTransactionManager();

      CustomKey3 customeKey1 = new CustomKey3(key1);
      CustomKey3 customeKey2 = new CustomKey3(key2);
      CustomKey3 customeKey3 = new CustomKey3(key3);

      // Put the 3 created objects in the cache1.
      if (transactionsEnabled()) transactionManager.begin();
      cache1.put(customeKey1, person1);
      cache1.put(customeKey2, person2);
      cache2.put(customeKey3, person3);
      if (transactionsEnabled()) transactionManager.commit();

      queryParser = createQueryParser("blurb");
      Query luceneQuery = queryParser.parse("Eats");
View Full Code Here

        log.debugf("Creating SDC for domain=" + securityDomain);
        AuthenticationManager am = createAuthenticationManager(securityDomain);
        // create authentication cache
        if (cacheFactory instanceof EmbeddedCacheManager) {
            EmbeddedCacheManager cacheManager = EmbeddedCacheManager.class.cast(cacheFactory);
            @SuppressWarnings("rawtypes")
            Cache cache = null;
            if (cacheManager != null) {
                // TODO override global settings with security domain specific
                cacheManager.defineConfiguration(securityDomain, "auth-cache", new Configuration());
                cache = cacheManager.getCache(securityDomain);
View Full Code Here

        log.debug("Creating SDC for domain=" + securityDomain);
        AuthenticationManager am = createAuthenticationManager(securityDomain);
        // create authentication cache
        if (cacheFactory instanceof EmbeddedCacheManager) {
            EmbeddedCacheManager cacheManager = EmbeddedCacheManager.class.cast(cacheFactory);
            @SuppressWarnings("rawtypes")
            Cache cache = null;
            if (cacheManager != null) {
                // TODO override global settings with security domain specific
                cacheManager.defineConfiguration(securityDomain, "auth-cache", new Configuration());
                cache = cacheManager.getCache(securityDomain);
View Full Code Here

   public static InitializationContext createContext(String cacheName, Configuration configuration, StreamingMarshaller marshaller) {
      return createContext(cacheName, configuration, marshaller, AbstractInfinispanTest.TIME_SERVICE);
   }

   public static InitializationContext createContext(String cacheName, Configuration configuration, StreamingMarshaller marshaller, TimeService timeService) {
      Cache mockCache = mockCache(cacheName, configuration, timeService);
      return new InitializationContextImpl(configuration.persistence().stores().get(0), mockCache, marshaller,
                                           timeService, new ByteBufferFactoryImpl(), new MarshalledEntryFactoryImpl(marshaller));
   }
View Full Code Here

TOP

Related Classes of org.infinispan.Cache

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.