use of com.google.gwt.user.client.rpc.RemoteService in project gwt-test-utils by gwt-test-utils.
the class TestRemoteServiceCreateHandler method instanciateRemoteServiceInstance.
@SuppressWarnings("unchecked")
private <T> T instanciateRemoteServiceInstance(Class<T> remoteServiceClass, String remoteServiceRelativePath) {
String moduleName = GwtConfig.get().getTestedModuleName();
Class<?> remoteServiceImplClass = ModuleData.get(moduleName).getRemoteServiceImplClass(remoteServiceRelativePath);
if (remoteServiceImplClass == null) {
return null;
} else if (!remoteServiceClass.isAssignableFrom(remoteServiceImplClass)) {
throw new GwtTestConfigurationException("The servlet class '" + remoteServiceImplClass.getName() + "' setup for path '" + remoteServiceRelativePath + "' does not implement RemoteService interface '" + remoteServiceClass.getName());
} else {
try {
return (T) GwtReflectionUtils.instantiateClass(remoteServiceImplClass);
} catch (Exception e) {
throw new GwtTestConfigurationException("Error during the instanciation of " + RemoteService.class.getSimpleName() + " implementation for servlet path '" + remoteServiceRelativePath + "'", e);
}
}
}
Aggregations