@Test public void testExecute_testException() throws Exception { ReloadConfigurationCommand cmd = new ReloadConfigurationCommand(); IReconfigurable r1 = Mockito.mock( IReconfigurable.class ); Mockito.doThrow( new RuntimeException( "for test" )).when( r1 ).reconfigure(); cmd.reconfigurables = Arrays.asList( r1 ); Assert.assertNull( cmd.execute()); Mockito.verify( r1, Mockito.only()).reconfigure(); }
@Override public Object execute() throws Exception { if( this.reconfigurables != null ) { for( IReconfigurable reconfigurable : this.reconfigurables ) { try { this.logger.fine( "Forcing reconfiguration from a Karaf command." ); reconfigurable.reconfigure(); } catch( Exception e ) { this.logger.warning( "An error occurred while reloading the configuration. " + e.getMessage()); Utils.logException( this.logger, e ); } } } return null; }
ReloadConfigurationCommand implements Action { @Override public Object execute() throws Exception { if( this.reconfigurables != null ) { for( IReconfigurable reconfigurable : this.reconfigurables ) { try { this.logger.fine( "Forcing reconfiguration from a Karaf command." ); reconfigurable.reconfigure(); } catch( Exception e ) { this.logger.warning( "An error occurred while reloading the configuration. " + e.getMessage()); Utils.logException( this.logger, e ); } } } return null; } }
ReloadConfigurationCommand implements Action { @Override public Object execute() throws Exception { if( this.reconfigurables != null ) { for( IReconfigurable reconfigurable : this.reconfigurables ) { try { this.logger.fine( "Forcing reconfiguration from a Karaf command." ); reconfigurable.reconfigure(); } catch( Exception e ) { this.logger.warning( "An error occurred while reloading the configuration. " + e.getMessage()); Utils.logException( this.logger, e ); } } } return null; }  }
ReloadConfigurationCommand implements Action { @Override public Object execute() throws Exception { if( this.reconfigurables != null ) { for( IReconfigurable reconfigurable : this.reconfigurables ) { try { this.logger.fine( "Forcing reconfiguration from a Karaf command." ); reconfigurable.reconfigure(); } catch( Exception e ) { this.logger.warning( "An error occurred while reloading the configuration. " + e.getMessage()); Utils.logException( this.logger, e ); } } } return null; }  @Override Object execute(); }
ReloadConfigurationCommand implements Action { @Override public Object execute() throws Exception { if( this.reconfigurables != null ) { for( IReconfigurable reconfigurable : this.reconfigurables ) { try { this.logger.fine( "Forcing reconfiguration from a Karaf command." ); reconfigurable.reconfigure(); } catch( Exception e ) { this.logger.warning( "An error occurred while reloading the configuration. " + e.getMessage()); Utils.logException( this.logger, e ); } } } return null; }  @Override Object execute();  }