use of com.newrelic.agent.jmx.values.JavaLangJmxMetrics in project newrelic-java-agent by newrelic.
the class JmxServiceStartTest method testStartConfig.
@Test
public void testStartConfig() {
JmxService jmxService = ServiceFactory.getJmxService();
List<JmxGet> configurations = jmxService.getConfigurations();
JavaLangJmxMetrics metrics = new JavaLangJmxMetrics();
int extCountInJmxYml = 3;
Assert.assertEquals(configurations.toString(), configurations.size(), metrics.getFrameworkMetrics().size() + extCountInJmxYml);
// verify two of the java lang object names are present
boolean isObjectNameIndex0 = false;
boolean isObjectNameIndex1 = false;
for (JmxGet current : configurations) {
if (metrics.getFrameworkMetrics().get(0).getObjectNameString().equals(current.getObjectNameString())) {
isObjectNameIndex0 = true;
} else if (metrics.getFrameworkMetrics().get(1).getObjectNameString().equals(current.getObjectNameString())) {
isObjectNameIndex1 = true;
}
}
Assert.assertTrue("Some of the java lang metrics are missing from the start up.", isObjectNameIndex0);
Assert.assertTrue("Some of the java lang metrics are missing from the start up.", isObjectNameIndex1);
}
use of com.newrelic.agent.jmx.values.JavaLangJmxMetrics in project newrelic-java-agent by newrelic.
the class JmxObjectFactoryTest method jmxConfig6.
@Test
public void jmxConfig6() throws MalformedObjectNameException {
String versionSystemProp = System.getProperty("java.specification.version");
double version = Double.parseDouble(versionSystemProp);
if (version <= 1.5) {
return;
}
JmxObjectFactory factory = JmxObjectFactory.createJmxFactory();
List<JmxGet> objects = new ArrayList<>();
List<JmxInvoke> invokes = new ArrayList<>();
factory.getStartUpJmxObjects(objects, invokes);
Assert.assertEquals(0, objects.size());
JavaLangJmxMetrics metrics = new JavaLangJmxMetrics();
factory.convertFramework(metrics, objects, invokes);
Assert.assertEquals(metrics.getFrameworkMetrics().size(), objects.size());
verify(objects, 4);
objects.clear();
factory.convertFramework(new GlassfishJmxValues(), objects, invokes);
glassfishVerify(objects, invokes, 6);
}
Aggregations