@Test public void testFindExecutor_bulkCommand() { CommandsParser parser = new CommandsParser( this.app, "deploy and start all /tomcat-vm" ); Assert.assertEquals( 0, parser.getParsingErrors().size()); Assert.assertEquals( 1, parser.getInstructions().size()); AbstractCommandInstruction instr = parser.getInstructions().get( 0 ); Assert.assertEquals( BulkCommandInstructions.class, instr.getClass()); CommandsExecutor executor = new CommandsExecutor( this.manager, null, new File( "whatever" )); Assert.assertEquals( BulkCommandExecution.class, executor.findExecutor( instr ).getClass()); }
AbstractCommandExecution findExecutor( AbstractCommandInstruction instr ) { AbstractCommandExecution result = null; if( RenameCommandInstruction.class.equals( instr.getClass())) result = new RenameCommandExecution((RenameCommandInstruction) instr); else if( ReplicateCommandInstruction.class.equals( instr.getClass())) result = new ReplicateCommandExecution((ReplicateCommandInstruction) instr, this.manager ); else if( AssociateTargetCommandInstruction.class.equals( instr.getClass())) result = new AssociateTargetCommandExecution((AssociateTargetCommandInstruction) instr, this.manager ); else if( BulkCommandInstructions.class.equals( instr.getClass())) result = new BulkCommandExecution((BulkCommandInstructions) instr, this.manager ); else if( ChangeStateCommandInstruction.class.equals( instr.getClass())) result = new ChangeStateCommandExecution((ChangeStateCommandInstruction) instr, this.manager ); else if( CreateInstanceCommandInstruction.class.equals( instr.getClass())) result = new CreateInstanceCommandExecution((CreateInstanceCommandInstruction) instr, this.manager ); else if( EmailCommandInstruction.class.equals( instr.getClass())) result = new EmailCommandExecution((EmailCommandInstruction) instr, this.manager ); else if( WriteCommandInstruction.class.equals( instr.getClass())) result = new WriteCommandExecution((WriteCommandInstruction) instr); else if( AppendCommandInstruction.class.equals( instr.getClass())) result = new AppendCommandExecution((AppendCommandInstruction) instr); else if( ExecuteCommandInstruction.class.equals( instr.getClass())) result = new ExecuteCommandExecution((ExecuteCommandInstruction) instr, this.manager ); return result; }
CommandsExecutor { AbstractCommandExecution findExecutor( AbstractCommandInstruction instr ) { AbstractCommandExecution result = null; if( RenameCommandInstruction.class.equals( instr.getClass())) result = new RenameCommandExecution((RenameCommandInstruction) instr); else if( ReplicateCommandInstruction.class.equals( instr.getClass())) result = new ReplicateCommandExecution((ReplicateCommandInstruction) instr, this.manager ); else if( AssociateTargetCommandInstruction.class.equals( instr.getClass())) result = new AssociateTargetCommandExecution((AssociateTargetCommandInstruction) instr, this.manager ); else if( BulkCommandInstructions.class.equals( instr.getClass())) result = new BulkCommandExecution((BulkCommandInstructions) instr, this.manager ); else if( ChangeStateCommandInstruction.class.equals( instr.getClass())) result = new ChangeStateCommandExecution((ChangeStateCommandInstruction) instr, this.manager ); else if( CreateInstanceCommandInstruction.class.equals( instr.getClass())) result = new CreateInstanceCommandExecution((CreateInstanceCommandInstruction) instr, this.manager ); else if( EmailCommandInstruction.class.equals( instr.getClass())) result = new EmailCommandExecution((EmailCommandInstruction) instr, this.manager ); else if( WriteCommandInstruction.class.equals( instr.getClass())) result = new WriteCommandExecution((WriteCommandInstruction) instr); else if( AppendCommandInstruction.class.equals( instr.getClass())) result = new AppendCommandExecution((AppendCommandInstruction) instr); else if( ExecuteCommandInstruction.class.equals( instr.getClass())) result = new ExecuteCommandExecution((ExecuteCommandInstruction) instr, this.manager ); return result; } }
CommandsExecutor { AbstractCommandExecution findExecutor( AbstractCommandInstruction instr ) { AbstractCommandExecution result = null; if( RenameCommandInstruction.class.equals( instr.getClass())) result = new RenameCommandExecution((RenameCommandInstruction) instr); else if( ReplicateCommandInstruction.class.equals( instr.getClass())) result = new ReplicateCommandExecution((ReplicateCommandInstruction) instr, this.manager ); else if( AssociateTargetCommandInstruction.class.equals( instr.getClass())) result = new AssociateTargetCommandExecution((AssociateTargetCommandInstruction) instr, this.manager ); else if( BulkCommandInstructions.class.equals( instr.getClass())) result = new BulkCommandExecution((BulkCommandInstructions) instr, this.manager ); else if( ChangeStateCommandInstruction.class.equals( instr.getClass())) result = new ChangeStateCommandExecution((ChangeStateCommandInstruction) instr, this.manager ); else if( CreateInstanceCommandInstruction.class.equals( instr.getClass())) result = new CreateInstanceCommandExecution((CreateInstanceCommandInstruction) instr, this.manager ); else if( EmailCommandInstruction.class.equals( instr.getClass())) result = new EmailCommandExecution((EmailCommandInstruction) instr, this.manager ); else if( WriteCommandInstruction.class.equals( instr.getClass())) result = new WriteCommandExecution((WriteCommandInstruction) instr); else if( AppendCommandInstruction.class.equals( instr.getClass())) result = new AppendCommandExecution((AppendCommandInstruction) instr); else if( ExecuteCommandInstruction.class.equals( instr.getClass())) result = new ExecuteCommandExecution((ExecuteCommandInstruction) instr, this.manager ); return result; } CommandsExecutor( Manager manager, Application app, File commandsFile );  CommandsExecutor(
			Manager manager,
			Application app,
			File commandsFile,
			CommandExecutionContext executionContext ); }
CommandsExecutor { AbstractCommandExecution findExecutor( AbstractCommandInstruction instr ) { AbstractCommandExecution result = null; if( RenameCommandInstruction.class.equals( instr.getClass())) result = new RenameCommandExecution((RenameCommandInstruction) instr); else if( ReplicateCommandInstruction.class.equals( instr.getClass())) result = new ReplicateCommandExecution((ReplicateCommandInstruction) instr, this.manager ); else if( AssociateTargetCommandInstruction.class.equals( instr.getClass())) result = new AssociateTargetCommandExecution((AssociateTargetCommandInstruction) instr, this.manager ); else if( BulkCommandInstructions.class.equals( instr.getClass())) result = new BulkCommandExecution((BulkCommandInstructions) instr, this.manager ); else if( ChangeStateCommandInstruction.class.equals( instr.getClass())) result = new ChangeStateCommandExecution((ChangeStateCommandInstruction) instr, this.manager ); else if( CreateInstanceCommandInstruction.class.equals( instr.getClass())) result = new CreateInstanceCommandExecution((CreateInstanceCommandInstruction) instr, this.manager ); else if( EmailCommandInstruction.class.equals( instr.getClass())) result = new EmailCommandExecution((EmailCommandInstruction) instr, this.manager ); else if( WriteCommandInstruction.class.equals( instr.getClass())) result = new WriteCommandExecution((WriteCommandInstruction) instr); else if( AppendCommandInstruction.class.equals( instr.getClass())) result = new AppendCommandExecution((AppendCommandInstruction) instr); else if( ExecuteCommandInstruction.class.equals( instr.getClass())) result = new ExecuteCommandExecution((ExecuteCommandInstruction) instr, this.manager ); return result; } CommandsExecutor( Manager manager, Application app, File commandsFile );  CommandsExecutor(
			Manager manager,
			Application app,
			File commandsFile,
			CommandExecutionContext executionContext ); void execute(); boolean wereInstructionSkipped(); }
CommandsExecutor { AbstractCommandExecution findExecutor( AbstractCommandInstruction instr ) { AbstractCommandExecution result = null; if( RenameCommandInstruction.class.equals( instr.getClass())) result = new RenameCommandExecution((RenameCommandInstruction) instr); else if( ReplicateCommandInstruction.class.equals( instr.getClass())) result = new ReplicateCommandExecution((ReplicateCommandInstruction) instr, this.manager ); else if( AssociateTargetCommandInstruction.class.equals( instr.getClass())) result = new AssociateTargetCommandExecution((AssociateTargetCommandInstruction) instr, this.manager ); else if( BulkCommandInstructions.class.equals( instr.getClass())) result = new BulkCommandExecution((BulkCommandInstructions) instr, this.manager ); else if( ChangeStateCommandInstruction.class.equals( instr.getClass())) result = new ChangeStateCommandExecution((ChangeStateCommandInstruction) instr, this.manager ); else if( CreateInstanceCommandInstruction.class.equals( instr.getClass())) result = new CreateInstanceCommandExecution((CreateInstanceCommandInstruction) instr, this.manager ); else if( EmailCommandInstruction.class.equals( instr.getClass())) result = new EmailCommandExecution((EmailCommandInstruction) instr, this.manager ); else if( WriteCommandInstruction.class.equals( instr.getClass())) result = new WriteCommandExecution((WriteCommandInstruction) instr); else if( AppendCommandInstruction.class.equals( instr.getClass())) result = new AppendCommandExecution((AppendCommandInstruction) instr); else if( ExecuteCommandInstruction.class.equals( instr.getClass())) result = new ExecuteCommandExecution((ExecuteCommandInstruction) instr, this.manager ); return result; } CommandsExecutor( Manager manager, Application app, File commandsFile );  CommandsExecutor(
			Manager manager,
			Application app,
			File commandsFile,
			CommandExecutionContext executionContext ); void execute(); boolean wereInstructionSkipped();  }