Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldProvidePreviousTimeout()
        public virtual void ShouldProvidePreviousTimeout()
        {
            // given
            ExponentialBackoffStrategy strategy = new ExponentialBackoffStrategy(1, 1 << NUMBER_OF_ACCESSES, MILLISECONDS);
            TimeoutStrategy_Timeout    timeout  = strategy.NewTimeout();

            // when
            for (int i = 0; i < NUMBER_OF_ACCESSES; i++)
            {
                timeout.Increment();
            }

            // then
            assertEquals(1 << NUMBER_OF_ACCESSES, timeout.Millis);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRespectUpperBound()
        public virtual void ShouldRespectUpperBound()
        {
            // given
            long upperBound = (1 << NUMBER_OF_ACCESSES) - 5;
            ExponentialBackoffStrategy strategy = new ExponentialBackoffStrategy(1, upperBound, MILLISECONDS);
            TimeoutStrategy_Timeout    timeout  = strategy.NewTimeout();

            // when
            for (int i = 0; i < NUMBER_OF_ACCESSES; i++)
            {
                timeout.Increment();
            }

            assertEquals(upperBound, timeout.Millis);

            // additional increments
            timeout.Increment();
            timeout.Increment();
            timeout.Increment();

            // then
            assertEquals(upperBound, timeout.Millis);
        }
Пример #3
0
 public TimeoutStrategy_TimeoutAnonymousInnerClass(ExponentialBackoffStrategy outerInstance)
 {
     this.outerInstance = outerInstance;
     backoffTimeMillis  = outerInstance.initialBackoffTimeMillis;
 }