Topology { public void addNodePlacement( String peerId, Node node ) { Preconditions.checkNotNull( peerId, "Invalid peer" ); Preconditions.checkNotNull( node, "Invalid node group" ); if ( StringUtils.isEmpty( node.getHostname() ) ) { node.setHostname( node.getName().replaceAll( "\\s+", "" ) ); } Set<Node> peerNodes = nodeGroupPlacement.get( peerId ); if ( peerNodes == null ) { peerNodes = Sets.newHashSet(); nodeGroupPlacement.put( peerId, peerNodes ); } peerNodes.add( node ); } Topology( @JsonProperty( "id" ) final UUID id, @JsonProperty( "name" ) final String environmentName,
                     @JsonProperty( "placement" ) final Map<String, Set<Node>> nodeGroupPlacement,
                     @JsonProperty( "sshKey" ) final String sshKey );  Topology( final UUID id, final String environmentName, final String sshKey );  Topology( final String environmentName ); UUID getId(); String getEnvironmentName(); void setEnvironmentName( String environmentName ); Map<String, Set<Node>> getNodeGroupPlacement(); Set<Node> getPeerNodes( String peerId ); Set<String> getAllPeers(); Map<String, Set<String>> getPeerRhIds(); void addNodePlacement( String peerId, Node node ); void addAllNodePlacement( final Collection<Node> nodes ); Set<Node> removePlacement( String peerId ); String getSshKey(); void setSshKey( final String sshKey ); void setId( final UUID id ); boolean exchangeSshKeys(); void setExchangeSshKeys( final boolean exchangeSshKeys ); boolean registerHosts(); void setRegisterHosts( final boolean registerHosts ); SshEncryptionType getSshKeyType(); void setSshKeyType( final SshEncryptionType sshKeyType ); @Override String toString();  }
@Test public void testAddNodeGroupPlacement() throws Exception { topology.addNodePlacement( peer, node ); }