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() {
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);
/*
* setup the service, usually done in gin
*/
Resource resource = new Resource(GWT.getModuleBaseURL());
final ModelChangeAnnotatedService service = GWT.create(ModelChangeAnnotatedService.class);
((RestServiceProxy) service).setResource(resource);
final ModelChangedEventHandlerImpl handler = new ModelChangedEventHandlerImpl();
eventBus.addHandler(ModelChangeEvent.TYPE, handler);
/*
* first we create a client GET request to prepare all things as it
* would be when displaying a list of items in the client.