Search in sources :

Example 1 with AMXDebugSupportMBean

use of com.sun.appserv.management.base.AMXDebugSupportMBean in project Payara by payara.

the class RunMeFirstTest method initCoverageInfos.

private void initCoverageInfos() {
    final Set<AMX> all = getAllAMX();
    // set the AMX-DEBUG flags on
    final String AMX_DEBUG = "-DAMX-DEBUG.enabled=true";
    final String AMX_DEBUG2 = "-DAMX-DEBUG=true";
    // set AMX-DEBUG.enabled=true in all ConfigConfig JVM options
    final Map<String, ConfigConfig> configs = getDomainConfig().getConfigsConfig().getConfigConfigMap();
    for (final ConfigConfig config : configs.values()) {
        final JavaConfig jc = config.getJavaConfig();
        final String[] opt = jc.getJVMOptions();
        final Set<String> jvmOptions = GSetUtil.newStringSet(opt == null ? new String[0] : opt);
        if (!(jvmOptions.contains(AMX_DEBUG) || jvmOptions.contains(AMX_DEBUG2))) {
            jvmOptions.add(AMX_DEBUG);
            jc.setJVMOptions(GSetUtil.toStringArray(jvmOptions));
            // don't warn for default-config; it's not used by a running server
            if (!config.getName().equals("default-config")) {
                warning("Enabled AMX-DEBUG for config " + config.getName() + " (restart required)");
            }
        }
    }
    // setup default stuff
    final AMXDebugSupportMBean debug = getAMXDebugSupportMBean();
    debug.setAll(true);
    debug.setDefaultDebug(true);
    debug.getOutputIDs();
    for (final AMX amx : all) {
        final AMXDebugStuff debugStuff = getTestUtil().asAMXDebugStuff(amx);
        if (debugStuff == null) {
            continue;
        }
        try {
            debugStuff.enableAMXDebug(true);
        } catch (Throwable t) {
            warning("Couldn't enableAMXDebug() for " + amx.getJ2EEType());
        }
        try {
            debugStuff.enableCoverageInfo(true);
            debugStuff.clearCoverageInfo();
        } catch (Throwable t) {
            warning("Couldn't enableCoverageInfo for " + amx.getJ2EEType());
        }
    }
}
Also used : JavaConfig(com.sun.appserv.management.config.JavaConfig) AMXDebugSupportMBean(com.sun.appserv.management.base.AMXDebugSupportMBean) AMXDebugStuff(org.glassfish.admin.amx.util.AMXDebugStuff) ConfigConfig(com.sun.appserv.management.config.ConfigConfig) AMX(com.sun.appserv.management.base.AMX)

Aggregations

AMX (com.sun.appserv.management.base.AMX)1 AMXDebugSupportMBean (com.sun.appserv.management.base.AMXDebugSupportMBean)1 ConfigConfig (com.sun.appserv.management.config.ConfigConfig)1 JavaConfig (com.sun.appserv.management.config.JavaConfig)1 AMXDebugStuff (org.glassfish.admin.amx.util.AMXDebugStuff)1