@Test public void testExecution_append_instructionWasDisabled() throws Exception { File commandFile = this.folder.newFile(); File targetFile = this.folder.newFile(); Utils.deleteFilesRecursively( targetFile ); Utils.writeStringInto( "define FIRST_VM = vm $(EXISTING_INDEX MIN > 4)\n", commandFile ); Utils.appendStringInto( "append $(FIRST_VM) into " + targetFile.getAbsolutePath(), commandFile ); CommandsExecutor executor = new CommandsExecutor( this.manager, this.app, commandFile ); Assert.assertFalse( targetFile.exists()); executor.execute(); Assert.assertFalse( targetFile.exists()); }
public void execute() throws CommandException { try { CommandsParser parser = new CommandsParser( this.app, this.commandsFile ); if( RoboconfErrorHelpers.containsCriticalErrors( parser.getParsingErrors())) throw new CommandException( "Invalid command file. " + this.commandsFile.getName() + " contains errors." ); for( AbstractCommandInstruction instr : parser.getInstructions()) { if( instr.isDisabled()) { this.logger.fine( "Skipping disabled instruction: " + instr.getClass().getSimpleName()); this.instructionSkipped = true; continue; } AbstractCommandExecution executor = findExecutor( instr ); if( executor == null ) { this.logger.fine( "Skipping non-executable instruction: " + instr.getClass().getSimpleName()); continue; } executor.setExecutionContext( this.executionContext ); executor.execute(); } } catch( CommandException e ) { throw e; } catch( Exception e ) { throw new CommandException( e ); } }
CommandsExecutor { public void execute() throws CommandException { try { CommandsParser parser = new CommandsParser( this.app, this.commandsFile ); if( RoboconfErrorHelpers.containsCriticalErrors( parser.getParsingErrors())) throw new CommandException( "Invalid command file. " + this.commandsFile.getName() + " contains errors." ); for( AbstractCommandInstruction instr : parser.getInstructions()) { if( instr.isDisabled()) { this.logger.fine( "Skipping disabled instruction: " + instr.getClass().getSimpleName()); this.instructionSkipped = true; continue; } AbstractCommandExecution executor = findExecutor( instr ); if( executor == null ) { this.logger.fine( "Skipping non-executable instruction: " + instr.getClass().getSimpleName()); continue; } executor.setExecutionContext( this.executionContext ); executor.execute(); } } catch( CommandException e ) { throw e; } catch( Exception e ) { throw new CommandException( e ); } } }
CommandsExecutor { public void execute() throws CommandException { try { CommandsParser parser = new CommandsParser( this.app, this.commandsFile ); if( RoboconfErrorHelpers.containsCriticalErrors( parser.getParsingErrors())) throw new CommandException( "Invalid command file. " + this.commandsFile.getName() + " contains errors." ); for( AbstractCommandInstruction instr : parser.getInstructions()) { if( instr.isDisabled()) { this.logger.fine( "Skipping disabled instruction: " + instr.getClass().getSimpleName()); this.instructionSkipped = true; continue; } AbstractCommandExecution executor = findExecutor( instr ); if( executor == null ) { this.logger.fine( "Skipping non-executable instruction: " + instr.getClass().getSimpleName()); continue; } executor.setExecutionContext( this.executionContext ); executor.execute(); } } catch( CommandException e ) { throw e; } catch( Exception e ) { throw new CommandException( e ); } } CommandsExecutor( Manager manager, Application app, File commandsFile );  CommandsExecutor(
			Manager manager,
			Application app,
			File commandsFile,
			CommandExecutionContext executionContext ); }
CommandsExecutor { public void execute() throws CommandException { try { CommandsParser parser = new CommandsParser( this.app, this.commandsFile ); if( RoboconfErrorHelpers.containsCriticalErrors( parser.getParsingErrors())) throw new CommandException( "Invalid command file. " + this.commandsFile.getName() + " contains errors." ); for( AbstractCommandInstruction instr : parser.getInstructions()) { if( instr.isDisabled()) { this.logger.fine( "Skipping disabled instruction: " + instr.getClass().getSimpleName()); this.instructionSkipped = true; continue; } AbstractCommandExecution executor = findExecutor( instr ); if( executor == null ) { this.logger.fine( "Skipping non-executable instruction: " + instr.getClass().getSimpleName()); continue; } executor.setExecutionContext( this.executionContext ); executor.execute(); } } catch( CommandException e ) { throw e; } catch( Exception e ) { throw new CommandException( e ); } } CommandsExecutor( Manager manager, Application app, File commandsFile );  CommandsExecutor(
			Manager manager,
			Application app,
			File commandsFile,
			CommandExecutionContext executionContext ); void execute(); boolean wereInstructionSkipped(); }
CommandsExecutor { public void execute() throws CommandException { try { CommandsParser parser = new CommandsParser( this.app, this.commandsFile ); if( RoboconfErrorHelpers.containsCriticalErrors( parser.getParsingErrors())) throw new CommandException( "Invalid command file. " + this.commandsFile.getName() + " contains errors." ); for( AbstractCommandInstruction instr : parser.getInstructions()) { if( instr.isDisabled()) { this.logger.fine( "Skipping disabled instruction: " + instr.getClass().getSimpleName()); this.instructionSkipped = true; continue; } AbstractCommandExecution executor = findExecutor( instr ); if( executor == null ) { this.logger.fine( "Skipping non-executable instruction: " + instr.getClass().getSimpleName()); continue; } executor.setExecutionContext( this.executionContext ); executor.execute(); } } catch( CommandException e ) { throw e; } catch( Exception e ) { throw new CommandException( e ); } } CommandsExecutor( Manager manager, Application app, File commandsFile );  CommandsExecutor(
			Manager manager,
			Application app,
			File commandsFile,
			CommandExecutionContext executionContext ); void execute(); boolean wereInstructionSkipped();  }