createClusteredServer(
final String serverName,
final String nodeAgentName,
final int basePort )
{
final DomainConfig domainConfig = getDomainConfig();
if ( domainConfig.getClusteredServerConfigMap().get( serverName ) != null )
{
domainConfig.removeClusteredServerConfig( serverName );
}
else if ( domainConfig.getStandaloneServerConfigMap().get( serverName ) != null )
{
domainConfig.removeStandaloneServerConfig( serverName );
}
final ClusterConfig clusterConfig =
ClusterConfigTest.ensureDefaultInstance( domainConfig );
if ( domainConfig.getClusteredServerConfigMap().get( serverName ) != null )
{
domainConfig.removeClusteredServerConfig( serverName );
assert domainConfig.getClusteredServerConfigMap().get( serverName ) == null;
}
final ConfigSetup setup = new ConfigSetup( getDomainRoot() );
final Map<String,String> options = new HashMap<String,String>();
setup.setupServerPorts( options, basePort );
final ClusteredServerConfig csc =
domainConfig.createClusteredServerConfig( serverName,
clusterConfig.getName(),
nodeAgentName,
options );
sanityCheck( csc );