Search in sources :

Example 1 with ConfigConfig

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

the class ConfigConfigTest method create.

private ConfigConfig create(final String name) throws Throwable {
    final ConfigSetup setup = new ConfigSetup(getDomainRoot());
    setup.removeConfig(name);
    final ConfigConfig config = setup.createConfig(name);
    assert (name.equals(config.getName()));
    // see that it responds to a request
    final Map<String, Object> attrs = Util.getExtra(config).getAllAttributes();
    return config;
}
Also used : ConfigConfig(com.sun.appserv.management.config.ConfigConfig)

Example 2 with ConfigConfig

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

the class ConfigSetup method createConfig.

public ConfigConfig createConfig(final String name) {
    final Map<String, String> options = new HashMap<String, String>();
    final ConfigConfig config = getDomainConfig().getConfigsConfig().createConfigConfig(name, options);
    return config;
}
Also used : HashMap(java.util.HashMap) ConfigConfig(com.sun.appserv.management.config.ConfigConfig)

Example 3 with ConfigConfig

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

the class DiagnosticServiceConfigTest method testCreateRemove.

public void testCreateRemove() {
    final ConfigConfig config = getConfigConfig();
    // set defaults
    String computeChecksum = "" + true;
    String captureInstallLog = "" + true;
    String captureSystemInfo = "" + true;
    String captureHADBInfo = "" + true;
    String captureAppDD = "" + true;
    String verifyConfig = "" + true;
    String minLogLevel = Level.INFO.toString();
    String maxLongEntries = "10000";
    DiagnosticServiceConfig ds = config.getDiagnosticServiceConfig();
    if (ds != null) {
        // remember current settings
        computeChecksum = ds.getComputeChecksum();
        captureInstallLog = ds.getCaptureInstallLog();
        captureSystemInfo = ds.getCaptureSystemInfo();
        captureHADBInfo = ds.getCaptureHADBInfo();
        captureAppDD = ds.getCaptureAppDD();
        verifyConfig = ds.getVerifyConfig();
        minLogLevel = ds.getMinLogLevel();
        maxLongEntries = ds.getMaxLogEntries();
        config.removeDiagnosticServiceConfig();
        ds = null;
    }
    ds = config.createDiagnosticServiceConfig();
    config.removeDiagnosticServiceConfig();
    ds = null;
    // re-create it so one stays around
    ds = config.createDiagnosticServiceConfig();
    ds.setComputeChecksum(computeChecksum);
    ds.setCaptureInstallLog(captureInstallLog);
    ds.setCaptureSystemInfo(captureSystemInfo);
    ds.setCaptureHADBInfo(captureHADBInfo);
    ds.setCaptureAppDD(captureAppDD);
    ds.setVerifyConfig(verifyConfig);
    ds.setMinLogLevel(minLogLevel);
    ds.setMaxLogEntries(maxLongEntries);
}
Also used : ConfigConfig(com.sun.appserv.management.config.ConfigConfig) DiagnosticServiceConfig(com.sun.appserv.management.config.DiagnosticServiceConfig)

Example 4 with ConfigConfig

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

the class ReferencesTest method testCreateAndRemoveResourceRefStandaloneServer.

public void testCreateAndRemoveResourceRefStandaloneServer() throws Exception {
    if (!checkNotOffline("testCreateRemove")) {
        return;
    }
    final Map<String, AppserverConnectionSource> nodeAgents = getNodeAgents();
    if (nodeAgents.keySet().size() == 0) {
        warning("testCreateAndRemoveResourceRefStandaloneServer: no Node Agents--SKIPPING TEST");
        return;
    }
    final String nodeAgentName = nodeAgents.keySet().iterator().next();
    final ConfigSetup setup = new ConfigSetup(getDomainRoot());
    ensureMailResourceConfig();
    final String serverName = "testCreateAndRemoveResourceRefStandaloneServer";
    final String configName = serverName + "-config";
    final ConfigConfig config = setup.createConfig(configName);
    try {
        final int basePort = 34770;
        final StandaloneServerConfig server = setup.createServer(serverName, basePort, nodeAgentName, configName);
        try {
            final ResourceRefConfig ref = server.createResourceRefConfig(MAIL_RESOURCE_NAME);
            assert (ref != null);
            server.removeResourceRefConfig(ref.getName());
        } catch (Exception e) {
            setup.removeServer(serverName);
            throw e;
        } finally {
            removeMailResourceConfig();
        }
    } catch (Exception e) {
        setup.removeConfig(configName);
        throw e;
    }
}
Also used : AppserverConnectionSource(com.sun.appserv.management.client.AppserverConnectionSource) StandaloneServerConfig(com.sun.appserv.management.config.StandaloneServerConfig) ConfigConfig(com.sun.appserv.management.config.ConfigConfig) ResourceRefConfig(com.sun.appserv.management.config.ResourceRefConfig)

Example 5 with ConfigConfig

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

Aggregations

ConfigConfig (com.sun.appserv.management.config.ConfigConfig)12 DomainConfig (com.sun.appserv.management.config.DomainConfig)2 SecurityServiceConfig (com.sun.appserv.management.config.SecurityServiceConfig)2 StandaloneServerConfig (com.sun.appserv.management.config.StandaloneServerConfig)2 AMX (com.sun.appserv.management.base.AMX)1 AMXDebugSupportMBean (com.sun.appserv.management.base.AMXDebugSupportMBean)1 AppserverConnectionSource (com.sun.appserv.management.client.AppserverConnectionSource)1 AdminServiceConfig (com.sun.appserv.management.config.AdminServiceConfig)1 DiagnosticServiceConfig (com.sun.appserv.management.config.DiagnosticServiceConfig)1 JavaConfig (com.sun.appserv.management.config.JavaConfig)1 ModuleMonitoringLevelsConfig (com.sun.appserv.management.config.ModuleMonitoringLevelsConfig)1 NodeAgentConfig (com.sun.appserv.management.config.NodeAgentConfig)1 ResourceRefConfig (com.sun.appserv.management.config.ResourceRefConfig)1 HashMap (java.util.HashMap)1 AMXDebugStuff (org.glassfish.admin.amx.util.AMXDebugStuff)1