Package org.directmemory.misc

Examples of org.directmemory.misc.DummyPojo


  }
 
  @Test
  public void remove() {
    CacheStore cache = new CacheStore(-1, 1 * 1024 * 1024, 1);
    cache.put("test1", new DummyPojo("test1", 1024));
    CacheEntry entry = cache.remove("test1");
    assertEquals("test1", entry.key);
    entry = cache.getEntry("test1");
    assertNull(entry);
    cache.reset();
View Full Code Here


  @Test public void reachLimit() {
    int limit = 10;
    CacheStore cache = new CacheStore(limit, 1 * 1024 * 1024, 1);
   
    for (int i = 1; i <= limit; i++) {
      cache.put("test" + i, new DummyPojo("test" + 1, 1024));
      if (i < limit) {
        assert(limit >= cache.heapEntriesCount());
      }
      logger.debug("reachLimit " + cache);
    }
View Full Code Here

 
  @Test public void goOverTheLimit() {
    int limit = 10;
    CacheStore cache = new CacheStore(limit, 1 * 1024 * 1024, 1);
    for (int i = 1; i <= limit * 2; i++) {
      DummyPojo pojo = new  DummyPojo("test" + i, 1024);
      cache.put("test" + i, pojo);
      if (i <= limit ) {
        assertEquals(i, cache.heapEntriesCount());
      } else {
        assertEquals(limit, cache.heapEntriesCount());
View Full Code Here

 
  @Test public void goOverTheLimitPutAndGet() {
    int limit = 1000;
    CacheStore cache = new CacheStore(limit, 10 * 1024 * 1024, 1);
    for (int i = 1; i <= limit * 1.5; i++) {
      DummyPojo pojo = new  DummyPojo("test" + i, 1024);
      cache.put("test" + i, pojo);
      if (i <= limit) {
        assertEquals(i, cache.heapEntriesCount());
      } else {
        assertEquals(limit, cache.heapEntriesCount());
      }
    }

    logger.debug("goOverTheLimitPutAndGet " + cache.toString());
   
    for (int i = 1; i <= limit * 1.5; i++) {
      @SuppressWarnings("unused")
      DummyPojo pojo = new  DummyPojo("test" + i, 1024);
      DummyPojo newPojo = (DummyPojo)cache.get("test" + i);
      assertNotNull(newPojo);
      assertEquals("test"+i, newPojo.name);
  }
    assertEquals(limit, cache.heapEntriesCount());
    cache.reset();
View Full Code Here

TOP

Related Classes of org.directmemory.misc.DummyPojo

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.