use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.
the class TestUnauthorizedScripts method createJobSelection.
public Job createJobSelection(String selectionScriptContent) throws InvalidScriptException, UserException {
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName() + "_selection");
ScriptTask taskWithSelection = new ScriptTask();
taskWithSelection.setScript(new TaskScript(new SimpleScript("println 'Hello'", "groovy")));
taskWithSelection.addSelectionScript(new SelectionScript(new SimpleScript(selectionScriptContent, "groovy"), true));
job.addTask(taskWithSelection);
return job;
}
use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.
the class CheckEligibleTaskDescriptorScriptTest method testOnlyInternalScriptContainsAPIBinding.
@Test
public void testOnlyInternalScriptContainsAPIBinding() throws InvalidScriptException {
Script s = scriptWithApiBindingGlobal();
Script s2 = scriptWithoutApiBinding();
FlowScript fs = flowScriptWithoutApiBinding();
Mockito.when(((EligibleTaskDescriptorImpl) etd).getInternal()).thenReturn(ist);
Mockito.when(ist.getPreScript()).thenReturn(s2);
Mockito.when(ist.getPostScript()).thenReturn(s2);
Mockito.when(it.getCleaningScript()).thenReturn(s2);
Mockito.when(sec.getScript()).thenReturn(s);
Mockito.when(fe.getEnvScript()).thenReturn(s2);
Mockito.when(it.getFlowScript()).thenReturn(fs);
assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd));
}
use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.
the class CheckEligibleTaskDescriptorScriptTest method testOnlyEnvScriptContainsAPIBinding.
@Test
public void testOnlyEnvScriptContainsAPIBinding() throws InvalidScriptException {
Script s = scriptWithApiBindingUser();
FlowScript fs = flowScriptWithoutApiBinding();
Script s2 = scriptWithoutApiBinding();
Mockito.when(it.getPreScript()).thenReturn(s2);
Mockito.when(it.getPostScript()).thenReturn(s2);
Mockito.when(it.getCleaningScript()).thenReturn(s2);
Mockito.when(sec.getScript()).thenReturn(s2);
Mockito.when(fe.getEnvScript()).thenReturn(s);
Mockito.when(it.getFlowScript()).thenReturn(fs);
assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd));
}
use of org.ow2.proactive.scripting.InvalidScriptException 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));
}
use of org.ow2.proactive.scripting.InvalidScriptException 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));
}
Aggregations