Search in sources :

Example 1 with NodeAgentConfig

use of com.sun.appserv.management.config.NodeAgentConfig 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)

Example 2 with NodeAgentConfig

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

the class StandaloneServerConfigTest method _testCreateStandaloneServerConfig.

private void _testCreateStandaloneServerConfig(final String serverNameSuffix, final int basePort) {
    final ConfigSetup setup = new ConfigSetup(getDomainRoot());
    final Map<String, NodeAgentConfig> nodeAgentConfigs = getDomainConfig().getNodeAgentsConfig().getNodeAgentConfigMap();
    if (nodeAgentConfigs.keySet().size() == 0) {
        warning("testCreateStandaloneServerConfig: No node agents available, skipping test.");
    } else {
        // create a server for each node agent
        for (final String nodeAgentName : nodeAgentConfigs.keySet()) {
            final String serverName = nodeAgentName + serverNameSuffix;
            final String configName = serverName + "-config";
            // in case a previous failed run left them around
            setup.removeServer(serverName);
            setup.removeConfig(configName);
            final ConfigConfig config = setup.createConfig(configName);
            assert (configName.equals(config.getName()));
            // sanity check
            final Map<String, Object> attrs = Util.getExtra(config).getAllAttributes();
            try {
                final StandaloneServerConfig server = setup.createServer(serverName, basePort, nodeAgentName, config.getName());
                // it worked, get rid of it
                setup.removeServer(server.getName());
            } catch (Throwable t) {
                assert false : ExceptionUtil.toString(t);
            } finally {
                try {
                    setup.removeConfig(config.getName());
                } catch (Exception ee) {
                // we wanted to get rid of it...oh well.
                }
            }
        }
    }
}
Also used : StandaloneServerConfig(com.sun.appserv.management.config.StandaloneServerConfig) ConfigConfig(com.sun.appserv.management.config.ConfigConfig) NodeAgentConfig(com.sun.appserv.management.config.NodeAgentConfig)

Example 3 with NodeAgentConfig

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

the class AMXTestBase method getDASNodeAgentConfig.

protected NodeAgentConfig getDASNodeAgentConfig() {
    final String name = getDASNodeAgentName();
    NodeAgentConfig config = null;
    if (name != null) {
        config = getDomainConfig().getNodeAgentsConfig().getNodeAgentConfigMap().get(name);
    }
    return config;
}
Also used : NodeAgentConfig(com.sun.appserv.management.config.NodeAgentConfig)

Example 4 with NodeAgentConfig

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

the class TestMain method getNodeAgentConnections.

public Map<String, AppserverConnectionSource> getNodeAgentConnections(final DomainRoot domainRoot, final PropertyGetter getter) {
    final NodeAgentsConfig nacs = domainRoot.getDomainConfig().getNodeAgentsConfig();
    if (nacs == null)
        return null;
    final Map<String, NodeAgentConfig> nodeAgentConfigs = nacs.getNodeAgentConfigMap();
    final Map<String, AppserverConnectionSource> nodeAgentConnections = new HashMap<String, AppserverConnectionSource>();
    println("");
    println("Contacting node agents...");
    for (final NodeAgentConfig nodeAgentConfig : nodeAgentConfigs.values()) {
        final String nodeAgentName = nodeAgentConfig.getName();
        final JMXConnectorConfig connConfig = nodeAgentConfig.getJMXConnectorConfig();
        final AttributeResolverHelper r = new AttributeResolverHelper(connConfig);
        if (!r.resolveBoolean("Enabled")) {
            println(nodeAgentName + ": DISABLED CONNECTOR");
            continue;
        }
        final String address = connConfig.getAddress();
        final int port = r.resolveInt("Port");
        final boolean tlsEnabled = r.resolveBoolean("SecurityEnabled");
        final String protocol = connConfig.getProtocol();
        if (!RMI_PROTOCOL_IN_CONFIG.equals(protocol)) {
            println(nodeAgentName + ": UNSUPPORTED CONNECTOR PROTOCOL: " + protocol);
            continue;
        }
        // See if we can connect
        try {
            final AppserverConnectionSource asConn = _getConnectionSource(getter, address, port);
            final MBeanServerConnection conn = asConn.getMBeanServerConnection(false);
            final boolean alive = conn.isRegistered(JMXUtil.getMBeanServerDelegateObjectName());
            assert (alive);
            nodeAgentConnections.put(nodeAgentName, asConn);
            println(nodeAgentName + ": ALIVE");
        } catch (Exception e) {
            println("Node agent " + nodeAgentConfig.getName() + " could not be contacted: " + e.getClass().getName());
            println(nodeAgentName + ": COULD NOT BE CONTACTED");
            continue;
        }
    }
    println("");
    return nodeAgentConnections;
}
Also used : HashMap(java.util.HashMap) JMXConnectorConfig(com.sun.appserv.management.config.JMXConnectorConfig) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) NodeAgentsConfig(com.sun.appserv.management.config.NodeAgentsConfig) AppserverConnectionSource(com.sun.appserv.management.client.AppserverConnectionSource) NodeAgentConfig(com.sun.appserv.management.config.NodeAgentConfig) AttributeResolverHelper(com.sun.appserv.management.helper.AttributeResolverHelper) MBeanServerConnection(javax.management.MBeanServerConnection)

Aggregations

NodeAgentConfig (com.sun.appserv.management.config.NodeAgentConfig)4 AppserverConnectionSource (com.sun.appserv.management.client.AppserverConnectionSource)1 ClusteredServerConfig (com.sun.appserv.management.config.ClusteredServerConfig)1 ConfigConfig (com.sun.appserv.management.config.ConfigConfig)1 DomainConfig (com.sun.appserv.management.config.DomainConfig)1 JMXConnectorConfig (com.sun.appserv.management.config.JMXConnectorConfig)1 NodeAgentsConfig (com.sun.appserv.management.config.NodeAgentsConfig)1 StandaloneServerConfig (com.sun.appserv.management.config.StandaloneServerConfig)1 AttributeResolverHelper (com.sun.appserv.management.helper.AttributeResolverHelper)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 MBeanServerConnection (javax.management.MBeanServerConnection)1