use of org.ow2.proactive.scheduler.job.ExternalEndpoint 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.job.ExternalEndpoint in project scheduling by ow2-proactive.
the class LiveJobs method addExternalEndpointUrl.
boolean addExternalEndpointUrl(JobId jobId, String endpointName, String externalEndpointUrl, String endpointIconUri) throws UnknownJobException {
JobData jobData = lockJob(jobId);
if (jobData == null) {
throw new UnknownJobException(jobId);
}
try {
InternalJob job = jobData.job;
job.getExternalEndpointUrls().put(endpointName, new ExternalEndpoint(endpointName, externalEndpointUrl, endpointIconUri));
dbManager.updateExternalEnpointUrls(job);
listener.jobStateUpdated(jobData.job.getOwner(), new NotificationData<>(SchedulerEvent.JOB_UPDATED, jobData.job.getJobInfo()));
return true;
} finally {
jobData.unlock();
}
}
Aggregations