use of org.glassfish.j2ee.statistics.Stats 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 org.glassfish.j2ee.statistics.Stats 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