Package info.ganglia.jmxetric

Examples of info.ganglia.jmxetric.MBeanSampler


    /**
     * Test of attribute sample, type Long
     */
    @Test
    public void sampleLong() throws Exception {
        MBeanSampler sampler = new MBeanSampler(0, 30000, "TEST") ;
        MyPublisher publisher = new MyPublisher() ;
        sampler.setPublisher(publisher);
        sampler.addMBeanAttribute(BEAN_NAME, "Long", GMetricType.INT32,
            "bytes", GMetricSlope.BOTH, "Longer");
        sampler.run() ;
        String value = publisher.getResult("Longer");
        assertEquals( Example.LONG_VALUE, Long.valueOf(value ));
    }
View Full Code Here


    /**
     * Test of attribute sample, type String
     */
    @Test
    public void sampleComposite() throws Exception {
        MBeanSampler sampler = new MBeanSampler(0, 30000, "TEST") ;
        MyPublisher publisher = new MyPublisher() ;
        sampler.setPublisher(publisher);
       
        String compNamePublishName = "compName";
        sampler.addMBeanAttribute(BEAN_NAME,
                    "Composite",
                    "name",
                    GMetricType.STRING,
                    "bytes",
                    GMetricSlope.BOTH,
                    compNamePublishName);
       
        String compIntPublishName = "compInt";
        sampler.addMBeanAttribute(BEAN_NAME,
                      "Composite",
                      "integer",
                      GMetricType.STRING,
                      "bytes",
                      GMetricSlope.BOTH,
                      compIntPublishName);
       
        String compDatePublishName = "compDate";
        sampler.addMBeanAttribute(BEAN_NAME,
                  "Composite",
                  "date",
                  GMetricType.STRING,
                  "bytes",
                  GMetricSlope.BOTH,
                  compDatePublishName);
       
        sampler.run();
       
        assertEquals( ExampleComposite.STRING_VALUE,
                publisher.getResult(compNamePublishName) );
       
        assertEquals( "" + ExampleComposite.INT_VALUE,
View Full Code Here

    /**
     * Test of attribute sample, type int, slope positive
     */
    @Test
    public void sampleCounter() throws Exception {
        MBeanSampler sampler = new MBeanSampler(0, 1, "TEST") ;
        MyPublisher publisher = new MyPublisher() ;
        sampler.setPublisher(publisher);
        sampler.addMBeanAttribute(BEAN_NAME, "Counter", GMetricType.INT32,
            "units", GMetricSlope.POSITIVE, "counter");
        sampler.run() ;
        String value = publisher.getResult("counter");
        assertTrue( Integer.valueOf(value) >= 0);
    }
View Full Code Here

TOP

Related Classes of info.ganglia.jmxetric.MBeanSampler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.