use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.
the class RestClientExceptionHandlerTest method client_handles_jetty_errors_500.
@Test
public void client_handles_jetty_errors_500() throws Exception {
try {
SchedulerRMProxyFactory schedulerFactory = mock(SchedulerRMProxyFactory.class);
when(schedulerFactory.connectToScheduler(Matchers.<CredData>any())).thenThrow(new LoginException());
SharedSessionStore.getInstance().setSchedulerRMProxyFactory(schedulerFactory);
SchedulerRestClient client = new SchedulerRestClient("http://localhost:" + port + "/");
client.getScheduler().login("demo", "demo");
fail("Should have throw an exception");
} catch (WebApplicationException e) {
assertTrue(e instanceof InternalServerErrorException);
assertEquals(500, e.getResponse().getStatus());
}
}
use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.
the class TestJobInstantGetTaskResult method testJobInstantGetTaskResult.
@Test
public void testJobInstantGetTaskResult() throws Throwable {
// create Scheduler client as an active object
client = (SubmitJob) PAActiveObject.newActive(SubmitJob.class.getName(), new Object[] {});
// begin to use the client : must be a futur result in order to start the scheduler at next step
client.begin();
// create job
TaskFlowJob job = new TaskFlowJob();
job.setProjectName("My project");
for (int i = 0; i < 50; i++) {
JavaTask t = new JavaTask();
t.setExecutableClassName(ResultAsArray.class.getName());
t.setName("task" + i);
job.addTask(t);
}
JobId id = schedulerHelper.submitJob(job);
client.setJobId(id);
schedulerHelper.waitForEventJobRemoved(id);
String projectName = client.getProjectName();
Assert.assertEquals("My project", projectName);
}
use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.
the class SchedulerClientTest method testAttachService.
@Test(timeout = MAX_WAIT_TIME)
public void testAttachService() throws Throwable {
ISchedulerClient client = clientInstance();
Job job = nodeClientJob("/functionaltests/descriptors/register_service.groovy", null, null);
JobId jobId = submitJob(job, client);
client.waitForJob(jobId.toString(), TimeUnit.MINUTES.toMillis(5));
JobInfo jobInfo = client.getJobInfo(jobId.toString());
Assert.assertNotNull(jobInfo);
Assert.assertNotNull(jobInfo.getAttachedServices());
Assert.assertEquals(1, jobInfo.getAttachedServices().size());
Assert.assertTrue(jobInfo.getAttachedServices().containsKey(12));
}
use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.
the class SchedulerClientTest method createThirdPartyCredentials.
@Test(timeout = MAX_WAIT_TIME)
public void createThirdPartyCredentials() throws Throwable {
ISchedulerClient client = clientInstance();
client.putThirdPartyCredential("key/slash", "value/slash");
Set<String> keySet1 = client.thirdPartyCredentialsKeySet();
System.out.println("Server Third-Party Credentials : " + keySet1);
Job job1 = createJob(JobResultTask.class);
Assert.assertTrue("credentials should contain the key", keySet1.contains("key/slash"));
client.removeThirdPartyCredential("key/slash");
Set<String> keySet2 = client.thirdPartyCredentialsKeySet();
System.out.println("Server Third-Party Credentials : " + keySet2);
Job job2 = createJob(JobResultTask.class);
Assert.assertFalse("credentials should not contain the key", keySet2.contains("key/slash"));
}
use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.
the class SchedulerClientTest method testAddAndRemoveExternalEndpointUrl.
@Test(timeout = MAX_WAIT_TIME)
public void testAddAndRemoveExternalEndpointUrl() throws Throwable {
ISchedulerClient client = clientInstance();
Job job = nodeClientJob("/functionaltests/descriptors/add_and_remove_external_endpoint_urls.groovy", null, null);
JobId jobId = submitJob(job, client);
client.waitForJob(jobId.toString(), TimeUnit.MINUTES.toMillis(5));
JobInfo jobInfo = client.getJobInfo(jobId.toString());
Assert.assertNotNull(jobInfo);
Assert.assertNotNull(jobInfo.getExternalEndpointUrls());
Assert.assertEquals(3, jobInfo.getExternalEndpointUrls().size());
Assert.assertEquals(new ExternalEndpoint("ccc", "http://ccc.fr", "icon/ccc"), jobInfo.getExternalEndpointUrls().get("ccc"));
Assert.assertEquals(new ExternalEndpoint("bbb", "http://bbb.fr", "icon/bbb"), jobInfo.getExternalEndpointUrls().get("bbb"));
// the last endpoint has null icon on purpose (to check that it does not cause issues)
Assert.assertEquals(new ExternalEndpoint("eee", "http://eee.fr", null), jobInfo.getExternalEndpointUrls().get("eee"));
}
Aggregations