use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.
the class SelectionScriptEvaluator method evaluateScript.
private static void evaluateScript(String selectionScript) {
try {
final ScriptHandler localHandler = ScriptLoader.createLocalHandler();
final ScriptResult<Boolean> result = localHandler.handle(new SelectionScript(new File(selectionScript), null));
if (result.errorOccured()) {
result.getException().printStackTrace(System.err);
System.exit(3);
}
} catch (InvalidScriptException e) {
System.exit(2);
}
}
use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.
the class TaskContextTest method createTaskContext.
private TaskContext createTaskContext() throws NodeException, InvalidScriptException {
TaskLauncherInitializer taskLauncherInitializer = new TaskLauncherInitializer();
taskLauncherInitializer.setTaskId(TaskIdImpl.createTaskId(new JobIdImpl(1L, "testSerializeContextToFile"), "testSerializeContextToFile", 1L));
// Invoke method to test it
return new TaskContext(new ScriptExecutableContainer(new TaskScript(new ForkEnvironmentScript(new SimpleScript("", "python")))), taskLauncherInitializer, null, new NodeDataSpacesURIs(null, null, null, null, null, null), null, new NodeInfo(null, null, null, null));
}
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 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));
}
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));
}
Aggregations