Search in sources :

Example 86 with Script

use of org.ow2.proactive_grid_cloud_portal.studio.Script 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)

Example 87 with Script

use of org.ow2.proactive_grid_cloud_portal.studio.Script in project scheduling by ow2-proactive.

the class CheckEligibleTaskDescriptorScriptTest method testOnlyCleanScriptContainsAPIBinding.

@Test
public void testOnlyCleanScriptContainsAPIBinding() throws InvalidScriptException {
    Script s = scriptWithApiBindingClient();
    Script s2 = scriptWithoutApiBinding();
    FlowScript fs = flowScriptWithoutApiBinding();
    Mockito.when(it.getPreScript()).thenReturn(s2);
    Mockito.when(it.getPostScript()).thenReturn(s2);
    Mockito.when(it.getCleaningScript()).thenReturn(s);
    Mockito.when(sec.getScript()).thenReturn(s2);
    Mockito.when(fe.getEnvScript()).thenReturn(s2);
    Mockito.when(it.getFlowScript()).thenReturn(fs);
    assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd));
}
Also used : SimpleScript(org.ow2.proactive.scripting.SimpleScript) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Script(org.ow2.proactive.scripting.Script) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Test(org.junit.Test)

Example 88 with Script

use of org.ow2.proactive_grid_cloud_portal.studio.Script in project scheduling by ow2-proactive.

the class CheckEligibleTaskDescriptorScriptTest method testOnlyFlowScriptContainsAPIBinding.

@Test
public void testOnlyFlowScriptContainsAPIBinding() throws InvalidScriptException {
    Script s = scriptWithoutApiBinding();
    FlowScript fs = flowScriptWithApiBindingUser();
    Mockito.when(it.getPreScript()).thenReturn(s);
    Mockito.when(it.getPostScript()).thenReturn(s);
    Mockito.when(it.getCleaningScript()).thenReturn(s);
    Mockito.when(fe.getEnvScript()).thenReturn(s);
    Mockito.when(sec.getScript()).thenReturn(s);
    Mockito.when(it.getFlowScript()).thenReturn(fs);
    assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd));
}
Also used : SimpleScript(org.ow2.proactive.scripting.SimpleScript) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Script(org.ow2.proactive.scripting.Script) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Test(org.junit.Test)

Example 89 with Script

use of org.ow2.proactive_grid_cloud_portal.studio.Script in project scheduling by ow2-proactive.

the class CheckEligibleTaskDescriptorScriptTest method testAllScriptsContainAPIBinding.

@Test
public void testAllScriptsContainAPIBinding() throws InvalidScriptException {
    Script s = scriptWithApiBindingClient();
    Script s1 = scriptWithApiBindingUser();
    Script s2 = scriptWithApiBindingGlobal();
    FlowScript fs = flowScriptWithApiBindingClient();
    Mockito.when(it.getPreScript()).thenReturn(s1);
    Mockito.when(it.getPostScript()).thenReturn(s2);
    Mockito.when(it.getCleaningScript()).thenReturn(s2);
    Mockito.when(sec.getScript()).thenReturn(s);
    Mockito.when(fe.getEnvScript()).thenReturn(s);
    Mockito.when(it.getFlowScript()).thenReturn(fs);
    assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd));
}
Also used : SimpleScript(org.ow2.proactive.scripting.SimpleScript) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Script(org.ow2.proactive.scripting.Script) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Test(org.junit.Test)

Example 90 with Script

use of org.ow2.proactive_grid_cloud_portal.studio.Script in project scheduling by ow2-proactive.

the class CheckEligibleTaskDescriptorScriptTest method testAllScriptsNotContainAPIBinding.

@Test
public void testAllScriptsNotContainAPIBinding() throws InvalidScriptException {
    Script s = scriptWithoutApiBinding();
    FlowScript fs = flowScriptWithoutApiBinding();
    Mockito.when(it.getPreScript()).thenReturn(s);
    Mockito.when(it.getPostScript()).thenReturn(s);
    Mockito.when(it.getCleaningScript()).thenReturn(s);
    Mockito.when(sec.getScript()).thenReturn(s);
    Mockito.when(fe.getEnvScript()).thenReturn(s);
    Mockito.when(it.getFlowScript()).thenReturn(fs);
    assertFalse(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd));
}
Also used : SimpleScript(org.ow2.proactive.scripting.SimpleScript) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Script(org.ow2.proactive.scripting.Script) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)38 SelectionScript (org.ow2.proactive.scripting.SelectionScript)32 File (java.io.File)31 SimpleScript (org.ow2.proactive.scripting.SimpleScript)28 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)25 ArrayList (java.util.ArrayList)16 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)15 Script (org.ow2.proactive.scripting.Script)15 ScriptResult (org.ow2.proactive.scripting.ScriptResult)15 FlowScript (org.ow2.proactive.scheduler.common.task.flow.FlowScript)13 HashMap (java.util.HashMap)12 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)11 IOException (java.io.IOException)10 JobId (org.ow2.proactive.scheduler.common.job.JobId)10 NodeSet (org.ow2.proactive.utils.NodeSet)10 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)9 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)9 Job (org.ow2.proactive.scheduler.common.job.Job)8 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)8 Serializable (java.io.Serializable)7