Package com.google.gwt.user.client.rpc

Examples of com.google.gwt.user.client.rpc.AsyncCallback.onSuccess()


                if (data.startsWith("$JSONSTART$") && data.endsWith("$JSONEND$")) {
                    dataToSend = JSONParser.parse(data.substring("$JSONSTART$".length(), data.length() - "$JSONEND$".length()));
                }

                callback.onSuccess(dataToSend);
            } catch (JSONException e) {
                callback.onFailure(e);
            }
        } else {
            alert("received event for a not subscribed topic: '" + topicName + "'");
View Full Code Here


    expectLastCall().andAnswer(new IAnswer<Object>() {
      @Override
      public Object answer() throws Throwable {
        final Object[] arguments = getCurrentArguments();
        AsyncCallback callback = (AsyncCallback) arguments[arguments.length - 1];
        callback.onSuccess(1L);
        return null;
      }
    });   
  }
 
View Full Code Here

    private static final class GetAsynchronousAnswer implements Answer<Void> {
        @Override
        @SuppressWarnings({"unchecked", "rawtypes"})
        public Void answer(InvocationOnMock invocation) throws Throwable {
            final AsyncCallback callback = (AsyncCallback) invocation.getArguments()[1];
            callback.onSuccess(invocation.getArguments()[0]);
            return null;
        }
    }

    /**
 
View Full Code Here

   */
  public void onSuccess(Object result) {
    for (Iterator/* <AsyncCallback>*/ it = iterator(); it.hasNext();) {
      AsyncCallback acceptor = (AsyncCallback) it.next();

      acceptor.onSuccess(result);
    }
  }
}
View Full Code Here

        verify(mockDispatcher).execute(actionCaptor.capture(),
                callbackCaptor.capture());

        AsyncCallback callback = callbackCaptor.getValue();
        callback.onSuccess(result);

        verify(mockEventBus, times(3)).fireEvent(
                isA(DocumentStatsUpdatedEvent.class));
        verify(mockEventBus, times(1)).fireEvent(
                isA(RefreshProjectStatsEvent.class));
View Full Code Here

        AsyncCallback callback = callbackCaptor.getValue();

        // when(needReviewChk.getValue()).thenReturn(false);
        // when(translatedChk.getValue()).thenReturn(true);
        // when(untranslatedChk.getValue()).thenReturn(false);
        callback.onSuccess(result);
        assertThat(configHolder.getState().getEditorPageSize(),
                Matchers.equalTo(10));
        assertThat(configHolder.getState().getNavOption(),
                Matchers.equalTo(NavOption.FUZZY));
View Full Code Here

        verify(dispatcher).execute(actionCaptor.capture(),
                callbackCaptor.capture());

        AsyncCallback callback = callbackCaptor.getValue();

        callback.onSuccess(result);
        assertThat(configHolder.getState().getDocumentListPageSize(),
                Matchers.equalTo(100));
        assertThat(configHolder.getState().isShowError(),
                Matchers.equalTo(true));
View Full Code Here

        // on calling get translator list callback success
        verify(dispatcher).execute(Mockito.eq(GetTranslatorList.ACTION),
                callbackCaptor.capture());
        AsyncCallback callback = callbackCaptor.getValue();
        callback.onSuccess(result);
        verify(result).getTranslatorList();
        verify(sessionService).initUserList(result.getTranslatorList());
    }

    @Test
View Full Code Here

                oneOf(actionCb2).onSuccess(with(same(result2)));
                will(throwException(new RuntimeException("Naughty callback")));
            }
        });

        serviceExecCb.onSuccess(results);
        context.assertIsSatisfied();
    }

    /**
     * Tests losing a session and re-establishing it. Test adds an extra wrinkle by having the service reject the first
View Full Code Here

            {
                oneOf(service).establishSession(with(any(AsyncCallback.class)));
                will(paramInt);
            }
        });
        serviceExecCb.onSuccess(new ActionRequest[] { new ActionResponse(requests[0], new SessionException()) });
        context.assertIsSatisfied();

        // -- service replies with error. SUT should notify app --
        AsyncCallback<String> serviceSessionCb = (AsyncCallback<String>) paramInt.getParam(0);
        final Exception ex = new Exception("Can it handle it?");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.