Re: GWT rpc callback does not call after calling in GWTTestCase
Answered on http://stackoverflow.com/questions/14194561/gwt-rpc-callback-does-not-call-after-calling-in-gwttestcase
On Monday, January 7, 2013 12:04:23 PM UTC+1, Saeed Zarinfam wrote:
I have written a GWTTestCase like this:
public void testClickButton() {
SampleView view = new SampleView();
RootPanel.get().add(view);
view.textBox.setText("Saeed Zarinfam");
assertEquals("", view.label.getText());
// ButtonElement.as(view.button.getElement()).click();
view.button.getElement().<ButtonElement>cast().click();
assertEquals("Bean \"OCTO\" has been created", view.label.getText());
}
When i run this test it connect to my servlet (i added some log on my servlet) but the RPC callback does not call in my `SampleView`, junit say:
expected: <Bean "OCTO" has been created>, actual: <>
This is my callback in button click handler:
@UiHandler("button")
void onClick(ClickEvent e) {
labelTest.setText("click button");
AsyncCallback<FooBean> callback = new AsyncCallback<FooBean>() {
public void onFailure(Throwable caught) {
// Show the RPC error message to the user
labelTest.setText("call fail");
label.setText("Failure : " + caught.getMessage());
}
public void onSuccess(FooBean result) {
labelTest.setText("call success");
label.setText("Bean \"" + result.getName() + "\" has been created");
}
};
// Make the call. Control flow will continue immediately and later
// 'callback' will be invoked when the RPC completes.
service.createBean("OCTO", callback);
}
Why GWT rpc callback does not call in this case?
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/_modl_46AgIJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home