~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/test/scr016/TestGetSetMethods.java

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*-
2
 
 * See the file LICENSE for redistribution information.
3
 
 *
4
 
 * Copyright (c) 2000-2002
5
 
 *      Sleepycat Software.  All rights reserved.
6
 
 *
7
 
 * $Id$
8
 
 */
9
 
 
10
 
/*
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.
14
 
 */
15
 
package com.sleepycat.test;
16
 
 
17
 
import com.sleepycat.db.*;
18
 
import java.io.FileNotFoundException;
19
 
 
20
 
public class TestGetSetMethods
21
 
{
22
 
    public void testMethods()
23
 
        throws DbException, FileNotFoundException
24
 
    {
25
 
        DbEnv dbenv = new DbEnv(0);
26
 
        DbTxn dbtxn;
27
 
        byte[][] conflicts = new byte[10][10];
28
 
 
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);
44
 
 
45
 
        // Need to open the environment so we
46
 
        // can get a transaction.
47
 
        //
48
 
        dbenv.open(".", Db.DB_CREATE | Db.DB_INIT_TXN |
49
 
                   Db.DB_INIT_LOCK | Db.DB_INIT_LOG |
50
 
                   Db.DB_INIT_MPOOL,
51
 
                   0644);
52
 
 
53
 
        dbtxn = dbenv.txn_begin(null, Db.DB_TXN_NOWAIT);
54
 
        dbtxn.set_timeout(0xA0000000, Db.DB_SET_TXN_TIMEOUT);
55
 
        dbtxn.abort();
56
 
 
57
 
        dbenv.close(0);
58
 
 
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.
64
 
        //
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);
69
 
        db_bt.close(0);
70
 
 
71
 
        Db db_h = new Db(null, 0);
72
 
        db_h.set_h_ffactor(0x10);
73
 
        db_h.set_h_nelem(100);
74
 
        db_h.set_lorder(0);
75
 
        db_h.set_pagesize(0x10000);
76
 
        db_h.close(0);
77
 
 
78
 
        Db db_re = new Db(null, 0);
79
 
        db_re.set_re_delim('@');
80
 
        db_re.set_re_pad(10);
81
 
        db_re.set_re_source("re.in");
82
 
        db_re.close(0);
83
 
 
84
 
        Db db_q = new Db(null, 0);
85
 
        db_q.set_q_extentsize(200);
86
 
        db_q.close(0);
87
 
    }
88
 
 
89
 
    public static void main(String[] args)
90
 
    {
91
 
        try {
92
 
            TestGetSetMethods tester = new TestGetSetMethods();
93
 
            tester.testMethods();
94
 
        }
95
 
        catch (Exception e) {
96
 
            System.err.println("TestGetSetMethods: Exception: " + e);
97
 
        }
98
 
    }
99
 
}