Search in sources :

Example 1 with ExternalEndpoint

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"));
}
Also used : ExternalEndpoint(org.ow2.proactive.scheduler.job.ExternalEndpoint) JobInfo(org.ow2.proactive.scheduler.common.job.JobInfo) ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleJob(functionaltests.jobs.SimpleJob) Job(org.ow2.proactive.scheduler.common.job.Job) NonTerminatingJob(functionaltests.jobs.NonTerminatingJob) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 2 with ExternalEndpoint

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();
    }
}
Also used : ExternalEndpoint(org.ow2.proactive.scheduler.job.ExternalEndpoint) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException)

Aggregations

ExternalEndpoint (org.ow2.proactive.scheduler.job.ExternalEndpoint)2 NonTerminatingJob (functionaltests.jobs.NonTerminatingJob)1 SimpleJob (functionaltests.jobs.SimpleJob)1 Test (org.junit.Test)1 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)1 Job (org.ow2.proactive.scheduler.common.job.Job)1 JobId (org.ow2.proactive.scheduler.common.job.JobId)1 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)1 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)1 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)1 ISchedulerClient (org.ow2.proactive.scheduler.rest.ISchedulerClient)1