Пример #1
0
  @Test
  public void testCacheTime() {
    Cache<String, String> cache = new LFUCache<>(3);
    cache.put("1", "1", 50);
    assertNotNull(cache.get("1"));
    assertNotNull(cache.get("1")); // boost usage
    cache.put("2", "2");
    cache.get("2");
    assertFalse(cache.isFull());
    cache.put("3", "3");
    assertTrue(cache.isFull());

    ThreadUtil.sleep(100);
    assertNull(cache.get("1")); // expired
    assertFalse(cache.isFull());

    cache.put("1", "1", 50);
    assertNotNull(cache.get("1"));
    assertNotNull(cache.get("1"));

    ThreadUtil.sleep(100);
    assertTrue(cache.isFull());
    cache.put("4", "4");
    assertNotNull(cache.get("3"));
    assertNotNull(cache.get("2"));
    assertNotNull(cache.get("4"));
    assertNull(cache.get("1"));
  }
Пример #2
0
 @Ignore
 @Test
 @Transactional
 // @Rollback(true)
 public void testTemp() {
   jobService.sendJobEndingEmails();
   ThreadUtil.sleep(10000);
 }