Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-10266

Spring Cache doesn't remove the cache or update the cache configuration

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 9.4.16.Final, 10.0.0.Final
    • 9.4.14.Final
    • None
    • None

      After ISPN-10171, the Spring Cache doesn't remove the cache or update the cache configuration.

      I am expecting the cache to be null once it was removed from remote cache manager.

        @Test
         public final void getCacheShouldReturnNullItWasChangedByRemoteCacheManager() {
            // Given
            objectUnderTest = new SpringRemoteCacheManager(remoteCacheManager);
      
             // When
            objectUnderTest.getCache(TEST_CACHE_NAME);
            remoteCacheManager.administration().removeCache(TEST_CACHE_NAME);
      
             // Then
            assertNull(objectUnderTest.getCache(TEST_CACHE_NAME));
         }
      

      I am expecting a different instance of the cache once the configuration was changed.

          @Test
         public final void getCacheShouldReturnDiffInstanceItWasChangedByRemoteCacheManager() {
            // Given
            objectUnderTest = new SpringRemoteCacheManager(remoteCacheManager);
      
             // When
            final SpringCache firstObtainedSpringCache = objectUnderTest.getCache(TEST_CACHE_NAME);
            remoteCacheManager.administration().removeCache(TEST_CACHE_NAME);
            remoteCacheManager.administration().createCache(TEST_CACHE_NAME, cacheManager.getDefaultCacheConfiguration());
      
             // Then
            final SpringCache secondObtainedSpringCache = objectUnderTest.getCache(TEST_CACHE_NAME);
            assertNotSame(
                  "getCache() shouldn't have the same SpringCache instance for the same name because the config was changed",
                  firstObtainedSpringCache, secondObtainedSpringCache);
         }
      

              karestig@redhat.com Katia Aresti
              dlovison@redhat.com Diego Lovison
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: