Package org.springframework.cache

Examples of org.springframework.cache.Cache$ValueWrapper


            }
        }
    }

    public Cache getCache(String name) {
        Cache cache = caches.get(name);
        if (cache == null) {
            final IMap<Object, Object> map = hazelcastInstance.getMap(name);
            cache = new HazelcastCache(map);
            final Cache currentCache = caches.putIfAbsent(name, cache);
            if (currentCache != null) {
                cache = currentCache;
            }
        }
        return cache;
View Full Code Here


   @Test
   public final void springRemoteCacheManagerShouldProperlyCreateCache() {
      final SpringRemoteCacheManager objectUnderTest = new SpringRemoteCacheManager(
               remoteCacheManager);

      final Cache defaultCache = objectUnderTest.getCache(TEST_CACHE_NAME);

      assertNotNull("getCache(" + TEST_CACHE_NAME
               + ") should have returned a default cache. However, it returned null.", defaultCache);
      assertEquals("getCache(" + TEST_CACHE_NAME + ") should have returned a cache name \""
               + TEST_CACHE_NAME + "\". However, the returned cache has a different name.",
               TEST_CACHE_NAME, defaultCache.getName());
   }
View Full Code Here

               SpringEmbeddedCacheManagerTest.class
                        .getResourceAsStream(NAMED_ASYNC_CACHE_CONFIG_LOCATION));
      final SpringEmbeddedCacheManager objectUnderTest = new SpringEmbeddedCacheManager(
               nativeCacheManager);

      final Cache cacheExpectedToHaveTheProvidedName = objectUnderTest
               .getCache(CACHE_NAME_FROM_CONFIGURATION_FILE);

      assertEquals(
               "getCache("
                        + CACHE_NAME_FROM_CONFIGURATION_FILE
                        + ") should have returned the cache having the provided name. However, the cache returned has a different name.",
               CACHE_NAME_FROM_CONFIGURATION_FILE, cacheExpectedToHaveTheProvidedName.getName());
      nativeCacheManager.stop();
   }
View Full Code Here

               nativeCacheManager);

      final org.infinispan.Cache<Object, Object> infinispanCacheAddedLater = nativeCacheManager
               .getCache(nameOfInfinispanCacheAddedLater);

      final Cache springCacheAddedLater = objectUnderTest
               .getCache(nameOfInfinispanCacheAddedLater);

      assertEquals(
               "getCache("
                        + nameOfInfinispanCacheAddedLater
                        + ") should have returned the Spring cache having the Infinispan cache added after creating "
                        + "SpringEmbeddedCacheManager as its underlying native cache. However, the underlying native cache is different.",
               infinispanCacheAddedLater, springCacheAddedLater.getNativeCache());
      nativeCacheManager.stop();
   }
View Full Code Here

    public void clearContext() {
        SecurityContextHolder.clearContext();
    }

    private Cache getCache() {
        Cache cache = cacheManager.getCache("springcasebasedacltests");
        cache.clear();
        return cache;
    }
View Full Code Here

    }

    @SuppressWarnings("rawtypes")
    @Test
    public void cacheOperationsAclWithoutParent() throws Exception {
        Cache cache = getCache();
        Map realCache = (Map) cache.getNativeCache();
        ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(100));
        AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
                new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority("ROLE_AUDITING"),
                new SimpleGrantedAuthority("ROLE_GENERAL"));
        AuditLogger auditLogger = new ConsoleAuditLogger();
View Full Code Here

    }

    @SuppressWarnings("rawtypes")
    @Test
    public void cacheOperationsAclWithParent() throws Exception {
        Cache cache = getCache();
        Map realCache = (Map) cache.getNativeCache();

        Authentication auth = new TestingAuthenticationToken("user", "password", "ROLE_GENERAL");
        auth.setAuthenticated(true);
        SecurityContextHolder.getContext().setAuthentication(auth);
View Full Code Here

    @AfterClass
    public static void shutdownCacheManager() {
    }

    private Cache getCache() {
        Cache cache = cacheManager.getCache("springbasedusercachetests");
        cache.clear();
        return cache;
    }
View Full Code Here

  protected Collection<Cache> getCaches(CacheOperation operation) {
    Set<String> cacheNames = operation.getCacheNames();
    Collection<Cache> caches = new ArrayList<Cache>(cacheNames.size());
    for (String cacheName : cacheNames) {
      Cache cache = this.cacheManager.getCache(cacheName);
      if (cache == null) {
        throw new IllegalArgumentException("Cannot find cache named [" + cacheName + "] for " + operation);
      }
      caches.add(cache);
    }
View Full Code Here

  public Collection<String> getCacheNames() {
    return Collections.unmodifiableSet(this.cacheMap.keySet());
  }

  public Cache getCache(String name) {
    Cache cache = this.cacheMap.get(name);
    if (cache == null && this.dynamic) {
      synchronized (this.cacheMap) {
        cache = this.cacheMap.get(name);
        if (cache == null) {
          cache = createConcurrentMapCache(name);
View Full Code Here

TOP

Related Classes of org.springframework.cache.Cache$ValueWrapper

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.