Search in sources :

Example 1 with JavaPrefixCommandExtractor

use of org.ow2.proactive.scheduler.task.executors.forked.env.command.JavaPrefixCommandExtractor in project scheduling by ow2-proactive.

the class ForkedJvmTaskExecutionCommandCreatorTest method replaceJavaPrefixCommandCreatorWithMock.

/**
 * Replaces the java prefix command creator service with a mock
 *
 * @param forkedJvmTaskExecutionCommandCreator Instance which will have the service replaced.
 * @throws IllegalAccessException
 * @throws NoSuchFieldException
 */
private void replaceJavaPrefixCommandCreatorWithMock(ForkedJvmTaskExecutionCommandCreator forkedJvmTaskExecutionCommandCreator) throws IllegalAccessException, NoSuchFieldException {
    JavaPrefixCommandExtractor javaPrefixCommandExtractor = mock(JavaPrefixCommandExtractor.class);
    given(javaPrefixCommandExtractor.extractJavaPrefixCommandToCommandListFromScriptResult(any(ScriptResult.class))).willReturn(Arrays.asList(testPreJaveCommandString));
    setPrivateField(ForkedJvmTaskExecutionCommandCreator.class.getDeclaredField("javaPrefixCommandExtractor"), forkedJvmTaskExecutionCommandCreator, javaPrefixCommandExtractor);
}
Also used : ScriptResult(org.ow2.proactive.scripting.ScriptResult) JavaPrefixCommandExtractor(org.ow2.proactive.scheduler.task.executors.forked.env.command.JavaPrefixCommandExtractor)

Aggregations

JavaPrefixCommandExtractor (org.ow2.proactive.scheduler.task.executors.forked.env.command.JavaPrefixCommandExtractor)1 ScriptResult (org.ow2.proactive.scripting.ScriptResult)1