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;
}
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());
}
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());
}
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);
}
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()));
}
Aggregations