2 # -*- coding: utf-8 -*-
6 sys.path.append("python")
10 import openchange.mapistoredb as mapistoredb
11 import openchange.mapistore as mapistore
12 from openchange import mapi
14 os.mkdir("/tmp/mapistoredb");
16 def newTitle(title, separator):
19 print separator * len(title)
21 newTitle("[Step 1]. Initializing mapistore database", '=')
22 MAPIStoreDB = mapistoredb.mapistoredb("/tmp/mapistoredb")
24 newTitle("[Step 2]. Provisioning mapistore database", '=')
25 ret = MAPIStoreDB.provision(netbiosname = "server",
26 firstorg = "OpenChange Project",
27 firstou = "OpenChange Development Unit")
29 print "\t* Provisioning: SUCCESS"
31 print "\t* Provisioning: FAILURE"
33 MAPIStoreDB.dump_configuration()
35 newTitle("[Step 3]. Testing API parts", '=')
37 newTitle("A. Testing NetBIOS name", '-')
38 print "* NetBIOS name: %s" %MAPIStoreDB.netbiosname
40 newTitle("B. Testing First OU", '-')
41 print "* FirstOU: %s" %MAPIStoreDB.firstou
43 newTitle("C. Testing First Organisation", '-')
44 print "* First Organisation: %s" %MAPIStoreDB.firstorg
47 newTitle("[Step 4]. Retrieve mapistore URI for fsocpf", '=')
48 newTitle("*fsocpf:", '=')
49 print "\t* Inbox: %s" % MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_INBOX, "jkerihuel", "fsocpf://")
50 print "\t* Calendar: %s" % MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_CALENDAR, "jkerihuel", "fsocpf://")
51 print "\t* Outbox: %s" % MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_OUTBOX, "jkerihuel", "fsocpf://")
52 print "\t* Contacts: %s" % MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_CONTACTS, "jkerihuel", "fsocpf://")
54 newTitle("mstoredb:", '=')
55 print "\t* Mailbox Root: %s" % MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_ROOT_FOLDER, "jkerihuel", "mstoredb://")
56 print "\t* IPM SUbtree: %s" % MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_IPM_SUBTREE, "jkerihuel", "mstoredb://")
57 print "\t* Inbox: %s" % MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_INBOX, "jkerihuel", "mstoredb://")
59 newTitle("[Step 5]. Create a new mailbox", '=')
60 uri = MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_ROOT_FOLDER, "jkerihuel", "mstoredb://")
61 ret = MAPIStoreDB.new_mailbox("jkerihuel", uri)
62 print "\t* new_mailbox: ret = %d" % ret
64 newTitle("[Step 6]. Get and Set a new allocation range to the mailbox ", '=')
65 (retval,rstart,rend) = MAPIStoreDB.get_new_allocation_range("jkerihuel", 0x1000)
67 print "\t* range start = 0x%.16x" % rstart
68 print "\t* range end = 0x%.16x" % rend
69 retval = MAPIStoreDB.set_mailbox_allocation_range("jkerihuel", rstart, rend)
70 print "\t* allocation range on mailbox: %d" % retval
73 newTitle("[Step 7]. Retrieve a new FID", '=')
74 fid = MAPIStoreDB.get_new_fid("jkerihuel")
75 print "\t* FID = 0x%.16x" % fid
77 newTitle("[Step 8]. Retrieve a new allocation range", '=')
78 (retval,rstart,rend) = MAPIStoreDB.get_new_allocation_range("jkerihuel", 0x1000)
80 print "\t* range_start = 0x%.16x" % rstart
81 print "\t* range_end = 0x%.16x" % rend
83 newTitle("[Step 9]. Retrieve a new FID", '=')
84 new_fid = MAPIStoreDB.get_new_fid("jkerihuel")
85 print "\t* FID = 0x%.16x" % new_fid