Search in sources :

Example 11 with ISchedulerClient

use of org.ow2.proactive.scheduler.rest.ISchedulerClient 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)

Example 12 with ISchedulerClient

use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.

the class SchedulerClientTest method testDisconnect.

@Test(timeout = MAX_WAIT_TIME)
public void testDisconnect() throws Exception {
    ISchedulerClient client = clientInstance();
    client.disconnect();
    Assert.assertFalse(client.isConnected());
    client = clientInstance();
    Assert.assertTrue(client.isConnected());
}
Also used : ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) Test(org.junit.Test)

Example 13 with ISchedulerClient

use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.

the class SchedulerClientTest method testSchedulerNodeClient.

@Test(timeout = MAX_WAIT_TIME)
public void testSchedulerNodeClient() throws Throwable {
    ISchedulerClient client = clientInstance();
    Job job = nodeClientJob("/functionaltests/descriptors/scheduler_client_node.groovy", "/functionaltests/descriptors/scheduler_client_node_fork.groovy");
    JobId jobId = submitJob(job, client);
    TaskResult tres = client.waitForTask(jobId.toString(), "NodeClientTask", TimeUnit.MINUTES.toMillis(5));
    System.out.println(tres.getOutput().getAllLogs(false));
    Assert.assertNotNull(tres);
    Assert.assertEquals("Hello NodeClientTask I'm HelloTask", tres.value());
}
Also used : ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) TaskResult(org.ow2.proactive.scheduler.common.task.TaskResult) 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 14 with ISchedulerClient

use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.

the class SchedulerClientTest method testRenewSession.

@Test(timeout = MAX_WAIT_TIME)
public void testRenewSession() throws Exception {
    ISchedulerClient client = clientInstance();
    SchedulerStatus status = client.getStatus();
    assertNotNull(status);
    // use an invalid session
    client.setSession("invalid-session-identifier");
    // client should automatically renew the session identifier
    status = client.getStatus();
    assertNotNull(status);
}
Also used : SchedulerStatus(org.ow2.proactive.scheduler.common.SchedulerStatus) ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) Test(org.junit.Test)

Example 15 with ISchedulerClient

use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.

the class SchedulerClientTest method testSchedulerNodeClientCleanScript.

@Test(timeout = MAX_WAIT_TIME)
public void testSchedulerNodeClientCleanScript() throws Throwable {
    ISchedulerClient client = clientInstance();
    client.putThirdPartyCredential("TEST_CREDS", "mypassword_${PA_JOB_ID}");
    Job job = nodeClientJob("/functionaltests/descriptors/scheduler_client_node.groovy", "/functionaltests/descriptors/scheduler_client_node_fork.groovy");
    JobId jobId = submitJob(job, client);
    JobResult jres = client.waitForJob(jobId, TimeUnit.MINUTES.toMillis(5));
    Assert.assertNotNull(jres);
    // wait 10 seconds because it is possible clean script executes after job
    Thread.sleep(10000);
    String jobLog = client.getJobServerLogs("" + jobId);
    // assert schedulerapi.connect() worked
    Assert.assertThat(jobLog, CoreMatchers.containsString("SCHEDULERAPI_URI_LIST_NOT_NULL=true"));
    // assert userspaceapi.connect() worked
    Assert.assertThat(jobLog, CoreMatchers.containsString("USERSPACE_FILE_LIST_NOT_NULL=true"));
    // assert globalspaceapi.connect() worked
    Assert.assertThat(jobLog, CoreMatchers.containsString("GLOBALSPACE_FILE_LIST_NOT_NULL=true"));
    // assert globalspaceapi.connect() worked
    Assert.assertThat(jobLog, CoreMatchers.containsString("TEST_CREDS=mypassword_" + jobId.toString()));
}
Also used : JobResult(org.ow2.proactive.scheduler.common.job.JobResult) 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)

Aggregations

ISchedulerClient (org.ow2.proactive.scheduler.rest.ISchedulerClient)16 Test (org.junit.Test)14 NonTerminatingJob (functionaltests.jobs.NonTerminatingJob)9 SimpleJob (functionaltests.jobs.SimpleJob)9 Job (org.ow2.proactive.scheduler.common.job.Job)9 JobId (org.ow2.proactive.scheduler.common.job.JobId)9 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)9 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)5 ConnectionInfo (org.ow2.proactive.authentication.ConnectionInfo)3 JobResult (org.ow2.proactive.scheduler.common.job.JobResult)3 File (java.io.File)2 JobState (org.ow2.proactive.scheduler.common.job.JobState)2 ErrorTask (functionaltests.jobs.ErrorTask)1 LogTask (functionaltests.jobs.LogTask)1 MetadataTask (functionaltests.jobs.MetadataTask)1 RawTask (functionaltests.jobs.RawTask)1 VariableTask (functionaltests.jobs.VariableTask)1 Serializable (java.io.Serializable)1 ApacheHttpClient4Engine (org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine)1 StringWrapper (org.objectweb.proactive.core.util.wrapper.StringWrapper)1