Package org.fusesource.restygwt.client.cache

Examples of org.fusesource.restygwt.client.cache.VolatileQueueableCacheStorage


    public void gwtSetUp() {
        /*
         * configure RESTY to use cache, usually done in gin
         */
        final EventBus eventBus = new SimpleEventBus();
        final QueueableCacheStorage cache = new VolatileQueueableCacheStorage();
       
        final CallbackFilter cachingCallbackFilter = new CachingCallbackFilter(cache);
        final CallbackFactory callbackFactory = new RetryingCallbackFactory(cachingCallbackFilter,
                new ModelChangeCallbackFilter(eventBus));
        final DispatcherFilter cachingDispatcherFilter = new CachingDispatcherFilter(cache, callbackFactory);
View Full Code Here


     *
     */
    public void testIfCachingWorks() {
        //configure RESTY to use cache:
        final EventBus eventBus = new SimpleEventBus();
        QueueableCacheStorage cache = new VolatileQueueableCacheStorage();
        CallbackFilter cachingCallbackFilter = new CachingCallbackFilter(cache);
        CallbackFactory callbackFactory = new DefaultCallbackFactory(cachingCallbackFilter,
                    new ModelChangeCallbackFilter(eventBus));
        DispatcherFilter cachingDispatcherFilter = new CachingDispatcherFilter(cache, callbackFactory);
       
View Full Code Here

    @Override
    public void gwtSetUp() {
        /*
         * configure RESTY to use cache, usually done in gin
         */
        QueueableCacheStorage cache = new VolatileQueueableCacheStorage();
       
        CallbackFilter cachingCallbackFilter = new CachingCallbackFilter(cache);
        CallbackFactory callbackFactory = new RetryingCallbackFactory(
                100,// grace period millis
                4,// number of retries
View Full Code Here

    public String getModuleName() {
        return "org.fusesource.restygwt.VolatileQueueableCacheStorageTestGwt";
    }
   
    public void testTimeout() throws Exception{
        final VolatileQueueableCacheStorage storage = new VolatileQueueableCacheStorage(100);
        final CacheKey key = new SimpleCacheKey("first");
        Response resp = new ResponseMock();

        storage.putResult(key, resp);
        // hashCode should be good enough
        assertEquals(resp.hashCode(), storage.getResultOrReturnNull(key).hashCode());
        Timer timer = new Timer() {

            @Override
            public void run() {
                assertNull(storage.getResultOrReturnNull(key));  
                finishTest();
            }
           
        };
        timer.schedule(200);
View Full Code Here

        timer.schedule(200);
        delayTestFinish(250);
    }

    public void testPurge() throws Exception{
        final VolatileQueueableCacheStorage storage = new VolatileQueueableCacheStorage();
        final CacheKey key = new SimpleCacheKey("first");
        Response resp = new ResponseMock();
         
        storage.putResult(key, resp);
        // hashCode should be good enough
        assertEquals(resp.hashCode(), storage.getResultOrReturnNull(key).hashCode());
        storage.purge();
        assertNull(storage.getResultOrReturnNull(key));
    }
View Full Code Here

    public void testDefaultFunction() {
        /*
         * configure RESTY to use cache, usually done in gin
         */
        final EventBus eventBus = new SimpleEventBus();
        final QueueableCacheStorage cacheStorage = new VolatileQueueableCacheStorage();
        final FilterawareDispatcher dispatcher = new DefaultFilterawareDispatcher();

        dispatcher.addFilter(new CachingDispatcherFilter(
                cacheStorage,
                new CallbackFactory() {
View Full Code Here

    public void gwtSetUp() {
        /*
         * configure RESTY to use cache, usually done in gin
         */
        final EventBus eventBus = new SimpleEventBus();
        final QueueableCacheStorage cacheStorage = new VolatileQueueableCacheStorage();
        final FilterawareDispatcher dispatcher = new DefaultFilterawareDispatcher();

        dispatcher.addFilter(new CachingDispatcherFilter(
                cacheStorage,
                new CallbackFactory() {
View Full Code Here

        return dispatcher;
    }

    public FilterawareDispatcher retryingDispatcher(){
        QueueableCacheStorage cache = new VolatileQueueableCacheStorage();

        CallbackFilter cachingCallbackFilter = new CachingCallbackFilter(cache);
        CallbackFactory callbackFactory = new RetryingCallbackFactory(cachingCallbackFilter);
        DispatcherFilter cachingDispatcherFilter = new CachingDispatcherFilter(cache, callbackFactory);
View Full Code Here

TOP

Related Classes of org.fusesource.restygwt.client.cache.VolatileQueueableCacheStorage

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.