Hi Krishantha, The manual process that i used to test the changes was to add several conditional logs to check if a specific resource was taken from the database or of the cache hit was successful. And test which log was hit after 15mints ( the timeout period ).
@Gayashan What you are explaining can be used to test the caching implementation it self, not if the changes done to make the registry resource cache works properly. Best Regards, Pulasthi On Wed, May 20, 2015 at 1:04 PM, Gayashan Amarasinghe <[email protected]> wrote: > Hi Pulasthi, > > You can initiate a new cache manager and a cache with a proper cache > expiry time. > > CacheManager cacheManager = > Caching.getCacheManagerFactory().getCacheManager( > cacheManagerName); > Cache<String, String> cache = cacheManager.<String, String> > createCacheBuilder(cacheName). > setExpiry(CacheConfiguration.ExpiryType.MODIFIED, > new CacheConfiguration.Duration(TimeUnit.SECONDS, 10)). > setStoreByValue(false).build(); > > and put items in to that cache and sleep the thread until the cache expiry > time. After waking up you can assert whether the inserted item is null. If > null, the cache has expired. > > There are some existing test cases [1] in the kernel. > > [1] > https://github.com/wso2/carbon4-kernel/blob/master/core/javax.cache/src/test/java/org/wso2/carbon/caching/impl/CachingTestCase.java#L246 > > > Thank you. > /Gayashan > > On Wed, May 20, 2015 at 12:26 PM, Pulasthi Supun <[email protected]> > wrote: > >> Hi All, >> >> Is there a way to write automation tests to tests the timeout >> configurations of the cache. The test needs to be able to test if the cache >> values were invalidated after the given timeout. >> >> Best Regards, >> Pulasthi >> >> -- >> -- >> Pulasthi Supun >> Software Engineer; WSO2 Inc.; http://wso2.com, >> Email: [email protected] >> Mobile: +94 (71) 9258281 >> Blog : http://pulasthisupun.blogspot.com/ >> Git hub profile: https://github.com/pulasthi >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > *Gayashan Amarasinghe* > Software Engineer | Platform TG > WSO2, Inc. | http://wso2.com > lean. enterprise. middleware > > Mobile : +94718314517 > Blog : gayashan-a.blogspot.com > -- -- Pulasthi Supun Software Engineer; WSO2 Inc.; http://wso2.com, Email: [email protected] Mobile: +94 (71) 9258281 Blog : http://pulasthisupun.blogspot.com/ Git hub profile: https://github.com/pulasthi
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
