SetupP2PStep { public void execute() throws EnvironmentModificationException, PeerException { SubnetUtils.SubnetInfo p2pSubnetInfo = new SubnetUtils( environment.getP2pSubnet(), P2PUtil.P2P_SUBNET_MASK ).getInfo(); final Set<String> p2pAddresses = Sets.newHashSet( p2pSubnetInfo.getAllAddresses() ); for ( RhP2pIp rhP2pIp : environment.getP2pIps().getP2pIps() ) { p2pAddresses.remove( rhP2pIp.getP2pIp() ); } Map<String, Set<String>> peerRhIds = topology.getPeerRhIds(); int totalIps = 0; P2pIps envP2pIps = environment.getP2pIps(); for ( Set<String> rhIds : peerRhIds.values() ) { for ( String rhId : rhIds ) { if ( envP2pIps.findByRhId( rhId ) == null ) { totalIps++; } } } if ( totalIps > p2pAddresses.size() ) { throw new EnvironmentModificationException( String.format( "Requested IP count %d is more than available %d", totalIps, p2pAddresses.size() ) ); } setupP2p( environment, peerRhIds, p2pAddresses ); setupTunnel( environment ); } SetupP2PStep( final Topology topology, final LocalEnvironment environment,
                         final TrackerOperation trackerOperation ); void execute();  }
@Test public void testExecute() throws Exception { step.execute(); verify( peerUtil, times( 2 ) ).executeParallel(); }