ListHostsCommand extends SubutaiShellCommandSupport { @Override protected Object doExecute() throws Exception { Set<ResourceHostInfo> resourceHostsInfo = hostRegistry.getResourceHostsInfo(); System.out.println( "Connected hosts:" ); for ( ResourceHostInfo resourceHostInfo : resourceHostsInfo ) { System.out.println( String.format( "%s\t%s", resourceHostInfo.getHostname(), abbreviate ? StringUtils.abbreviate( resourceHostInfo.getId(), 7 ) : resourceHostInfo.getId() ) ); System.out.println( String.format( "\tIp address: %s", resourceHostInfo.getAddress() ) ); System.out.println( "\tContainers:" ); Set<ContainerHostInfo> containerHostInfos = resourceHostInfo.getContainers(); for ( ContainerHostInfo containerHostInfo : containerHostInfos ) { String hostname = containerHostInfo.getHostname().equalsIgnoreCase( containerHostInfo.getContainerName() ) ? containerHostInfo.getHostname() : containerHostInfo.getHostname() + " [ " + containerHostInfo.getContainerName() + " ]"; System.out.println( String.format( "\t\t%s\t%s\t%s\t%s\t%s", hostname, abbreviate ? StringUtils.abbreviate( containerHostInfo.getId(), 7 ) : containerHostInfo.getId(), containerHostInfo.getHostInterfaces().findByName( Common.DEFAULT_CONTAINER_INTERFACE ).getIp(), containerHostInfo.getState(), containerHostInfo.getVlan() ) ); } System.out.println( "-------" ); } return null; } ListHostsCommand( final HostRegistry hostRegistry );   }
@Test public void testDoExecute() throws Exception { command.doExecute(); verify( containerHostInfo ).getState(); }