Search in sources :

Example 1 with ClientSession

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();
        }
    }
}
Also used : Locale(java.util.Locale) ClientSession(com.runwaysdk.ClientSession) ClientRequestIF(com.runwaysdk.constants.ClientRequestIF)

Aggregations

ClientSession (com.runwaysdk.ClientSession)1 ClientRequestIF (com.runwaysdk.constants.ClientRequestIF)1 Locale (java.util.Locale)1