01: /*-
02: * See the file LICENSE for redistribution information.
03: *
04: * Copyright (c) 2002,2008 Oracle. All rights reserved.
05: *
06: * $Id: LogEntryTest.java,v 1.16.2.3 2008/01/07 15:14:29 cwl Exp $
07: */
08:
09: package com.sleepycat.je.log;
10:
11: import junit.framework.TestCase;
12:
13: import com.sleepycat.je.DatabaseException;
14: import com.sleepycat.je.log.entry.LogEntry;
15:
16: /**
17: */
18: public class LogEntryTest extends TestCase {
19:
20: public void testEquality() throws DatabaseException {
21:
22: byte testTypeNum = LogEntryType.LOG_IN.getTypeNum();
23: byte testVersion = LogEntryType.LOG_IN.getVersion();
24: byte testProvisionalVersion = LogEntryType
25: .setEntryProvisional(testVersion);
26:
27: /* Look it up by type name and version */
28: LogEntryType foundType = LogEntryType.findType(testTypeNum,
29: testVersion);
30: assertEquals(foundType, LogEntryType.LOG_IN);
31: assertTrue(foundType.getSharedLogEntry() instanceof com.sleepycat.je.log.entry.INLogEntry);
32:
33: /* Look it up by type name and provisional version */
34: foundType = LogEntryType.findType(testTypeNum,
35: testProvisionalVersion);
36: assertEquals(foundType, LogEntryType.LOG_IN);
37: assertTrue(foundType.getSharedLogEntry() instanceof com.sleepycat.je.log.entry.INLogEntry);
38:
39: /* Get a new entry object */
40: LogEntry sharedEntry = foundType.getSharedLogEntry();
41: LogEntry newEntry = foundType.getNewLogEntry();
42:
43: assertTrue(sharedEntry != newEntry);
44: }
45: }
|