use of org.ow2.proactive.scheduler.task.context.NodeInfo in project scheduling by ow2-proactive.
the class ForkedTaskVariablesManagerTest method testExtractThirdPartyCredentialsThrowsExceptionIfTaskLauncherInitializerIsNull.
@Test(expected = Exception.class)
public void testExtractThirdPartyCredentialsThrowsExceptionIfTaskLauncherInitializerIsNull() throws Exception {
ScriptExecutableContainer scriptContainer = createScriptContainer();
TaskContext taskContext = new TaskContext(scriptContainer, null, null, new NodeDataSpacesURIs(null, null, null, null, null, null), null, new NodeInfo(null, null, null, null));
ForkedTaskVariablesManager forkedTaskVariablesManager = new ForkedTaskVariablesManager();
forkedTaskVariablesManager.extractThirdPartyCredentials(taskContext);
}
use of org.ow2.proactive.scheduler.task.context.NodeInfo in project scheduling by ow2-proactive.
the class ForkedTaskVariablesManagerTest method testAddBindingsToScriptHandlerContainsInputURI.
@Test
public void testAddBindingsToScriptHandlerContainsInputURI() throws InvalidScriptException, NodeException, NoSuchFieldException, IllegalAccessException {
ScriptExecutableContainer scriptContainer = createScriptContainer();
TaskLauncherInitializer taskLauncherInitializer = new TaskLauncherInitializer();
taskLauncherInitializer.setForkEnvironment(new ForkEnvironment());
TaskContext taskContext = new TaskContext(scriptContainer, taskLauncherInitializer, null, new NodeDataSpacesURIs(null, null, testSetString, null, null, null), null, new NodeInfo(null, null, null, null));
// Expect taskResultArray to be inside the map
validateThatScriptHandlerBindingsContain(new ScriptHandler(), taskContext, new VariablesMap(), new HashMap<>(), new HashMap<String, String>(), new HashMap<String, String>(), SchedulerConstants.DS_INPUT_BINDING_NAME, testSetString);
}
use of org.ow2.proactive.scheduler.task.context.NodeInfo in project scheduling by ow2-proactive.
the class ForkedTaskVariablesManagerTest method testAddBindingsToScriptHandlerContainsUserAndGlobalSpaceApiVariable.
@Test
public void testAddBindingsToScriptHandlerContainsUserAndGlobalSpaceApiVariable() throws InvalidScriptException, NodeException, NoSuchFieldException, IllegalAccessException, KeyException, NoSuchAlgorithmException {
ScriptExecutableContainer scriptContainer = createScriptContainer();
TaskLauncherInitializer taskLauncherInitializer = new TaskLauncherInitializer();
taskLauncherInitializer.setForkEnvironment(new ForkEnvironment());
taskLauncherInitializer.setSchedulerRestUrl("http://localhost:8080/rest");
taskLauncherInitializer.setTaskId(TaskIdImpl.createTaskId(new JobIdImpl(1L, "job"), "task", 0L));
Decrypter decrypter = createCredentials(testUser, testPass);
TaskContext taskContext = new TaskContext(scriptContainer, taskLauncherInitializer, null, new NodeDataSpacesURIs(null, null, null, null, null, null), null, new NodeInfo(null, null, null, null), decrypter);
// variable should belong to the expected class
validateThatScriptHandlerBindingsInstanceOf(new ScriptHandler(), taskContext, new VariablesMap(), new HashMap<>(), new HashMap<String, String>(), new HashMap<String, String>(), SchedulerConstants.DS_USER_API_BINDING_NAME, DataSpaceNodeClient.class);
// variable should belong to the expected class
validateThatScriptHandlerBindingsInstanceOf(new ScriptHandler(), taskContext, new VariablesMap(), new HashMap<>(), new HashMap<String, String>(), new HashMap<String, String>(), SchedulerConstants.DS_GLOBAL_API_BINDING_NAME, DataSpaceNodeClient.class);
}
use of org.ow2.proactive.scheduler.task.context.NodeInfo in project scheduling by ow2-proactive.
the class ForkedTaskVariablesManagerTest method createTaskContext.
private TaskContext createTaskContext(TaskResult[] previousTasksResults) throws InvalidScriptException, NodeException {
ScriptExecutableContainer scriptContainer = createScriptContainer();
TaskLauncherInitializer taskLauncherInitializer = new TaskLauncherInitializer();
taskLauncherInitializer.setForkEnvironment(new ForkEnvironment());
TaskContext taskContext = new TaskContext(scriptContainer, taskLauncherInitializer, previousTasksResults, new NodeDataSpacesURIs(null, null, null, null, null, null), "dummy", new NodeInfo(null, null, null, null));
return taskContext;
}
use of org.ow2.proactive.scheduler.task.context.NodeInfo in project scheduling by ow2-proactive.
the class ForkedTaskVariablesManagerTest method testAddBindingsToScriptHandlerContainsSchedulerNodeClientVariable.
@Test
public void testAddBindingsToScriptHandlerContainsSchedulerNodeClientVariable() throws InvalidScriptException, NodeException, NoSuchFieldException, IllegalAccessException, KeyException, NoSuchAlgorithmException {
ScriptExecutableContainer scriptContainer = createScriptContainer();
TaskLauncherInitializer taskLauncherInitializer = new TaskLauncherInitializer();
taskLauncherInitializer.setForkEnvironment(new ForkEnvironment());
taskLauncherInitializer.setSchedulerRestUrl("http://localhost:8080/rest");
taskLauncherInitializer.setTaskId(TaskIdImpl.createTaskId(new JobIdImpl(1L, "job"), "task", 0L));
Decrypter decrypter = createCredentials(testUser, testPass);
TaskContext taskContext = new TaskContext(scriptContainer, taskLauncherInitializer, null, new NodeDataSpacesURIs(null, null, null, null, null, null), null, new NodeInfo(null, null, null, null), decrypter);
// variable should belong to the expected class
validateThatScriptHandlerBindingsInstanceOf(new ScriptHandler(), taskContext, new VariablesMap(), new HashMap<>(), new HashMap<String, String>(), new HashMap<String, String>(), SchedulerConstants.SCHEDULER_CLIENT_BINDING_NAME, SchedulerNodeClient.class);
}
Aggregations