Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.mapdb;
 
 import org.junit.Test;
 
 import java.io.File;
 import java.io.IOError;
 
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class StoreWALTest extends StoreDirectTest<StoreWAL>{
    Volume.Factory fac = Volume.fileFactory(false,0,f, 0L,false);
    @Override
    protected StoreWAL openEngine() {
        return new StoreWAL();
    }
    @Override
    boolean canRollback() {
        return true;
    }
    @Test
    public void delete_files_after_close2(){
        File f = UtilsTest.tempDbFile();
        File phys = new File(f.getPath()+.);
        File wal = new File(f.getPath()+.);
        DB db = DBMaker.newFileDB(f).deleteFilesAfterClose().make();
        db.getHashMap("test").put("aa","bb");
        db.commit();
        assertTrue(f.exists());
        assertTrue(phys.exists());
        assertFalse(wal.exists());
        db.getHashMap("test").put("a12a","bb");
        assertTrue(wal.exists());
        db.close();
        assertFalse(f.exists());
        assertFalse(phys.exists());
        assertFalse(wal.exists());
    }
    @Test public void header_index_ver() throws IOException {
        e.put(new byte[10000],.);
        e.commit();
        e.close();
        //increment store version
        File index = new File(f.getPath()+.);
        Volume v = Volume.volumeForFile(index,true,false,0,false);
        v.ensureAvailable(100);
        v.putInt(0,.);
        v.putLong(8,.);
        v.putInt(80,1);
        v.sync();
        v.close();
        try{
            e = openEngine();
            fail();
        }catch(IOError e){
            Throwable e2 = e;
            while (e2 instanceof IOError){
                e2 = e2.getCause();
            }
            assertTrue(e2.getMessage().contains("version"));
        }
    }
New to GrepCode? Check out our FAQ X