Search in sources :

Example 56 with TimeUnit

use of java.util.concurrent.TimeUnit in project guava by google.

the class FakeTickerTest method testAutoIncrementStep_resetToZero.

public void testAutoIncrementStep_resetToZero() {
    FakeTicker ticker = new FakeTicker().setAutoIncrementStep(10, TimeUnit.NANOSECONDS);
    assertEquals(0, ticker.read());
    assertEquals(10, ticker.read());
    assertEquals(20, ticker.read());
    for (TimeUnit timeUnit : EnumSet.allOf(TimeUnit.class)) {
        ticker.setAutoIncrementStep(0, timeUnit);
        assertEquals("Expected no auto-increment when setting autoIncrementStep to 0 " + timeUnit, 30, ticker.read());
    }
}
Also used : TimeUnit(java.util.concurrent.TimeUnit)

Example 57 with TimeUnit

use of java.util.concurrent.TimeUnit in project guava by hceylan.

the class MapMakerInternalMapTest method testSetExpireAfterAccess.

public void testSetExpireAfterAccess() {
    long duration = 42;
    TimeUnit unit = SECONDS;
    MapMakerInternalMap<Object, Object> map = makeMap(createMapMaker().expireAfterAccess(duration, unit));
    assertEquals(unit.toNanos(duration), map.expireAfterAccessNanos);
}
Also used : TimeUnit(java.util.concurrent.TimeUnit)

Example 58 with TimeUnit

use of java.util.concurrent.TimeUnit in project guava by hceylan.

the class MapMakerInternalMapTest method testSetExpireAfterWrite.

public void testSetExpireAfterWrite() {
    long duration = 42;
    TimeUnit unit = SECONDS;
    MapMakerInternalMap<Object, Object> map = makeMap(createMapMaker().expireAfterWrite(duration, unit));
    assertEquals(unit.toNanos(duration), map.expireAfterWriteNanos);
}
Also used : TimeUnit(java.util.concurrent.TimeUnit)

Example 59 with TimeUnit

use of java.util.concurrent.TimeUnit in project guava by hceylan.

the class LocalCacheTest method testSetExpireAfterAccess.

public void testSetExpireAfterAccess() {
    long duration = 42;
    TimeUnit unit = TimeUnit.SECONDS;
    LocalCache<Object, Object> map = makeLocalCache(createCacheBuilder().expireAfterAccess(duration, unit));
    assertEquals(unit.toNanos(duration), map.expireAfterAccessNanos);
}
Also used : TimeUnit(java.util.concurrent.TimeUnit)

Example 60 with TimeUnit

use of java.util.concurrent.TimeUnit in project guava by hceylan.

the class LocalCacheTest method testSetExpireAfterWrite.

public void testSetExpireAfterWrite() {
    long duration = 42;
    TimeUnit unit = TimeUnit.SECONDS;
    LocalCache<Object, Object> map = makeLocalCache(createCacheBuilder().expireAfterWrite(duration, unit));
    assertEquals(unit.toNanos(duration), map.expireAfterWriteNanos);
}
Also used : TimeUnit(java.util.concurrent.TimeUnit)

Aggregations

TimeUnit (java.util.concurrent.TimeUnit)190 Test (org.junit.Test)28 ExecutionException (java.util.concurrent.ExecutionException)16 IOException (java.io.IOException)11 TimeoutException (java.util.concurrent.TimeoutException)11 Future (java.util.concurrent.Future)10 HashMap (java.util.HashMap)7 TimeSpec (com.linkedin.thirdeye.api.TimeSpec)6 ArrayList (java.util.ArrayList)6 TimeValue (org.elasticsearch.common.unit.TimeValue)6 DataType (com.linkedin.pinot.common.data.FieldSpec.DataType)5 File (java.io.File)5 HashSet (java.util.HashSet)5 Matcher (java.util.regex.Matcher)5 WaitUntilGatewaySenderFlushedCoordinatorJUnitTest (org.apache.geode.internal.cache.wan.WaitUntilGatewaySenderFlushedCoordinatorJUnitTest)5 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)5 TimeGranularity (com.linkedin.thirdeye.api.TimeGranularity)4 GwtIncompatible (com.google.common.annotations.GwtIncompatible)3 RestException (com.linkedin.r2.message.rest.RestException)3 Map (java.util.Map)3