Package org.fusesource.restygwt.client.callback

Examples of org.fusesource.restygwt.client.callback.DefaultFilterawareRequestCallback


        dispatcher.addFilter(new CachingDispatcherFilter(
                cacheStorage,
                new CallbackFactory() {
                    public FilterawareRequestCallback createCallback(Method method) {
                        final FilterawareRequestCallback retryingCallback = new DefaultFilterawareRequestCallback(
                                method);

                        retryingCallback.addFilter(new CachingCallbackFilter(cacheStorage));
                        retryingCallback.addFilter(new ModelChangeCallbackFilter(eventBus));
                        return retryingCallback;
                    }
                }));

        Defaults.setDispatcher(dispatcher);
View Full Code Here


        dispatcher.addFilter(new CachingDispatcherFilter(
                cacheStorage,
                new CallbackFactory() {
                    public FilterawareRequestCallback createCallback(Method method) {
                        final FilterawareRequestCallback retryingCallback = new DefaultFilterawareRequestCallback(
                                method);

                        retryingCallback.addFilter(new CachingCallbackFilter(cacheStorage));
                        retryingCallback.addFilter(new ModelChangeCallbackFilter(eventBus));
                        return retryingCallback;
                    }
                }));

        Defaults.setDispatcher(dispatcher);
View Full Code Here

        EasyMock.replay(builder);
        method.builder = builder;
        EasyMock.expect(method.isExpected(200)).andReturn(true);
        EasyMock.replay(method);
       
        FilterawareRequestCallback callback = new DefaultFilterawareRequestCallback(method);

        // set the response code
        Response resp = EasyMock.createMock(Response.class);
        EasyMock.expect(resp.getStatusCode()).andReturn(200).anyTimes();
        EasyMock.replay(resp);
       
        // expect to call each filter with RequestCallback rc
        CallbackFilter[] filters = new CallbackFilter[4];
        for(int i = 0; i < filters.length; i++){
            filters[i] = EasyMock.createMock(CallbackFilter.class);
            callback.addFilter(filters[i]);
            EasyMock.expect(filters[i].filter(method, resp, rc)).andReturn(rc);
            EasyMock.replay(filters[i]);
        }
       
        //now call the success case
        callback.onResponseReceived(null, resp);
       
        // now call the error case
        Exception e = new Exception();
        try{
            callback.onError(null, e);
            fail();
        }
        catch(RuntimeException ee){
            assertSame(e, ee.getCause());
        }
View Full Code Here

TOP

Related Classes of org.fusesource.restygwt.client.callback.DefaultFilterawareRequestCallback

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.