@Test public void testNoRoboconf_shouldNotHappen() throws Exception { Mockito.when( this.ctx.getBundles()).thenReturn( new Bundle[ 0 ]); this.cmd.execute(); String outputText = filterOutput( this.os.toString( "UTF-8" )); Assert.assertEquals( "Roboconf\n Roboconf version Undetermined", outputText ); Mockito.verify( this.session, Mockito.only()).execute( RoboconfInfoCommand.KARAF_INFO ); Mockito.verify( this.ctx, Mockito.only()).getBundles(); }
@Override public Object execute() throws Exception { List<String> versions = new ArrayList<> (); for( Bundle bundle : this.ctx.getBundles()) { if( Constants.RBCF_CORE_SYMBOLIC_NAME.equals( bundle.getSymbolicName())) versions.add( bundle.getVersion().toString()); } this.out.println(); this.out.println( "Roboconf" ); if( versions.size() > 1 ) { this.out.println( "\n[ WARNING ] Several versions of Roboconf run in the server." ); this.out.println( "[ WARNING ] Please, run bundle:list | grep roboconf-core for more details." ); this.out.println(); printValue( "Roboconf versions", versions.get( 0 )); for( int i=1; i<versions.size(); i++ ) printValue( "", versions.get( i )); } else if( versions.size() == 1 ) { printValue( "Roboconf version", versions.get( 0 )); } else { printValue( "Roboconf version", "Undetermined" ); } this.out.println(); this.session.execute( KARAF_INFO ); this.out.println(); return null; }
RoboconfInfoCommand implements Action { @Override public Object execute() throws Exception { List<String> versions = new ArrayList<> (); for( Bundle bundle : this.ctx.getBundles()) { if( Constants.RBCF_CORE_SYMBOLIC_NAME.equals( bundle.getSymbolicName())) versions.add( bundle.getVersion().toString()); } this.out.println(); this.out.println( "Roboconf" ); if( versions.size() > 1 ) { this.out.println( "\n[ WARNING ] Several versions of Roboconf run in the server." ); this.out.println( "[ WARNING ] Please, run bundle:list | grep roboconf-core for more details." ); this.out.println(); printValue( "Roboconf versions", versions.get( 0 )); for( int i=1; i<versions.size(); i++ ) printValue( "", versions.get( i )); } else if( versions.size() == 1 ) { printValue( "Roboconf version", versions.get( 0 )); } else { printValue( "Roboconf version", "Undetermined" ); } this.out.println(); this.session.execute( KARAF_INFO ); this.out.println(); return null; } }
RoboconfInfoCommand implements Action { @Override public Object execute() throws Exception { List<String> versions = new ArrayList<> (); for( Bundle bundle : this.ctx.getBundles()) { if( Constants.RBCF_CORE_SYMBOLIC_NAME.equals( bundle.getSymbolicName())) versions.add( bundle.getVersion().toString()); } this.out.println(); this.out.println( "Roboconf" ); if( versions.size() > 1 ) { this.out.println( "\n[ WARNING ] Several versions of Roboconf run in the server." ); this.out.println( "[ WARNING ] Please, run bundle:list | grep roboconf-core for more details." ); this.out.println(); printValue( "Roboconf versions", versions.get( 0 )); for( int i=1; i<versions.size(); i++ ) printValue( "", versions.get( i )); } else if( versions.size() == 1 ) { printValue( "Roboconf version", versions.get( 0 )); } else { printValue( "Roboconf version", "Undetermined" ); } this.out.println(); this.session.execute( KARAF_INFO ); this.out.println(); return null; }  }
RoboconfInfoCommand implements Action { @Override public Object execute() throws Exception { List<String> versions = new ArrayList<> (); for( Bundle bundle : this.ctx.getBundles()) { if( Constants.RBCF_CORE_SYMBOLIC_NAME.equals( bundle.getSymbolicName())) versions.add( bundle.getVersion().toString()); } this.out.println(); this.out.println( "Roboconf" ); if( versions.size() > 1 ) { this.out.println( "\n[ WARNING ] Several versions of Roboconf run in the server." ); this.out.println( "[ WARNING ] Please, run bundle:list | grep roboconf-core for more details." ); this.out.println(); printValue( "Roboconf versions", versions.get( 0 )); for( int i=1; i<versions.size(); i++ ) printValue( "", versions.get( i )); } else if( versions.size() == 1 ) { printValue( "Roboconf version", versions.get( 0 )); } else { printValue( "Roboconf version", "Undetermined" ); } this.out.println(); this.session.execute( KARAF_INFO ); this.out.println(); return null; }  @Override Object execute(); }
RoboconfInfoCommand implements Action { @Override public Object execute() throws Exception { List<String> versions = new ArrayList<> (); for( Bundle bundle : this.ctx.getBundles()) { if( Constants.RBCF_CORE_SYMBOLIC_NAME.equals( bundle.getSymbolicName())) versions.add( bundle.getVersion().toString()); } this.out.println(); this.out.println( "Roboconf" ); if( versions.size() > 1 ) { this.out.println( "\n[ WARNING ] Several versions of Roboconf run in the server." ); this.out.println( "[ WARNING ] Please, run bundle:list | grep roboconf-core for more details." ); this.out.println(); printValue( "Roboconf versions", versions.get( 0 )); for( int i=1; i<versions.size(); i++ ) printValue( "", versions.get( i )); } else if( versions.size() == 1 ) { printValue( "Roboconf version", versions.get( 0 )); } else { printValue( "Roboconf version", "Undetermined" ); } this.out.println(); this.session.execute( KARAF_INFO ); this.out.println(); return null; }  @Override Object execute();  }