CommandsMngrImpl implements ICommandsMngr { @Override public void execute( Application app, String commandName, int origin, String originDetails ) throws CommandException, NoSuchFileException { execute( app, commandName, null, origin, originDetails ); } CommandsMngrImpl( Manager manager ); @Override void createOrUpdateCommand( Application app, String commandName, String commandText ); @Override void deleteCommand( Application app, String commandName ); @Override List<String> listCommands( Application app ); @Override String getCommandInstructions( Application app, String commandName ); @Override List<ParsingError> validate( Application app, String commandText ); @Override int getHistoryNumberOfPages( int itemsPerPage, String applicationName ); @Override List<CommandHistoryItem> getHistory(
			int start,
			int maxEntry,
			String sortCriteria,
			String sortingOrder,
			String applicationName ); @Override void execute( Application app, String commandName, int origin, String originDetails ); @Override void execute(
			Application app,
			String commandName,
			CommandExecutionContext executionContext,
			int origin,
			String originDetails );  }
@Test public void testExecute() throws Exception { String line = "rename /tomcat-vm as tomcat-vm-copy"; Assert.assertEquals( 0, this.cmdMngr.validate( this.app, line ).size()); String cmdName = "my-command"; this.cmdMngr.createOrUpdateCommand( this.app, cmdName, line ); Assert.assertNotNull( InstanceHelpers.findInstanceByPath( this.app, "/tomcat-vm" )); Assert.assertNull( InstanceHelpers.findInstanceByPath( this.app, "/tomcat-vm-copy" )); this.cmdMngr.execute( this.app, cmdName, CommandHistoryItem.ORIGIN_REST_API, "some source" ); Assert.assertNull( InstanceHelpers.findInstanceByPath( this.app, "/tomcat-vm" )); Assert.assertNotNull( InstanceHelpers.findInstanceByPath( this.app, "/tomcat-vm-copy" )); }
@Test( expected = NoSuchFileException.class ) public void testExecute_noSuchCommand() throws Exception { this.cmdMngr.execute( this.app, "my-command", CommandHistoryItem.ORIGIN_REST_API, "some source" ); }