Package org.talend.esb.monitoring.hq.DynamicMxFieldMeasurementPlugin

Examples of org.talend.esb.monitoring.hq.DynamicMxFieldMeasurementPlugin.TrivialCache


    assertNull(tc.get(key2));
  }
 
  @Test
  public void testGc() throws Exception {
    TrivialCache tc = new TrivialCache();
   
    tc.put(key1, val1);
    tc.put(key2, val2);
   
    tc.scheduleGc(1000);
   
    Thread.sleep(1050);
   
    tc.get(key1);
   
    Thread.sleep(1100);
   
    tc.stopGc();
   
    assertEquals(1, tc.size());
    assertEquals(val1, tc.get(key1));
    assertNull(tc.get(key2));
  }
View Full Code Here


  private static final String key2 = "cccc";
  private static final String val2 = "dddd";

  @Test
  public void testBasic() {
    TrivialCache tc = new TrivialCache();
   
    assertEquals(0, tc.size());
   
    tc.put(key1, val1);
   
    assertEquals(1, tc.size());
    assertEquals(val1, tc.get(key1));
    assertNull(tc.get(key2));
   
    tc.put(key2, val2);
   
    assertEquals(2, tc.size());
    assertEquals(val2, tc.get(key2));
   
    tc.invalidate(key2);
   
    assertEquals(1, tc.size());
    assertEquals(val1, tc.get(key1));
    assertNull(tc.get(key2));
  }
View Full Code Here

TOP

Related Classes of org.talend.esb.monitoring.hq.DynamicMxFieldMeasurementPlugin.TrivialCache

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.