use of org.activityinfo.ui.client.dispatch.remote.cache.CacheResult in project activityinfo by bedatadriven.
the class RemoteDispatcherTest method commandsSuccessfullyExecutedThroughProxiesShouldNotBeSentToServer.
@Test
public void commandsSuccessfullyExecutedThroughProxiesShouldNotBeSentToServer() {
GetSchema command = new GetSchema();
expect(proxy.maybeExecute(eq(command))).andReturn(new CacheResult(new SchemaDTO()));
replay(proxy);
// no calls should be made to the remote service
replay(service);
AsyncCallback callback = makeCallbackThatExpectsNonNullSuccess();
proxyManager.registerProxy(GetSchema.class, proxy);
dispatcher.execute(new GetSchema(), callback);
processPendingCommands();
verify(proxy, service, callback);
}
use of org.activityinfo.ui.client.dispatch.remote.cache.CacheResult in project activityinfo by bedatadriven.
the class RemoteDispatcherTest method successiveCommandsServedByProxyAreCorrectlyHandleded.
@Test
public void successiveCommandsServedByProxyAreCorrectlyHandleded() {
GetSchema command = new GetSchema();
expect(proxy.maybeExecute(eq(command))).andReturn(new CacheResult(new SchemaDTO())).anyTimes();
replay(proxy);
// no calls should be made to the remote service
replay(service);
final AsyncCallback callback2 = makeCallbackThatExpectsNonNullSuccess();
proxyManager.registerProxy(GetSchema.class, proxy);
dispatcher.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {
@Override
public void onFailure(Throwable arg0) {
throw new AssertionError();
}
@Override
public void onSuccess(SchemaDTO arg0) {
dispatcher.execute(new GetSchema(), callback2);
}
});
processPendingCommands();
processPendingCommands();
verify(proxy, service, callback2);
}
Aggregations