use of org.apache.ignite.internal.processors.metric.GridMetricManager.IGNITE_METRICS in project ignite by apache.
the class JmxExporterSpiTest method testIgniteKernal.
/**
* @throws Exception If failed.
*/
@Test
public void testIgniteKernal() throws Exception {
DynamicMBean mbn = metricRegistry(ignite.name(), null, IGNITE_METRICS);
assertNotNull(mbn);
assertEquals(36, mbn.getMBeanInfo().getAttributes().length);
assertFalse(stream(mbn.getMBeanInfo().getAttributes()).anyMatch(a -> F.isEmpty(a.getDescription())));
assertFalse(F.isEmpty((String) mbn.getAttribute("fullVersion")));
assertFalse(F.isEmpty((String) mbn.getAttribute("copyright")));
assertFalse(F.isEmpty((String) mbn.getAttribute("osInformation")));
assertFalse(F.isEmpty((String) mbn.getAttribute("jdkInformation")));
assertFalse(F.isEmpty((String) mbn.getAttribute("vmName")));
assertFalse(F.isEmpty((String) mbn.getAttribute("discoverySpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("communicationSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("deploymentSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("checkpointSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("collisionSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("eventStorageSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("failoverSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("loadBalancingSpiFormatted")));
assertEquals(System.getProperty("user.name"), (String) mbn.getAttribute("osUser"));
assertNotNull(DateFormat.getDateTimeInstance().parse((String) mbn.getAttribute("startTimestampFormatted")));
assertNotNull(LocalTime.parse((String) mbn.getAttribute("uptimeFormatted")));
assertTrue((boolean) mbn.getAttribute("isRebalanceEnabled"));
assertTrue((boolean) mbn.getAttribute("isNodeInBaseline"));
assertTrue((boolean) mbn.getAttribute("active"));
assertTrue((long) mbn.getAttribute("startTimestamp") > 0);
assertTrue((long) mbn.getAttribute("uptime") > 0);
assertEquals(ignite.name(), (String) mbn.getAttribute("instanceName"));
assertEquals(Collections.emptyList(), mbn.getAttribute("userAttributesFormatted"));
assertEquals(Collections.emptyList(), mbn.getAttribute("lifecycleBeansFormatted"));
assertEquals(Collections.emptyMap(), mbn.getAttribute("longJVMPauseLastEvents"));
assertEquals(0L, mbn.getAttribute("longJVMPausesCount"));
assertEquals(0L, mbn.getAttribute("longJVMPausesTotalDuration"));
long clusterStateChangeTime = (long) mbn.getAttribute("lastClusterStateChangeTime");
assertTrue(0 < clusterStateChangeTime && clusterStateChangeTime < System.currentTimeMillis());
assertEquals(String.valueOf(ignite.configuration().getPublicThreadPoolSize()), mbn.getAttribute("executorServiceFormatted"));
assertEquals(ignite.configuration().isPeerClassLoadingEnabled(), mbn.getAttribute("isPeerClassLoadingEnabled"));
assertTrue(((String) mbn.getAttribute("currentCoordinatorFormatted")).contains(ignite.localNode().id().toString()));
assertEquals(ignite.configuration().getIgniteHome(), (String) mbn.getAttribute("igniteHome"));
assertEquals(ignite.localNode().id(), mbn.getAttribute("localNodeId"));
assertEquals(ignite.configuration().getGridLogger().toString(), (String) mbn.getAttribute("gridLoggerFormatted"));
assertEquals(ignite.configuration().getMBeanServer().toString(), (String) mbn.getAttribute("mBeanServerFormatted"));
assertEquals(ClusterState.ACTIVE.toString(), mbn.getAttribute("clusterState"));
}
Aggregations