I am currently trying to use the SyncProxy
library to test services of my app, in order to do load testing with JMeter. The app works fine, I am running it on localhost.
The problem comes when I try to use SyncProxy in my JUnit tests, they fail.
Here is a piece of code used in a JUnit test :
ThemeServiceAsync themeServiceAsync = (ThemeServiceAsync) SyncProxy
.newProxyInstance(ThemeServiceAsync.class, MODULE_BASE_URL, GET_THEMES_SERVICE_NAME);
themeServiceAsync.getListTheme(codeEfs, codeSI, noStr, statut, new AsyncCallback<List<Theme>> (){
@Override
public void onFailure(Throwable arg0) {
// TODO Auto-generated method stub
System.out.println(arg0);
}
@Override
public void onSuccess(List<Theme> result) {
// TODO Auto-generated method stub
System.out.println(result);
}
});
I am getting the following error : IOException while receiving RPC response
I used the debug mode to find where was the problem coming from. On the server side, everything goes fine until the result is sent back to the client. The result is found in the database, but I have a mysterious 500 error.
After digging, I found that this exception is thrown (in the AbstractRemoteServiceServlet
) :
com.google.gwt.user.client.rpc.SerializationException: Type 'net.gicm.ector.shared.beans.Theme' was not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field serializer.
For security purposes, this type will not be serialized.: instance = net.gicm.ector.shared.beans.Theme@1b7cb71
I found a lot of threads talking about the fact that your class needs to implement "isSerializable", but what I don't understand, is that I am actually running my app on localhost, and everything is working fine, including the different services.
But when it comes to run my JUnit(s), I have those errors.