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());
}
}
}
Aggregations