1 8 9 package com.sleepycat.je.log; 10 11 import java.io.File ; 12 import java.io.IOException ; 13 14 import junit.framework.TestCase; 15 16 import com.sleepycat.je.DatabaseException; 17 import com.sleepycat.je.DbInternal; 18 import com.sleepycat.je.Environment; 19 import com.sleepycat.je.EnvironmentConfig; 20 import com.sleepycat.je.dbi.EnvironmentImpl; 21 import com.sleepycat.je.util.TestUtils; 22 import com.sleepycat.je.utilint.DbLsn; 23 24 25 28 public class FileReaderTest extends TestCase { 29 30 static private final boolean DEBUG = false; 31 32 private File envHome; 33 34 35 public FileReaderTest() 36 throws Exception { 37 38 envHome = new File (System.getProperty(TestUtils.DEST_DIR)); 39 } 40 41 public void setUp() 42 throws IOException , DatabaseException { 43 44 TestUtils.removeFiles("Setup", envHome, FileManager.JE_SUFFIX); 45 } 46 47 public void tearDown() 48 throws IOException , DatabaseException { 49 50 TestUtils.removeFiles("TearDown", envHome, FileManager.JE_SUFFIX); 51 } 52 53 59 public void testEmptyExtraFile() 60 throws Throwable { 61 62 EnvironmentConfig envConfig = TestUtils.initEnvConfig(); 63 envConfig.setAllowCreate(true); 64 Environment env = new Environment(envHome, envConfig); 65 66 try { 67 68 env.sync(); 69 70 71 EnvironmentImpl envImpl = DbInternal.envGetEnvironmentImpl(env); 72 73 File newFile = new File (envHome, "00000001.jdb"); 74 newFile.createNewFile(); 75 76 INFileReader reader = new INFileReader(envImpl, 77 1000, 78 DbLsn.NULL_LSN, 79 DbLsn.NULL_LSN, 80 false, 81 false, 82 DbLsn.NULL_LSN, 83 null); 84 while (reader.readNextEntry()) { 85 } 86 87 } catch (Throwable t) { 88 t.printStackTrace(); 89 throw t; 90 } finally { 91 env.close(); 92 } 93 } 94 } 95 | Popular Tags |