@Test public void testIncrementInSingleBucket() { MockedTime time = new MockedTime(); try { NumerusRollingNumber counter = new NumerusRollingNumber(EventType.BOOTSTRAP, time, 200, 10); counter.increment(EventType.SUCCESS); counter.increment(EventType.SUCCESS); counter.increment(EventType.SUCCESS); counter.increment(EventType.SUCCESS); counter.increment(EventType.FAILURE); counter.increment(EventType.FAILURE); counter.increment(EventType.TIMEOUT); assertEquals(1, counter.buckets.size()); assertEquals(4, counter.buckets.getLast().getAdder(EventType.SUCCESS).sum()); assertEquals(2, counter.buckets.getLast().getAdder(EventType.FAILURE).sum()); assertEquals(1, counter.buckets.getLast().getAdder(EventType.TIMEOUT).sum()); } catch (Exception e) { e.printStackTrace(); fail("Exception: " + e.getMessage()); } }
public void increment(NumerusRollingNumberEvent type, Boolean doNotBlock) { Bucket lastBucket = getCurrentBucket(doNotBlock); if (lastBucket == null) return; lastBucket.getAdder(type).increment(); }
NumerusRollingNumber { public void increment(NumerusRollingNumberEvent type, Boolean doNotBlock) { Bucket lastBucket = getCurrentBucket(doNotBlock); if (lastBucket == null) return; lastBucket.getAdder(type).increment(); } }
NumerusRollingNumber { public void increment(NumerusRollingNumberEvent type, Boolean doNotBlock) { Bucket lastBucket = getCurrentBucket(doNotBlock); if (lastBucket == null) return; lastBucket.getAdder(type).increment(); } NumerusRollingNumber(NumerusRollingNumberEvent events, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets);   NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, int timeInMilliseconds, int numberOfBuckets); private  NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets); }
NumerusRollingNumber { public void increment(NumerusRollingNumberEvent type, Boolean doNotBlock) { Bucket lastBucket = getCurrentBucket(doNotBlock); if (lastBucket == null) return; lastBucket.getAdder(type).increment(); } NumerusRollingNumber(NumerusRollingNumberEvent events, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets);   NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, int timeInMilliseconds, int numberOfBuckets); private  NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets); void increment(NumerusRollingNumberEvent type, Boolean doNotBlock); void increment(NumerusRollingNumberEvent type); void add(NumerusRollingNumberEvent type, long value); void updateRollingMax(NumerusRollingNumberEvent type, long value); void reset(); long getCumulativeSum(NumerusRollingNumberEvent type); long getRollingSum(NumerusRollingNumberEvent type, Boolean doNotBlock); long getRollingSum(NumerusRollingNumberEvent type); long getValueOfLatestBucket(NumerusRollingNumberEvent type); long[] getValues(NumerusRollingNumberEvent type); long getRollingMaxValue(NumerusRollingNumberEvent type); }
NumerusRollingNumber { public void increment(NumerusRollingNumberEvent type, Boolean doNotBlock) { Bucket lastBucket = getCurrentBucket(doNotBlock); if (lastBucket == null) return; lastBucket.getAdder(type).increment(); } NumerusRollingNumber(NumerusRollingNumberEvent events, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets);   NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, int timeInMilliseconds, int numberOfBuckets); private  NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets); void increment(NumerusRollingNumberEvent type, Boolean doNotBlock); void increment(NumerusRollingNumberEvent type); void add(NumerusRollingNumberEvent type, long value); void updateRollingMax(NumerusRollingNumberEvent type, long value); void reset(); long getCumulativeSum(NumerusRollingNumberEvent type); long getRollingSum(NumerusRollingNumberEvent type, Boolean doNotBlock); long getRollingSum(NumerusRollingNumberEvent type); long getValueOfLatestBucket(NumerusRollingNumberEvent type); long[] getValues(NumerusRollingNumberEvent type); long getRollingMaxValue(NumerusRollingNumberEvent type);  }