CreatePeerEnvironmentContainersTask implements Callable<CreateEnvironmentContainersResponse> { @Override public CreateEnvironmentContainersResponse call() throws Exception { String maskLength = environment.getSubnetCidr().split( "/" )[1]; final CreateEnvironmentContainersRequest request = new CreateEnvironmentContainersRequest( environment.getId(), localPeer.getId(), localPeer.getOwnerId() ); Iterator<String> ipAddressIterator = ipAddresses.iterator(); for ( Node node : nodes ) { LOG.debug( String.format( "Scheduling on %s %s", node.getPeerId(), node.getName() ) ); final String ip = ipAddressIterator.next(); CloneRequest cloneRequest = new CloneRequest( node.getHostId(), node.getHostname(), node.getName(), ip + "/" + maskLength, node.getTemplateId(), HostArchitecture.AMD64, node.getQuota() ); request.addRequest( cloneRequest ); } CreateEnvironmentContainersResponse response = peer.createEnvironmentContainers( request ); for ( String message : response.getMessages() ) { trackerOperation.addLog( message ); } return response; } CreatePeerEnvironmentContainersTask( final IdentityManager identityManager, final Peer peer,
                                                final LocalPeer localPeer, final Environment environment,
                                                final List<String> ipAddresses, final Set<Node> nodes,
                                                final TrackerOperation trackerOperation ); @Override CreateEnvironmentContainersResponse call();  }
@Test public void testCall() throws Exception { CreateEnvironmentContainersResponse resp = task.call(); assertEquals( response, resp ); }