Search in sources :

Example 6 with ConnectionInfo

use of org.ow2.proactive.authentication.ConnectionInfo in project scheduling by ow2-proactive.

the class SchedulerClient method init.

@Override
public void init(ConnectionInfo connectionInfo) throws Exception {
    HttpClient client = new HttpClientBuilder().insecure(connectionInfo.isInsecure()).useSystemProperties().build();
    SchedulerRestClient restApiClient = new SchedulerRestClient(connectionInfo.getUrl(), new ApacheHttpClient4Engine(client));
    ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
    factory.register(new WildCardTypeReader());
    factory.register(new OctetStreamReader());
    factory.register(new TaskResultReader());
    setApiClient(restApiClient);
    this.connectionInfo = connectionInfo;
    this.initialized = true;
    renewSession();
}
Also used : WildCardTypeReader(org.ow2.proactive.scheduler.rest.readers.WildCardTypeReader) TaskResultReader(org.ow2.proactive.scheduler.rest.readers.TaskResultReader) OctetStreamReader(org.ow2.proactive.scheduler.rest.readers.OctetStreamReader) HttpClient(org.apache.http.client.HttpClient) CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) ApacheHttpClient4Engine(org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine) HttpClientBuilder(org.ow2.proactive.http.HttpClientBuilder) SchedulerRestClient(org.ow2.proactive_grid_cloud_portal.scheduler.client.SchedulerRestClient) ResteasyProviderFactory(org.jboss.resteasy.spi.ResteasyProviderFactory)

Example 7 with ConnectionInfo

use of org.ow2.proactive.authentication.ConnectionInfo in project scheduling by ow2-proactive.

the class DataSpaceClient method init.

public void init(ConnectionInfo connectionInfo) throws Exception {
    ISchedulerClient client = SchedulerClient.createInstance();
    client.init(connectionInfo);
    init(connectionInfo.getUrl(), client);
}
Also used : ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient)

Example 8 with ConnectionInfo

use of org.ow2.proactive.authentication.ConnectionInfo in project scheduling by ow2-proactive.

the class DataTransferTest method clientInstance.

private IDataSpaceClient clientInstance() throws Exception {
    DataSpaceClient client = new DataSpaceClient();
    client.init(new ConnectionInfo(getRestServerUrl(), getLogin(), getPassword(), null, true));
    return client;
}
Also used : ConnectionInfo(org.ow2.proactive.authentication.ConnectionInfo)

Example 9 with ConnectionInfo

use of org.ow2.proactive.authentication.ConnectionInfo in project scheduling by ow2-proactive.

the class SchedulerClientTest method testGetGroups.

@Test(timeout = MAX_WAIT_TIME)
public void testGetGroups() throws Exception {
    ISchedulerClient client = SchedulerClient.createInstance();
    client.init(new ConnectionInfo(getRestServerUrl(), getLogin(), getPassword(), null, true));
    UserData userData = client.getCurrentUserData();
    Assert.assertNotNull(userData);
    Assert.assertNotNull(userData.getGroups());
    Assert.assertTrue(userData.getGroups().contains("admin"));
    client.disconnect();
    client.init(new ConnectionInfo(getRestServerUrl(), getNonAdminLogin(), getNonAdminLoginPassword(), null, true));
    userData = client.getCurrentUserData();
    Assert.assertNotNull(userData);
    Assert.assertNotNull(userData.getGroups());
    Assert.assertTrue(userData.getGroups().contains("user"));
    client.disconnect();
}
Also used : UserData(org.ow2.proactive.authentication.UserData) ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) ConnectionInfo(org.ow2.proactive.authentication.ConnectionInfo) Test(org.junit.Test)

Example 10 with ConnectionInfo

use of org.ow2.proactive.authentication.ConnectionInfo in project scheduling by ow2-proactive.

the class SchedulerClientTest method clientInstance.

private ISchedulerClient clientInstance() throws Exception {
    ISchedulerClient client = SchedulerClient.createInstance();
    client.init(new ConnectionInfo(getRestServerUrl(), getLogin(), getPassword(), null, true));
    return client;
}
Also used : ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) ConnectionInfo(org.ow2.proactive.authentication.ConnectionInfo)

Aggregations

ConnectionInfo (org.ow2.proactive.authentication.ConnectionInfo)9 ISchedulerClient (org.ow2.proactive.scheduler.rest.ISchedulerClient)4 File (java.io.File)2 KeyException (java.security.KeyException)2 Test (org.junit.Test)2 CredData (org.ow2.proactive.authentication.crypto.CredData)2 PublicKey (java.security.PublicKey)1 TimeoutException (java.util.concurrent.TimeoutException)1 LoginException (javax.security.auth.login.LoginException)1 HttpClient (org.apache.http.client.HttpClient)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1 ApacheHttpClient4Engine (org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine)1 ResteasyProviderFactory (org.jboss.resteasy.spi.ResteasyProviderFactory)1 Before (org.junit.Before)1 UserData (org.ow2.proactive.authentication.UserData)1 Credentials (org.ow2.proactive.authentication.crypto.Credentials)1 HttpClientBuilder (org.ow2.proactive.http.HttpClientBuilder)1 SchedulerAuthenticationInterface (org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface)1 InternalSchedulerException (org.ow2.proactive.scheduler.common.exception.InternalSchedulerException)1 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)1