Search in sources :

Example 6 with FlowScript

use of org.ow2.proactive.scheduler.common.task.flow.FlowScript in project scheduling by ow2-proactive.

the class CheckEligibleTaskDescriptorScriptTest method testAllScriptsNull.

@Test
public void testAllScriptsNull() throws InvalidScriptException {
    Script s = null;
    FlowScript fs = null;
    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);
    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)

Example 7 with FlowScript

use of org.ow2.proactive.scheduler.common.task.flow.FlowScript in project scheduling by ow2-proactive.

the class CheckEligibleTaskDescriptorScriptTest method testOnlyPostScriptContainsAPIBinding.

@Test
public void testOnlyPostScriptContainsAPIBinding() throws InvalidScriptException {
    Script s = scriptWithApiBindingClient();
    Script s2 = scriptWithoutApiBinding();
    FlowScript fs = flowScriptWithoutApiBinding();
    Mockito.when(it.getPreScript()).thenReturn(s2);
    Mockito.when(it.getPostScript()).thenReturn(s);
    Mockito.when(it.getCleaningScript()).thenReturn(s2);
    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 8 with FlowScript

use of org.ow2.proactive.scheduler.common.task.flow.FlowScript in project scheduling by ow2-proactive.

the class CheckEligibleTaskDescriptorScriptTest method testOnlyPreScriptContainsAPIBinding.

@Test
public void testOnlyPreScriptContainsAPIBinding() throws InvalidScriptException {
    Script s = scriptWithApiBindingUser();
    Script s2 = scriptWithoutApiBinding();
    FlowScript fs = flowScriptWithoutApiBinding();
    Mockito.when(it.getPreScript()).thenReturn(s);
    Mockito.when(it.getPostScript()).thenReturn(s2);
    Mockito.when(it.getCleaningScript()).thenReturn(s2);
    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 9 with FlowScript

use of org.ow2.proactive.scheduler.common.task.flow.FlowScript in project scheduling by ow2-proactive.

the class TagTest method createReplicateTask.

private InternalScriptTask createReplicateTask(String name, InternalTask[] dependences, FlowBlock block, String matchingBlock, int nbRuns) throws InvalidScriptException {
    InternalScriptTask result = createTask(name, dependences, block, matchingBlock);
    FlowScript replicate = FlowScript.createReplicateFlowScript("runs = " + nbRuns + ";");
    result.setFlowScript(replicate);
    return result;
}
Also used : InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript)

Example 10 with FlowScript

use of org.ow2.proactive.scheduler.common.task.flow.FlowScript in project scheduling by ow2-proactive.

the class TagTest method execute.

private void execute(InternalTask task) {
    task.setExecuterInformation(executerInformationMock);
    job.startTask(task);
    FlowScript script = task.getFlowScript();
    FlowAction action = null;
    if (script != null) {
        action = task.getFlowScript().execute().getResult();
    }
    job.terminateTask(false, task.getId(), schedulerStateUpdateMock, action, resultMock);
    System.out.println("executed " + task.getName() + " -> " + getTaskNameList(true));
}
Also used : FlowAction(org.ow2.proactive.scheduler.common.task.flow.FlowAction) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript)

Aggregations

FlowScript (org.ow2.proactive.scheduler.common.task.flow.FlowScript)18 SimpleScript (org.ow2.proactive.scripting.SimpleScript)11 Test (org.junit.Test)9 Script (org.ow2.proactive.scripting.Script)9 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)4 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)4 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)2 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)2 EmptyExecutable (functionaltests.executables.EmptyExecutable)1 InvalidPatternException (it.sauronsoftware.cron4j.InvalidPatternException)1 Predictor (it.sauronsoftware.cron4j.Predictor)1 FileNotFoundException (java.io.FileNotFoundException)1 Date (java.util.Date)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 VerifierConfigurationException (org.iso_relax.verifier.VerifierConfigurationException)1 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)1 JobValidationException (org.ow2.proactive.scheduler.common.exception.JobValidationException)1 JobId (org.ow2.proactive.scheduler.common.job.JobId)1 JobResult (org.ow2.proactive.scheduler.common.job.JobResult)1 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)1