1 18 package org.apache.activemq.kaha; 19 20 import java.io.IOException ; 21 import java.util.Iterator ; 22 import java.util.LinkedList ; 23 import java.util.List ; 24 import java.util.ListIterator ; 25 import junit.framework.TestCase; 26 public class VolumeTest extends TestCase{ 27 28 protected Store store; 29 protected String name; 30 31 32 protected static final int NUMBER=1; 33 34 37 public void testListVolume() throws Exception { 38 ListContainer container=store.getListContainer("volume"); 39 container.setMarshaller(Store.BytesMarshaller); 40 byte[] data = new byte[10]; 41 for (int i =0; i< NUMBER; i++){ 42 container.add(data); 43 if(i%100000==0){ 44 System.err.println("persisted " + i); 45 } 46 47 } 48 int count = 0; 49 50 for (Iterator i = container.iterator(); i.hasNext();){ 51 assertNotNull(i.next()); 52 count++; 53 if (count%100000==0){ 54 System.err.println("retrived " + count); 55 } 56 } 57 assertEquals("Different retrieved to stored",NUMBER,count); 58 } 59 60 61 62 63 protected Store getStore() throws IOException { 64 return StoreFactory.open(name,"rw"); 65 } 66 67 protected void setUp() throws Exception { 68 super.setUp(); 69 name = System.getProperty("basedir", ".")+"/target/activemq-data/volume-container.db"; 70 StoreFactory.delete(name); 71 store=StoreFactory.open(name,"rw"); 72 73 } 74 75 protected void tearDown() throws Exception { 76 super.tearDown(); 77 if(store!=null){ 78 store.close(); 79 } 80 assertTrue(StoreFactory.delete(name)); 81 } 82 } 83 | Popular Tags |