KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > log > LogEntryTest


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: LogEntryTest.java,v 1.15 2006/10/30 21:14:47 bostic Exp $
7  */

8
9 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()
21         throws DatabaseException {
22
23         byte testTypeNum = LogEntryType.LOG_IN.getTypeNum();
24         byte testVersion = LogEntryType.LOG_IN.getVersion();
25         byte testProvisionalVersion =
26             LogEntryType.setProvisional(testVersion);
27
28         /* Look it up by type name and version */
29         LogEntryType foundType = LogEntryType.findType(testTypeNum,
30                                                            testVersion);
31         assertEquals(foundType, LogEntryType.LOG_IN);
32         assertTrue(foundType.getSharedLogEntry() instanceof
33                    com.sleepycat.je.log.entry.INLogEntry);
34
35         /* Look it up by type name and provisional version */
36         foundType = LogEntryType.findType(testTypeNum,
37                                             testProvisionalVersion);
38         assertEquals(foundType, LogEntryType.LOG_IN);
39         assertTrue(foundType.getSharedLogEntry() instanceof
40                    com.sleepycat.je.log.entry.INLogEntry);
41
42         /* Get a new entry object */
43         LogEntry sharedEntry = foundType.getSharedLogEntry();
44         LogEntry newEntry = foundType.getNewLogEntry();
45         
46         assertTrue(sharedEntry != newEntry);
47     }
48 }
49
Popular Tags