Package org.fusesource.restygwt.client.cache

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


        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());
View Full Code Here


        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());
View Full Code Here

    protected void setUp() throws Exception{
        super.setUp();
        GWTMockUtilities.disarm();

        this.storage = new DefaultQueueableCacheStorage();
        this.key = new SimpleCacheKey("key");
        final CacheKey k = key;
        this.filter = new CachingCallbackFilter(this.storage){

            @Override
            protected CacheKey cacheKey(RequestBuilder builder) {
View Full Code Here

    protected void tearDown() {
        GWTMockUtilities.restore();
    }
   
    public void testDefaultScope(){
        CacheKey key = new SimpleCacheKey("first");
        CacheKey secondKey = new SimpleCacheKey("second");
        Response resp = EasyMock.createMock(Response.class);
        EasyMock.replay(resp);
         
        storage.putResult(key, resp);
        storage.putResult(secondKey, resp);
       
        assertNull(storage.getResultOrReturnNull(new SimpleCacheKey("unknown")));
        assertEquals(resp, ((ResponseWrapper)storage.getResultOrReturnNull(key)).response);
        assertEquals(resp, ((ResponseWrapper)storage.getResultOrReturnNull(secondKey)).response);
       
        storage.remove(key);
        assertNull(storage.getResultOrReturnNull(key));
View Full Code Here

       
        EasyMock.verify(resp);
    }

    public void testScope(){
        CacheKey key = new SimpleCacheKey("first");
        Response resp = EasyMock.createMock(Response.class);
        EasyMock.replay(resp);
         
        storage.putResult(key, resp);
       
        String scope = "admin";
        CacheKey scopedKey = new SimpleCacheKey("first scoped");
        CacheKey secondScopedKey = new SimpleCacheKey("second scoped");
        Response scopedResp = EasyMock.createMock(Response.class);
        EasyMock.replay(scopedResp);

        storage.putResult(scopedKey, scopedResp, scope);
        storage.putResult(secondScopedKey, scopedResp, scope);
       
        // check the cache content
        assertNull(storage.getResultOrReturnNull(new SimpleCacheKey("unknown")));
        assertNull(storage.getResultOrReturnNull(new SimpleCacheKey("unknown"), scope));
        assertNull(storage.getResultOrReturnNull(key, scope));
        assertEquals(resp, ((ResponseWrapper)storage.getResultOrReturnNull(key)).response);
        assertEquals(scopedResp, ((ResponseWrapper)storage.getResultOrReturnNull(scopedKey, scope)).response);
        assertEquals(scopedResp, ((ResponseWrapper)storage.getResultOrReturnNull(secondScopedKey, scope)).response);
View Full Code Here

        EasyMock.verify(resp);
        EasyMock.verify(scopedResp);
    }
   
    public void testQueue() {
        CacheKey key = new SimpleCacheKey("first");
        CacheKey secondKey = new SimpleCacheKey("second");
       
        assertFalse(storage.hasCallback(key));
       
        RequestCallback rc1 = EasyMock.createMock(RequestCallback.class);
        RequestCallback rc2 = EasyMock.createMock(RequestCallback.class);
View Full Code Here

        EasyMock.verify(rc1);
        EasyMock.verify(rc2);
    }
   
    public void testRestyHeader(){
        CacheKey key = new SimpleCacheKey("first");
        Response resp = EasyMock.createMock(Response.class);
        EasyMock.replay(resp);
       
        storage.putResult(key, resp);
       
View Full Code Here

TOP

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

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.