ListCommand extends SubutaiShellCommandSupport { @Override protected Object doExecute() throws Exception { List<Peer> list = peerManager.getPeers(); System.out.println( "Found " + list.size() + " registered peer(s)" ); if ( !list.isEmpty() ) { System.out.println( "Status\tL/R\tID\tOwner ID\tIP\tPeer name\tPublic URL" ); for ( Peer peer : list ) { String peerStatus = "OFFLINE"; if ( peer.isOnline() ) { peerStatus = "ONLINE"; } try { PeerInfo info = peer.getPeerInfo(); System.out.println( String.format( "%s\t%s\t%s\t%s\t%s\t%s\t%s", peerStatus, peer.isLocal() ? "local" : "remote", peer.getId(), info.getOwnerId(), info.getIp(), info.getName(), info.getPublicUrl() ) ); } catch ( Exception e ) { log.error( e.getMessage(), e ); } } } return null; }  void setPeerManager( final PeerManager peerManager );  }
@Test public void testDoExecute() throws Exception { command.doExecute(); assertTrue( getSysOut().contains( PEER_ID ) ); }