01: /*-
02: * See the file LICENSE for redistribution information.
03: *
04: * Copyright (c) 2002,2008 Oracle. All rights reserved.
05: *
06: * $Id: FileManagerTestUtils.java,v 1.6.2.2 2008/01/07 15:14:29 cwl Exp $
07: */
08:
09: package com.sleepycat.je.log;
10:
11: import java.io.IOException;
12:
13: import com.sleepycat.je.DatabaseException;
14: import com.sleepycat.je.dbi.EnvironmentImpl;
15:
16: public class FileManagerTestUtils {
17: public static void createLogFile(FileManager fileManager,
18: EnvironmentImpl envImpl, long logFileSize)
19: throws DatabaseException, IOException {
20:
21: LogBuffer logBuffer = new LogBuffer(50, envImpl);
22: logBuffer.getDataBuffer().flip();
23: fileManager.bumpLsn(logFileSize
24: - FileManager.firstLogEntryOffset());
25: logBuffer.registerLsn(fileManager.getLastUsedLsn());
26: fileManager.writeLogBuffer(logBuffer);
27: fileManager.syncLogEndAndFinishFile();
28: }
29: }
|