Search in sources :

Example 1 with ClusteredServerConfig

use of com.sun.appserv.management.config.ClusteredServerConfig in project Payara by payara.

the class ClusteredServerConfigTest method createClusteredServer.

public ClusteredServerConfig createClusteredServer(final String serverName, final String nodeAgentName, final int basePort) {
    final DomainConfig domainConfig = getDomainConfig();
    if (domainConfig.getServersConfig().getClusteredServerConfigMap().get(serverName) != null) {
        domainConfig.getServersConfig().removeClusteredServerConfig(serverName);
    } else if (domainConfig.getServersConfig().getStandaloneServerConfigMap().get(serverName) != null) {
        domainConfig.getServersConfig().removeStandaloneServerConfig(serverName);
    }
    final ClusterConfig clusterConfig = ClusterConfigTest.ensureDefaultInstance(domainConfig);
    if (domainConfig.getServersConfig().getClusteredServerConfigMap().get(serverName) != null) {
        domainConfig.getServersConfig().removeClusteredServerConfig(serverName);
        assert domainConfig.getServersConfig().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.getServersConfig().createClusteredServerConfig(serverName, clusterConfig.getName(), nodeAgentName, options);
    sanityCheck(csc);
    return csc;
}
Also used : HashMap(java.util.HashMap) ClusteredServerConfig(com.sun.appserv.management.config.ClusteredServerConfig) DomainConfig(com.sun.appserv.management.config.DomainConfig) ClusterConfig(com.sun.appserv.management.config.ClusterConfig)

Example 2 with ClusteredServerConfig

use of com.sun.appserv.management.config.ClusteredServerConfig in project Payara by payara.

the class ClusteredServerConfigTest method testCreateRemove.

public void testCreateRemove() {
    final DomainConfig domainConfig = getDomainConfig();
    final NodeAgentConfig nodeAgentConfig = getDASNodeAgentConfig();
    if (nodeAgentConfig == null) {
        warning("SKIPPING ClusteredServerConfigTest.testCreateRemove: " + "no DAS Node Agent has been specified; use " + PropertyKeys.DAS_NODE_AGENT_NAME);
    } else {
        final int NUM = 5;
        final String baseName = "ClusteredServerConfigTest";
        verifyRefContainers();
        final ClusteredServerConfig[] servers = new ClusteredServerConfig[NUM];
        for (int i = 0; i < NUM; ++i) {
            final int basePort = 11000 + i * 10;
            servers[i] = createClusteredServer(baseName + "-" + i, nodeAgentConfig.getName(), basePort);
            printVerbose("Created ClusteredServerConfig: " + servers[i].getName());
            assert XTypes.CLUSTERED_SERVER_CONFIG.equals(servers[i].getJ2EEType());
            verifyRefContainers();
        }
        for (int i = 0; i < NUM; ++i) {
            final String name = servers[i].getName();
            domainConfig.getServersConfig().removeClusteredServerConfig(name);
            printVerbose("Removed ClusteredServerConfig: " + name);
        }
    }
}
Also used : NodeAgentConfig(com.sun.appserv.management.config.NodeAgentConfig) ClusteredServerConfig(com.sun.appserv.management.config.ClusteredServerConfig) DomainConfig(com.sun.appserv.management.config.DomainConfig)

Aggregations

ClusteredServerConfig (com.sun.appserv.management.config.ClusteredServerConfig)2 DomainConfig (com.sun.appserv.management.config.DomainConfig)2 ClusterConfig (com.sun.appserv.management.config.ClusterConfig)1 NodeAgentConfig (com.sun.appserv.management.config.NodeAgentConfig)1 HashMap (java.util.HashMap)1