Search in sources :

Example 1 with JavaLangJmxMetrics

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);
}
Also used : JavaLangJmxMetrics(com.newrelic.agent.jmx.values.JavaLangJmxMetrics) JmxService(com.newrelic.agent.jmx.JmxService) JmxGet(com.newrelic.agent.jmx.create.JmxGet) Test(org.junit.Test)

Example 2 with JavaLangJmxMetrics

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);
}
Also used : JavaLangJmxMetrics(com.newrelic.agent.jmx.values.JavaLangJmxMetrics) ArrayList(java.util.ArrayList) GlassfishJmxValues(com.newrelic.agent.jmx.values.GlassfishJmxValues) Test(org.junit.Test)

Aggregations

JavaLangJmxMetrics (com.newrelic.agent.jmx.values.JavaLangJmxMetrics)2 Test (org.junit.Test)2 JmxService (com.newrelic.agent.jmx.JmxService)1 JmxGet (com.newrelic.agent.jmx.create.JmxGet)1 GlassfishJmxValues (com.newrelic.agent.jmx.values.GlassfishJmxValues)1 ArrayList (java.util.ArrayList)1