2
* See the file LICENSE for redistribution information.
4
* Copyright (c) 2000-2002
5
* Sleepycat Software. All rights reserved.
11
* Do some regression tests for simple get/set access methods
12
* on DbEnv, DbTxn, Db. We don't currently test that they have
13
* the desired effect, only that they operate and return correctly.
15
package com.sleepycat.test;
17
import com.sleepycat.db.*;
18
import java.io.FileNotFoundException;
20
public class TestGetSetMethods
22
public void testMethods()
23
throws DbException, FileNotFoundException
25
DbEnv dbenv = new DbEnv(0);
27
byte[][] conflicts = new byte[10][10];
29
dbenv.set_timeout(0x90000000,
30
Db.DB_SET_LOCK_TIMEOUT);
31
dbenv.set_lg_bsize(0x1000);
32
dbenv.set_lg_dir(".");
33
dbenv.set_lg_max(0x10000000);
34
dbenv.set_lg_regionmax(0x100000);
35
dbenv.set_lk_conflicts(conflicts);
36
dbenv.set_lk_detect(Db.DB_LOCK_DEFAULT);
37
// exists, but is deprecated:
38
// dbenv.set_lk_max(0);
39
dbenv.set_lk_max_lockers(100);
40
dbenv.set_lk_max_locks(10);
41
dbenv.set_lk_max_objects(1000);
42
dbenv.set_mp_mmapsize(0x10000);
43
dbenv.set_tas_spins(1000);
45
// Need to open the environment so we
46
// can get a transaction.
48
dbenv.open(".", Db.DB_CREATE | Db.DB_INIT_TXN |
49
Db.DB_INIT_LOCK | Db.DB_INIT_LOG |
53
dbtxn = dbenv.txn_begin(null, Db.DB_TXN_NOWAIT);
54
dbtxn.set_timeout(0xA0000000, Db.DB_SET_TXN_TIMEOUT);
59
// We get a db, one for each type.
60
// That's because once we call (for instance)
61
// set_bt_maxkey, DB 'knows' that this is a
62
// Btree Db, and it cannot be used to try Hash
63
// or Recno functions.
65
Db db_bt = new Db(null, 0);
66
db_bt.set_bt_maxkey(10000);
67
db_bt.set_bt_minkey(100);
68
db_bt.set_cachesize(0, 0x100000, 0);
71
Db db_h = new Db(null, 0);
72
db_h.set_h_ffactor(0x10);
73
db_h.set_h_nelem(100);
75
db_h.set_pagesize(0x10000);
78
Db db_re = new Db(null, 0);
79
db_re.set_re_delim('@');
81
db_re.set_re_source("re.in");
84
Db db_q = new Db(null, 0);
85
db_q.set_q_extentsize(200);
89
public static void main(String[] args)
92
TestGetSetMethods tester = new TestGetSetMethods();
96
System.err.println("TestGetSetMethods: Exception: " + e);