use of com.runwaysdk.ClientSession in project geoprism-registry by terraframe.
the class TestDataSet method runAsUser.
public static void runAsUser(TestUserInfo user, RequestExecutor executor) {
ClientSession session = null;
try {
session = ClientSession.createUserSession(user.getUsername(), user.getPassword(), new Locale[] { CommonProperties.getDefaultLocale() });
ClientRequestIF request = session.getRequest();
TestRegistryAdapterClient adapter = new TestRegistryAdapterClient();
adapter.setClientRequest(request);
adapter.refreshMetadataCache();
try {
executor.execute(request, adapter);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
} finally {
if (session != null) {
session.logout();
}
}
}
Aggregations