Package com.bluesoft.util.metrics.core.domain

Examples of com.bluesoft.util.metrics.core.domain.BasicMetricEvent


      }
    } );

    MeteringMetric baseMeteringMetric = new BasicMeteringMetric( "testMeteringMetric" );
    MeteringMetric asyncMeteringMetric = testManager.createQueuedMeteringMetric( baseMeteringMetric );
    asyncMeteringMetric.addEvent( new BasicMetricEvent() );
    assertEquals( baseMeteringMetric.getCount(), BigInteger.ONE );
    assertEquals( asyncMeteringMetric.getCount(), BigInteger.ONE );
    assertEquals( eventCount, 1 );
  }
View Full Code Here


      return result;
    } catch ( Exception ex ) {
      exception = ex;
      throw ex;
    } finally {
      metric.addEvent( new BasicMetricEvent( null, result, exception ) );
    }
  }
View Full Code Here

    mm.setClock( clock );

    assertNull( mm.getRate() );
    assertEquals( mm.getRateUnit(), TimeUnit.SECONDS );

    mm.addEvent( new BasicMetricEvent() );

    Rate r = mm.getRate();
    assertTrue( r.getValue().compareTo( BigDecimal.valueOf( 1L ) ) == 0, ": expected 1 but found " + r.getValue() );
    assertEquals( r.getUnit(), TimeUnit.SECONDS );

    mm.addEvent( new BasicMetricEvent() );
    mm.addEvent( new BasicMetricEvent() );
    mm.addEvent( new BasicMetricEvent() );
    mm.addEvent( new BasicMetricEvent() );

    r = mm.getRate();
    assertTrue( r.getValue().compareTo( BigDecimal.valueOf( 5L ) ) == 0, ": expected 5 but found " + r.getValue() );
    assertEquals( r.getUnit(), TimeUnit.SECONDS );

    MeteringMetric snapshot = (MeteringMetric)mm.getSnapshot();

    r = snapshot.getRate();
    assertTrue( r.getValue().compareTo( BigDecimal.valueOf( 5L ) ) == 0, ": expected 5 but found " + r.getValue() );
    assertEquals( r.getUnit(), TimeUnit.SECONDS );

    for ( int i = 0; i < 15; i++ ) {
      mm.addEvent( new BasicMetricEvent() );
    }

    snapshot = (MeteringMetric)mm.getSnapshot();

    r = snapshot.getRate();
View Full Code Here

TOP

Related Classes of com.bluesoft.util.metrics.core.domain.BasicMetricEvent

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.