@Test public void simple() throws Exception { String cmd = command("mock.cmd"); TaskExecutor executor = new BasicCommandTaskExecutor(c -> (command, arguments) -> { assertThat(command.getFileName().toString(), is(cmd)); assertThat(arguments, contains( "Hello, world!", context.getBatchId(), context.getFlowId(), context.getExecutionId(), "testing=OK")); return 0; }); executor.execute(context, new BasicCommandTaskInfo("mock", "testing", cmd, Arrays.asList( CommandToken.of("Hello, world!"), CommandToken.BATCH_ID, CommandToken.FLOW_ID, CommandToken.EXECUTION_ID, CommandToken.BATCH_ARGUMENTS))); }
@Override public void execute(TaskExecutionContext context, TaskInfo task) throws InterruptedException, IOException { CommandTaskInfo mirror = (CommandTaskInfo) task; CommandLauncher launcher = launchers.apply(context); Path command = TaskExecutors.findFrameworkFile(context, mirror.getCommand()).get(); List<String> arguments = TaskExecutors.resolveCommandTokens( context, mirror.getArguments(context.getConfigurations())); execute(context, launcher, command, arguments); }
BasicCommandTaskExecutor implements TaskExecutor { @Override public void execute(TaskExecutionContext context, TaskInfo task) throws InterruptedException, IOException { CommandTaskInfo mirror = (CommandTaskInfo) task; CommandLauncher launcher = launchers.apply(context); Path command = TaskExecutors.findFrameworkFile(context, mirror.getCommand()).get(); List<String> arguments = TaskExecutors.resolveCommandTokens( context, mirror.getArguments(context.getConfigurations())); execute(context, launcher, command, arguments); } }
BasicCommandTaskExecutor implements TaskExecutor { @Override public void execute(TaskExecutionContext context, TaskInfo task) throws InterruptedException, IOException { CommandTaskInfo mirror = (CommandTaskInfo) task; CommandLauncher launcher = launchers.apply(context); Path command = TaskExecutors.findFrameworkFile(context, mirror.getCommand()).get(); List<String> arguments = TaskExecutors.resolveCommandTokens( context, mirror.getArguments(context.getConfigurations())); execute(context, launcher, command, arguments); } BasicCommandTaskExecutor();  BasicCommandTaskExecutor(Function<? super TaskExecutionContext, ? extends CommandLauncher> launchers); }
BasicCommandTaskExecutor implements TaskExecutor { @Override public void execute(TaskExecutionContext context, TaskInfo task) throws InterruptedException, IOException { CommandTaskInfo mirror = (CommandTaskInfo) task; CommandLauncher launcher = launchers.apply(context); Path command = TaskExecutors.findFrameworkFile(context, mirror.getCommand()).get(); List<String> arguments = TaskExecutors.resolveCommandTokens( context, mirror.getArguments(context.getConfigurations())); execute(context, launcher, command, arguments); } BasicCommandTaskExecutor();  BasicCommandTaskExecutor(Function<? super TaskExecutionContext, ? extends CommandLauncher> launchers); @Override boolean isSupported(TaskExecutionContext context, TaskInfo task); @Override void execute(TaskExecutionContext context, TaskInfo task); static CommandLauncher getCommandLauncher(ExecutionContext context); static CommandLauncher getCommandLauncher(
            ExecutionContext context,
            BasicCommandLauncher.OutputConsumer output); static void execute(
            TaskExecutionContext context,
            Path command, List<String> arguments); static void execute(
            TaskExecutionContext context, CommandLauncher launcher,
            Path command, List<String> arguments); }
BasicCommandTaskExecutor implements TaskExecutor { @Override public void execute(TaskExecutionContext context, TaskInfo task) throws InterruptedException, IOException { CommandTaskInfo mirror = (CommandTaskInfo) task; CommandLauncher launcher = launchers.apply(context); Path command = TaskExecutors.findFrameworkFile(context, mirror.getCommand()).get(); List<String> arguments = TaskExecutors.resolveCommandTokens( context, mirror.getArguments(context.getConfigurations())); execute(context, launcher, command, arguments); } BasicCommandTaskExecutor();  BasicCommandTaskExecutor(Function<? super TaskExecutionContext, ? extends CommandLauncher> launchers); @Override boolean isSupported(TaskExecutionContext context, TaskInfo task); @Override void execute(TaskExecutionContext context, TaskInfo task); static CommandLauncher getCommandLauncher(ExecutionContext context); static CommandLauncher getCommandLauncher(
            ExecutionContext context,
            BasicCommandLauncher.OutputConsumer output); static void execute(
            TaskExecutionContext context,
            Path command, List<String> arguments); static void execute(
            TaskExecutionContext context, CommandLauncher launcher,
            Path command, List<String> arguments); static final boolean WINDOWS; }