use of javax.management.MBeanInfo in project Payara by payara.
the class GenericTest method checkObjectNameReturnValue.
void checkObjectNameReturnValue(MBeanServerConnection conn, ObjectName callee, MBeanOperationInfo operationInfo, ObjectName resultOfCall) throws Exception {
try {
printVerbose("checking MBean info for: " + resultOfCall);
final MBeanInfo mbeanInfo = conn.getMBeanInfo(resultOfCall);
} catch (InstanceNotFoundException e) {
trace("WARNING: MBean " + resultOfCall + " returned from " + operationInfo.getReturnType() + " " + operationInfo.getName() + "() does not exist");
} catch (Exception e) {
trace("WARNING: MBean " + resultOfCall + " returned from " + operationInfo.getReturnType() + " " + operationInfo.getName() + "() can't supply MBeanInfo: " + getExceptionMsg(e));
if (e instanceof IOException) {
throw (IOException) e;
}
}
}
use of javax.management.MBeanInfo in project Payara by payara.
the class LBTest method testGetLoadBalancerConfigMap.
public void testGetLoadBalancerConfigMap() {
if (testGetLoadBalancerConfigMap == false) {
return;
}
try {
Map map = getDomainConfig().getLoadBalancersConfig().getLoadBalancerConfigMap();
// System.out.println("Here is a list of Load Balancer Config MBeans in DAS: ");
// System.out.println(map);
ObjectName objName = new ObjectName("amx:j2eeType=X-LoadBalancerConfig,name=test-load-balancer");
MBeanInfo minfo = getConnection().getMBeanInfo(objName);
MBeanAttributeInfo[] mattrsinfo = minfo.getAttributes();
/*
for (MBeanAttributeInfo mattrinfo : mattrsinfo)
{
System.out.println("Attribute Name is : " + mattrinfo.getName());
}
*/
String[] attrsNames = (String[]) getConnection().getAttribute(objName, "AttributeNames");
/*for (String attrName : attrsNames)
System.out.println("Actual Attribute Name is : " + attrName);
System.out.println("AttributeNames are : " + attrsNames);
System.out.println("MBeanInfo is \n"+minfo);*/
String attrName = (String) getConnection().getAttribute(objName, "LbConfigName");
System.out.println("attrName is = " + attrName);
} catch (Throwable t) {
t.printStackTrace();
}
}
use of javax.management.MBeanInfo 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!");
}
}
}
}
use of javax.management.MBeanInfo in project Payara by payara.
the class BulkAccessTest method testBulkGetMBeanOperationInfos.
public void testBulkGetMBeanOperationInfos() throws Exception {
final long start = now();
final ObjectName[] objectNames = getTestUtil().getAllAMXArray();
final Object[] infos = getBulkAccess().bulkGetMBeanOperationInfo(objectNames);
// now verify that getting it singly yields the same result.
final MBeanServerConnection conn = getConnection();
for (int i = 0; i < infos.length; ++i) {
final MBeanOperationInfo[] bulkOperations = (MBeanOperationInfo[]) infos[i];
final MBeanInfo info = conn.getMBeanInfo(objectNames[i]);
assert (ArrayUtil.arraysEqual(info.getOperations(), bulkOperations));
}
printElapsed("testBulkGetMBeanOperationInfos", objectNames.length, start);
}
use of javax.management.MBeanInfo in project Payara by payara.
the class BulkAccessTest method testBulkGetMBeanAttributeNames.
public void testBulkGetMBeanAttributeNames() throws Exception {
final long start = now();
final ObjectName[] objectNames = getTestUtil().getAllAMXArray();
final Object[] nameArrays = getBulkAccess().bulkGetAttributeNames(objectNames);
for (int i = 0; i < nameArrays.length; ++i) {
final String[] bulkNames = (String[]) nameArrays[i];
final MBeanInfo info = getConnection().getMBeanInfo(objectNames[i]);
final String[] names = JMXUtil.getAttributeNames(info.getAttributes());
assert (ArrayUtil.arraysEqual(names, bulkNames));
}
printElapsed("testBulkGetMBeanAttributeNames", objectNames.length, start);
}
Aggregations