GetRollingMaxValue() public method

Get the max value of values in all buckets for the given HystrixRollingNumberEvent type. The HystrixRollingNumberEvent must be a "MaxUpdater" type (HystrixRollingNumberEvent.IsMaxUpdater() == true).
public GetRollingMaxValue ( HystrixRollingNumberEvent type ) : long
type HystrixRollingNumberEvent HystrixRollingNumberEvent defining which "MaxUpdater" to retrieve values from
return long
        public void RollingNumber_MaxValue()
        {
            MockedTime time = new MockedTime();
            try
            {
                HystrixRollingNumberEvent type = HystrixRollingNumberEvent.ThreadMaxActive;

                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);

                counter.UpdateRollingMax(type, 10);

                // sleep to get to a new bucket
                time.Increment(counter.BucketSizeInMilliseconds);

                counter.UpdateRollingMax(type, 30);

                // sleep to get to a new bucket
                time.Increment(counter.BucketSizeInMilliseconds);

                counter.UpdateRollingMax(type, 40);

                // sleep to get to a new bucket
                time.Increment(counter.BucketSizeInMilliseconds);

                counter.UpdateRollingMax(type, 15);

                Assert.AreEqual(40, counter.GetRollingMaxValue(type));

            }
            catch (Exception e)
            {
                TestContext.WriteLine(e.ToString());
                Assert.Fail("Exception: " + e.Message);
            }
        }
 public void RollingNumber_EmptyMax()
 {
     MockedTime time = new MockedTime();
     HystrixRollingNumberEvent type = HystrixRollingNumberEvent.ThreadMaxActive;
     HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);
     Assert.AreEqual(0, counter.GetRollingMaxValue(type));
 }
        public void RollingNumber_UpdateMax2()
        {
            MockedTime time = new MockedTime();
            try
            {
                HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);

                // increment
                counter.UpdateRollingMax(HystrixRollingNumberEvent.ThreadMaxActive, 10);
                counter.UpdateRollingMax(HystrixRollingNumberEvent.ThreadMaxActive, 30);
                counter.UpdateRollingMax(HystrixRollingNumberEvent.ThreadMaxActive, 20);

                // we should have 1 bucket
                Assert.AreEqual(1, counter.Buckets.Size);

                // the count should be 30
                Assert.AreEqual(30, counter.Buckets.GetLast().GetMaxUpdater(HystrixRollingNumberEvent.ThreadMaxActive).Max());
                Assert.AreEqual(30, counter.GetRollingMaxValue(HystrixRollingNumberEvent.ThreadMaxActive));

                // sleep to get to a new bucket
                time.Increment(counter.BucketSizeInMilliseconds * 3);

                counter.UpdateRollingMax(HystrixRollingNumberEvent.ThreadMaxActive, 30);
                counter.UpdateRollingMax(HystrixRollingNumberEvent.ThreadMaxActive, 30);
                counter.UpdateRollingMax(HystrixRollingNumberEvent.ThreadMaxActive, 50);

                // we should have 4 buckets
                Assert.AreEqual(4, counter.Buckets.Size);

                // the count
                Assert.AreEqual(50, counter.Buckets.GetLast().GetMaxUpdater(HystrixRollingNumberEvent.ThreadMaxActive).Max());
                Assert.AreEqual(50, counter.GetValueOfLatestBucket(HystrixRollingNumberEvent.ThreadMaxActive));

                // values per bucket
                long[] values = counter.GetValues(HystrixRollingNumberEvent.ThreadMaxActive);
                Assert.AreEqual(30, values[0]); // oldest bucket
                Assert.AreEqual(0, values[1]);
                Assert.AreEqual(0, values[2]);
                Assert.AreEqual(50, values[3]); // latest bucket

            }
            catch (Exception e)
            {
                TestContext.WriteLine(e.ToString());
                Assert.Fail("Exception: " + e.Message);
            }
        }