use of org.ow2.proactive.scheduler.rest.ISchedulerClient 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.scheduler.rest.ISchedulerClient 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.scheduler.rest.ISchedulerClient 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"));
}
use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.
the class SchedulerClientTest method testJobSubmissionEventListener.
@Test(timeout = MAX_WAIT_TIME * 2)
public void testJobSubmissionEventListener() throws Exception {
ISchedulerClient client = clientInstance();
SchedulerEventListenerImpl listener = new SchedulerEventListenerImpl();
client.addEventListener(listener, true, SchedulerEvent.JOB_SUBMITTED, SchedulerEvent.USERS_UPDATE);
Job job = defaultJob();
Map<String, JobVariable> jobVariables = new LinkedHashMap<>();
jobVariables.put("MY_VAR", new JobVariable("MY_VAR", "MY_VALUE", "PA:NOT_EMPTY_STRING", "a test variable", "MY_GROUP", true, true));
job.setVariables(jobVariables);
JobId jobId = client.submit(job);
JobState submittedJob = listener.getSubmittedJob();
while (!submittedJob.getId().value().equals(jobId.value())) {
submittedJob = listener.getSubmittedJob();
}
UserIdentification userIdentification = listener.getLastUserUpdate();
assertTrue(userIdentification.getLastSubmitTime() != -1);
JobInfo jobInfo = client.getJobInfo(jobId.toString());
System.out.println("Variables = " + jobInfo.getVariables());
Map<String, JobVariable> stateJobVariables = jobInfo.getDetailedVariables();
assertEquals(jobVariables, stateJobVariables);
client.removeEventListener();
client.waitForJob(jobId, TimeUnit.SECONDS.toMillis(120));
}
use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.
the class SchedulerClientTest method testReSubmitJobWithInfo.
@Test
public void testReSubmitJobWithInfo() throws Exception {
ISchedulerClient client = clientInstance();
Job job = nodeClientJob("/functionaltests/descriptors/dataspace_client_node_push_delete.groovy", "/functionaltests/descriptors/dataspace_client_node_fork.groovy", null);
JobId jobId = submitJob(job, client);
Map<String, String> infos = new HashMap<>();
infos.put("myinfo", "myvalue");
JobId jobId1 = client.reSubmit(jobId, Collections.emptyMap(), infos, null);
String jobContent1 = client.getJobContent(jobId1);
assertFalse(jobContent1.contains("<variables>"));
assertTrue(jobContent1.contains("<genericInformation>"));
assertTrue(jobContent1.contains("myinfo"));
assertTrue(jobContent1.contains("myvalue"));
}
Aggregations