use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class AMXTestBase method getProxy.
protected final AMX getProxy(final ObjectName objectName) {
final ProxyFactory factory = ProxyFactory.getInstance(getConnectionSource(), true);
final AMX proxy = factory.getProxy(objectName, AMX.class);
return (proxy);
}
use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class CoverageInfoAnalyzer method getCoverage.
public Map<String, CoverageInfo> getCoverage(final Set<AMX> candidates) {
final Map<String, CoverageInfo> coverageMap = new HashMap<String, CoverageInfo>();
for (final AMX amx : candidates) {
final AMXDebugStuff debug = mTestUtil.asAMXDebugStuff(amx);
final CoverageInfo coverageInfo = debug.getCoverageInfo();
assert (coverageInfo != null);
handleSpecialCases(coverageInfo);
final String j2eeType = amx.getJ2EEType();
final CoverageInfo existing = coverageMap.get(j2eeType);
if (existing != null) {
existing.merge(coverageInfo);
} else {
coverageMap.put(j2eeType, coverageInfo);
}
}
return coverageMap;
}
use of com.sun.appserv.management.base.AMX 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());
}
}
}
use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class AMXTest method testInterfaceAgainstDelegate.
public void testInterfaceAgainstDelegate() throws Exception {
final long start = now();
final Set<AMX> all = getAllAMX();
final MBeanServerConnection conn = getMBeanServerConnection();
for (final AMX amx : all) {
final String result = (String) conn.invoke(Util.getObjectName(amx), "checkInterfaceAgainstDelegate", null, null);
}
printElapsed("testInterfaceAgainstDelegate", all.size(), start);
}
use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class AMXTest method checkMaps.
/**
* Verify that a proxy getAbcMap(...) Attribute or operation has an appropriate
* MBean getAbcObjectNameMap() method.
*/
public void checkMaps(final ObjectName objectName) throws Exception {
final AMX proxy = getProxyFactory().getProxy(objectName, AMX.class);
if (proxy instanceof Container) {
final Method[] methods = getInterfaceClass(proxy).getMethods();
final MBeanInfo mbeanInfo = Util.getExtra(proxy).getMBeanInfo();
for (int methodIdx = 0; methodIdx < methods.length; ++methodIdx) {
final Method method = methods[methodIdx];
final String methodName = method.getName();
if (isMapGetter(method)) {
if (methodName.endsWith(OBJECTNAME_MAP_SUFFIX)) {
warning("method should exist in MBeanInfo, not interface: " + methodName);
continue;
}
// verify that a corresponding peer method exists and
// has the right return type and same number and type of parameters
final String peerMethodName = StringUtil.replaceSuffix(methodName, MAP_SUFFIX, OBJECTNAME_MAP_SUFFIX);
checkCompatibleOperationExists(Util.getObjectName(proxy), method, peerMethodName, mbeanInfo);
} else if (isMapGetterName(methodName)) {
warning("operation " + methodName + " does not return a Map!");
}
}
}
}
Aggregations