Class CacheTest

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static String cacheKey  
      protected static String cacheKey_2  
      protected GlobalCacheService globalCache  
      protected static org.apache.logging.log4j.Logger log  
      • Fields inherited from class org.apache.fulcrum.testcontainer.BaseUnit5Test

        attributes, COMPONENT_APP_ROOT, CONTAINER_ECM, CONTAINER_YAAFI, defaultLogLevel, maxInactiveInterval
    • Constructor Summary

      Constructors 
      Constructor Description
      CacheTest()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void cleanup()  
      protected String getCacheRoleName()
      Method to configure the role name of the service used
      protected void setUp()  
      void test2ObjectAddGetCachedObject()
      Simple test that adds, retrieves, and deletes 2 object.
      void testCacheFlush()
      Verify the all object will be flushed from the cache.
      void testCacheGetCachedObjects()
      Test that we can get a list of the keys in the cache
      void testCacheGetKeyList()
      Test that we can get a list of the keys in the cache
      void testCacheModification()
      Test that the retrieved list is safe from ConcurrentModificationException's being thrown if the cache is updated while we are iterating over the List.
      void testObjectCount()
      Verify the Cache count is correct.
      void testObjectExpiration()
      Verify that an object will throw the ObjectExpiredException when it now longer exists in cache.
      void testRefreshableObject()
      Verify a refreshable object will refreshed in the following cases: o The object is retrieved via getObject an it is stale. o The object is determined to be stale during a cache refresh This test can take several minutes.
      void testRefreshableTimeToLive()
      Verify a cached object will be delete after it has been untouched beyond it's TimeToLive.
      void testSimpleAddGetCacheObject()
      Simple test that verify an object can be created and deleted.
      • Methods inherited from class org.apache.fulcrum.testcontainer.BaseUnit5Test

        getConfigurationFileName, getContainerType, getMockRequest, getParameterFileName, getRoleFileName, lookup, release, setConfigurationFileName, setContainerType, setLogLevel, setRoleFileName, tearDown
    • Method Detail

      • getCacheRoleName

        protected String getCacheRoleName()
        Method to configure the role name of the service used
        Returns:
        the role name of the service to lookup
      • cleanup

        @AfterEach
        protected void cleanup()
      • testObjectExpiration

        @Test
        public void testObjectExpiration()
                                  throws Exception
        Verify that an object will throw the ObjectExpiredException when it now longer exists in cache.
        Throws:
        Exception - if object is not expired
      • testCacheFlush

        @Test
        public void testCacheFlush()
                            throws Exception
        Verify the all object will be flushed from the cache. This test can take server minutes.
        Throws:
        Exception - if flushing the cache fails
      • testObjectCount

        @Test
        public void testObjectCount()
                             throws Exception
        Verify the Cache count is correct.
        Throws:
        Exception - if the cache count does not match expected value
      • testRefreshableObject

        @Tag("LongRunning")
        @Test
        public void testRefreshableObject()
                                   throws Exception
        Verify a refreshable object will refreshed in the following cases: o The object is retrieved via getObject an it is stale. o The object is determined to be stale during a cache refresh This test can take several minutes.
        Throws:
        Exception - if object is not a refreshable object
      • testRefreshableTimeToLive

        @Tag("LongRunning")
        @Test
        public void testRefreshableTimeToLive()
                                       throws Exception
        Verify a cached object will be delete after it has been untouched beyond it's TimeToLive. This test can take several minutes.
        Throws:
        Exception - if object is not deleted
      • testCacheGetKeyList

        @Test
        public void testCacheGetKeyList()
        Test that we can get a list of the keys in the cache
      • testCacheGetCachedObjects

        @Test
        public void testCacheGetCachedObjects()
        Test that we can get a list of the keys in the cache
      • testCacheModification

        @Test
        public void testCacheModification()
        Test that the retrieved list is safe from ConcurrentModificationException's being thrown if the cache is updated while we are iterating over the List.