Package org.springframework.xd.analytics.metrics.core

Examples of org.springframework.xd.analytics.metrics.core.RichGaugeRepository


  protected abstract RichGaugeRepository createService();

  @Test
  public void getOrCreateReturnsCorrectInstance() throws Exception {
    RichGaugeRepository gs = createService();
    gs.setValue("test", 9.99);
    gs.setValue("test", 0.01);

    RichGauge g = gs.findOne("test");
    assertEquals("test", g.getName());
    assertEquals(0.01, g.getValue(), 1E-6);
    assertEquals(5.0, g.getAverage(), 1E-6);
    assertEquals(9.99, g.getMax(), 1E-6);
    assertEquals(0.01, g.getMin(), 1E-6);
View Full Code Here


    assertEquals(0.01, g.getMin(), 1E-6);
  }

  @Test
  public void resetExistingGaugeCausesReset() throws Exception {
    RichGaugeRepository gs = createService();
    gs.setValue("test", 9.99);
    gs.reset("test");
    RichGauge g = gs.findOne("test");
    assertEquals(0.0, g.getValue(), 1E-6);
  }
View Full Code Here

    assertEquals(0.0, g.getValue(), 1E-6);
  }

  @Test
  public void testExponentialMovingAverage() throws Exception {
    RichGaugeRepository gs = createService();
    gs.setAlpha("test", 0.1);
    gs.setValue("test", 71.0);
    RichGauge g = gs.findOne("test");
    assertEquals(71.0, g.getAverage(), 1E-6);
    gs.setValue("test", 70.0);
    g = gs.findOne("test");
    assertEquals(71.0, g.getAverage(), 1E-6);
    gs.setValue("test", 69.0);
    g = gs.findOne("test");
    assertEquals(70.9, g.getAverage(), 1E-6);
    gs.setValue("test", 68.0);
    g = gs.findOne("test");
    assertEquals(70.71, g.getAverage(), 1E-6);
  }
View Full Code Here

  @Autowired
  RedisRichGaugeRepository repo;

  @Test
  public void testParseDouble() {
    RichGaugeRepository richGaugeRepository = mock(RichGaugeRepository.class);
    RichGaugeHandler handler = new RichGaugeHandler(richGaugeRepository, "test", -1);
    int i = 4;
    double val = handler.convertToDouble(i);
    assertEquals(4.0, val, 0.001);
    double d = 4;
View Full Code Here

TOP

Related Classes of org.springframework.xd.analytics.metrics.core.RichGaugeRepository

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.