Package org.directmemory.test.misc

Examples of org.directmemory.test.misc.DummyObject


    ICacheStore cache = new CacheStoreImpl(-1, cacheSize);
    cache.setSupervisor(supervisor);

    logger.debug("started");
      for (int i = 0; i < cacheSize / 1024 / 1.25; i++) {
        cache.put("test" + i, new DummyObject("test"+i, 1024));
//        DummyObject retrObj = (DummyObject)cache.retrieveObject("test"+i);
//        logger.debug(retrObj.getName());
      }
     
      Long finishedAt = Calendar.getInstance().getTimeInMillis();
View Full Code Here


    ICacheStore cache = new CacheStoreImpl(-1, cacheSize);
    cache.setSupervisor(supervisor);

    logger.debug("started");
      for (int i = 0; i < cacheSize / 1024; i++) {
        cache.put("test" + i, new DummyObject("test"+i, 1024));
      }
     
      Long finishedAt = Calendar.getInstance().getTimeInMillis();
   
      logger.debug("finished in " + (finishedAt - startedAt) + " msecs");
View Full Code Here

    return "key"+generator.nextInt(cacheSize/objectsSize);
  }

  public DummyObject randomObject() {
      String key = randomKey();
    DummyObject dummy = new DummyObject(key);
    dummy.PayLoad = new byte[objectsSize*generator.nextInt(5)];
    return dummy;
  }
View Full Code Here

 
  long lastOne = 0;
 
  public DummyObject nextObject() {
      String key = "key"+lastOne++;
    DummyObject dummy = new DummyObject(key);
    dummy.PayLoad = new byte[objectsSize];
    return dummy;
  }
View Full Code Here

 
    @Test
    //@Required(max = 50)
    @Required(max = 300) // well under 50ms in sun jvm
    public void firstAndLargestItem() throws IOException {  
      DummyObject firstObject = new DummyObject("key0", objectsSize*5);
      cache.put(firstObject.getName(), firstObject);
      assertEquals(cache.entries().size(), 1);
      DummyObject retrievedObject = (DummyObject)cache.get("key0");
      assertEquals(firstObject.getName(), retrievedObject.getName());
    logger.debug(cache.toString());
    }
View Full Code Here

    logger.debug(cache.toString());
    }
   
  private void doSomeReads(int howMany) {
    for (int i = 0; i < howMany; i++) {
        @SuppressWarnings("unused")
      DummyObject randomPick = (DummyObject)cache.get(randomKey());
     
    }
  }
View Full Code Here

  }
  @Test
    @PerfTest(duration = 10000, threads = 5)
    @Required(max = 1500, average = 1)
  public void onlyWrites() throws IOException {
      DummyObject object2add = nextObject();
      ICacheEntry entry = cache.put(object2add.getName(), object2add);
      assertNotNull(entry);
  }
View Full Code Here

   
      Iterator<ICacheEntry> iter = entries.values().iterator();
    while (iter.hasNext()) {
      ICacheEntry entry = iter.next();
      if (!entry.expired()) {
        DummyObject dummy = (DummyObject) cache.get(entry.getKey());
        assertNotNull(dummy);
        assertEquals(entry.getKey(), dummy.getName());
      }
      mySize+=entry.size();
    }

    logger.debug("**** computed size is: " + mySize)
View Full Code Here

 
    @Test
    @PerfTest(duration = 10000, threads = 5)
    @Required(max = 750, average = 1)
    public void onlyReads() {  
      @SuppressWarnings("unused")
    DummyObject randomPick = (DummyObject)cache.get(randomKey());
    }
View Full Code Here

    @Test
    @PerfTest(duration = 10000, threads = 5)
    @Required(max = 1500, average = 6)
    public void twentyReadsOneWriteOneDelete() throws IOException {  
      doSomeReads(20);
      DummyObject object2add = randomObject();
      cache.put(object2add.getName(), object2add);
      cache.delete(randomKey());
    }
View Full Code Here

TOP

Related Classes of org.directmemory.test.misc.DummyObject

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.