use of com.sun.appserv.management.monitor.MonitoringStats in project Payara by payara.
the class MonitorTest method checkGetOpenStatistic.
public void checkGetOpenStatistic(final MonitoringStats mon) {
final Stats stats = mon.getStats();
final String[] names = mon.getStatisticNames();
for (int i = 0; i < names.length; ++i) {
final String name = names[i];
final CompositeData d = mon.getOpenStatistic(name);
final Statistic s = StatisticFactory.create(d);
final Statistic s2 = mon.getStatistic(name);
assert (s.getName().equals(name));
// values may have changed, but check the static fields
}
final CompositeDataSupport[] all = mon.getOpenStatistics(names);
assert (all != null);
assert (all.length == names.length);
}
use of com.sun.appserv.management.monitor.MonitoringStats in project Payara by payara.
the class MonitorTest method getAllMonitoringStats.
private Set<MonitoringStats> getAllMonitoringStats() throws ClassNotFoundException {
final long start = now();
final Set<MonitoringStats> all = getQueryMgr().queryInterfaceSet(MonitoringStats.class.getName(), null);
for (final MonitoringStats stats : all) {
}
printElapsed("getAllMonitoringStats", all.size(), start);
return (all);
}
use of com.sun.appserv.management.monitor.MonitoringStats in project Payara by payara.
the class MonitorTest method checkMonitoringStats.
public void checkMonitoringStats(final ObjectName objectName) throws Exception {
final MonitoringStats mon = getProxyFactory().getProxy(objectName, MonitoringStats.class);
mon.refresh();
mon.getStatsInterfaceName();
checkNumStatistics(mon);
checkStatisticNames(mon);
checkGetStatistic(mon);
checkGetStats(mon);
checkGetOpenStatistic(mon);
checkOpenStats(mon);
}
use of com.sun.appserv.management.monitor.MonitoringStats in project Payara by payara.
the class MonitorTest method checkAllStats.
public void checkAllStats(final ObjectName objectName) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
trace("checkAllStats: " + objectName);
final MonitoringStats mon = getProxyFactory().getProxy(objectName, MonitoringStats.class);
final Method[] methods = mon.getClass().getMethods();
final Method specificStatsMethod = getSpecificStatsGetterMethod(mon);
// the type of Stats returned from getStats() should be the same as the type
// returned from the (only) specific getAbcStats()
final Stats plainStats = mon.getStats();
assert (specificStatsMethod.getReturnType().isAssignableFrom(plainStats.getClass())) : "Stats returned from " + objectName + " getStats() should be assignable to " + specificStatsMethod.getReturnType().getName();
checkStats(mon, plainStats);
Stats stats = null;
try {
// verify that we can get it
stats = (Stats) specificStatsMethod.invoke(mon, (Object[]) null);
} catch (Exception e) {
final Throwable rootCause = ExceptionUtil.getRootCause(e);
failure("Failure calling " + specificStatsMethod.getName() + "() on " + objectName + " = " + rootCause.getClass().getName());
}
assert (plainStats.getClass() == stats.getClass());
checkStats(mon, stats);
}
use of com.sun.appserv.management.monitor.MonitoringStats in project Payara by payara.
the class MonitorTest method checkNumStatistics.
public void checkNumStatistics(final MonitoringStats mon) {
final Stats stats = mon.getStats();
assert (stats != null) : "null Stats from: " + Util.getObjectName(mon);
final String[] allNames = mon.getStatisticNames();
final Statistic[] statistics = mon.getStatistics(allNames);
assert (statistics.length == allNames.length) : "wrong number of statistics from: " + Util.getObjectName(mon) + ", got " + statistics.length + ", should be " + allNames.length;
}
Aggregations