Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldTimeoutGracefully()
        public virtual void ShouldTimeoutGracefully()
        {
            FakeClock clock = FakeClocks;

            ResourcePool.CheckStrategy timeStrategy = new ResourcePool.CheckStrategy_TimeoutCheckStrategy(TIMEOUT_MILLIS, clock);

            while (clock.Millis() <= TIMEOUT_MILLIS)
            {
                assertFalse(timeStrategy.ShouldCheck());
                clock.Forward(10, TimeUnit.MILLISECONDS);
            }

            assertTrue(timeStrategy.ShouldCheck());

            clock.Forward(1, TimeUnit.MILLISECONDS);
            assertFalse(timeStrategy.ShouldCheck());
        }
Exemplo n.º 2
0
 private SomethingResourcePool GetResourcePool(StatefulMonitor stateMonitor, FakeClock clock, int minSize)
 {
     ResourcePool.CheckStrategy_TimeoutCheckStrategy timeoutCheckStrategy = new ResourcePool.CheckStrategy_TimeoutCheckStrategy(TIMEOUT_MILLIS, clock);
     return(new SomethingResourcePool(minSize, timeoutCheckStrategy, stateMonitor));
 }