Package test.util

Examples of test.util.PersistCounter


        byte[] value = (num + ".value").getBytes();
        _store.put(key, value);
    }
   
    public void testPersistableListener() throws Exception {
        PersistCounter l = new PersistCounter();
        _store.setPersistableListener(l);
       
        assertEquals(0, l.getBeforeCount());
        assertEquals(0, l.getAfterCount());
       
        for(int i = 0, cnt = getBatchSize(); i < cnt; i++) {
            nextPut();
        }
       
        assertEquals(1, l.getBeforeCount());
        assertEquals(1, l.getAfterCount());
       
        for(int i = 0, cnt = getBatchSize(); i < cnt; i++) {
            nextPut();
        }
       
        assertEquals(2, l.getBeforeCount());
        assertEquals(2, l.getAfterCount());
       
        for(int i = 0, cnt = getBatchSize() + _rand.nextInt(10000); i < cnt; i++) {
            nextPut();
        }
       
        assertTrue(2 < l.getBeforeCount());
        assertTrue(2 < l.getAfterCount());
        assertEquals(l.getBeforeCount(), l.getAfterCount());
        System.out.println(String.format("persisted %d times", l.getAfterCount()));
    }
View Full Code Here

TOP

Related Classes of test.util.PersistCounter

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.