Hi Krishantha,

We don't have an debug logs that can be used to check if the request was
taken from the cache or from the database. Adding such a log is also not
possible since if a debug log is added that will be printed for each and
every resource and that would flood the carbon log.

I will check if an automation test can be written using the cache listeners
that gayashan has mentioned.

Best Regards,
Pulasthi

On Thu, May 21, 2015 at 1:27 PM, Krishantha Samaraweera <[email protected]
> wrote:

> Hi Pulasthi,
>
> Any default debug logs available in cache implementation. Using debug logs
> we can verify whether the resource is really cached or not.
>
> Other option would be to check DB calls.. which is bit hard to use as
> automation verification step.
>
> Thanks,
> Krishantha.
>
> On Wed, May 20, 2015 at 1:18 PM, Gayashan Amarasinghe <[email protected]>
> wrote:
>
>> Hi Pulasthi,
>>
>> Apologies, didn't understand that your query is regarding resource
>> caching in the registry. Perhaps, you can use a cache listener for this
>> task [1] if it is possible to engage listeners to the resource cache?
>>
>> [1]
>> https://github.com/wso2/carbon4-kernel/blob/master/core/javax.cache/src/test/java/org/wso2/carbon/caching/impl/CacheListenerTestCase.java
>>
>> Thank you.
>> /Gayashan
>>
>> On Wed, May 20, 2015 at 1:09 PM, Pulasthi Supun <[email protected]>
>> wrote:
>>
>>> 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
>>>
>>
>>
>>
>> --
>> *Gayashan Amarasinghe*
>> Software Engineer | Platform TG
>> WSO2, Inc. | http://wso2.com
>> lean. enterprise. middleware
>>
>> Mobile : +94718314517
>> Blog : gayashan-a.blogspot.com
>>
>
>
>
> --
> Krishantha Samaraweera
> Senior Technical Lead - Test Automation
> Mobile: +94 77 7759918
> WSO2, Inc.; http://wso2.com/
> lean . enterprise . middlewear.
>



-- 
--
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

Reply via email to