Package org.apache.camel.management.mbean

Examples of org.apache.camel.management.mbean.LoadTriplet.update()


public class LoadTripletTest extends TestCase {

    public void testConstantUpdate() {
        LoadTriplet t = new LoadTriplet();
        t.update(1);
        assertEquals(1.0, t.getLoad1(), Math.ulp(1.0) * 5);
        assertEquals(1.0, t.getLoad5(), Math.ulp(1.0) * 5);
        assertEquals(1.0, t.getLoad15(), Math.ulp(1.0) * 5);
        for (int i = 0; i < 100; i++) {
            t.update(1);
View Full Code Here


        t.update(1);
        assertEquals(1.0, t.getLoad1(), Math.ulp(1.0) * 5);
        assertEquals(1.0, t.getLoad5(), Math.ulp(1.0) * 5);
        assertEquals(1.0, t.getLoad15(), Math.ulp(1.0) * 5);
        for (int i = 0; i < 100; i++) {
            t.update(1);
        }
        assertEquals(1.0, t.getLoad1(), Math.ulp(1.0) * 5);
        assertEquals(1.0, t.getLoad5(), Math.ulp(1.0) * 5);
        assertEquals(1.0, t.getLoad15(), Math.ulp(1.0) * 5);
    }
View Full Code Here

        assertEquals(1.0, t.getLoad15(), Math.ulp(1.0) * 5);
    }

    public void testChargeDischarge() {
        LoadTriplet t = new LoadTriplet();
        t.update(0);
        double last = t.getLoad15();
        double lastDiff = Double.MAX_VALUE;
        double diff;
        for (int i = 0; i < 1000; i++) {
            t.update(5);
View Full Code Here

        t.update(0);
        double last = t.getLoad15();
        double lastDiff = Double.MAX_VALUE;
        double diff;
        for (int i = 0; i < 1000; i++) {
            t.update(5);
            diff = t.getLoad15() - last;
            assertTrue(diff > 0.0);
            assertTrue(diff < lastDiff);
            lastDiff = diff;
            last = t.getLoad15();
View Full Code Here

            lastDiff = diff;
            last = t.getLoad15();
        }
        lastDiff = -Double.MAX_VALUE;
        for (int i = 0; i < 1000; i++) {
            t.update(0);
            diff = t.getLoad15() - last;
            assertTrue(diff < 0.0);
            assertTrue(String.format("%f is smaller than %f", diff, lastDiff), diff > lastDiff);
            lastDiff = diff;
            last = t.getLoad15();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.