fd7453f20c800366b61c5e5416fdc8418b148030
1 #
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
3 # This module is free software, and you may redistribute it and/or modify
4 # under the same terms as Python, so long as this copyright message and
5 # disclaimer are retained in their original form.
6 #
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
10 # POSSIBILITY OF SUCH DAMAGE.
11 #
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 #
18 # $Id: test_db.py,v 1.34 2002-07-18 11:52:00 richard Exp $
20 import unittest, os, shutil, time
22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \
23 Interval, DatabaseError, Boolean, Number
24 from roundup import date, password
25 from roundup.indexer import Indexer
27 def setupSchema(db, create, module):
28 status = module.Class(db, "status", name=String())
29 status.setkey("name")
30 user = module.Class(db, "user", username=String(), password=Password(),
31 assignable=Boolean(), age=Number())
32 file = module.FileClass(db, "file", name=String(), type=String(),
33 comment=String(indexme="yes"))
34 issue = module.IssueClass(db, "issue", title=String(indexme="yes"),
35 status=Link("status"), nosy=Multilink("user"), deadline=Date(),
36 foo=Interval(), files=Multilink("file"))
37 db.post_init()
38 if create:
39 status.create(name="unread")
40 status.create(name="in-progress")
41 status.create(name="testing")
42 status.create(name="resolved")
43 db.commit()
45 class MyTestCase(unittest.TestCase):
46 def tearDown(self):
47 if os.path.exists('_test_dir'):
48 shutil.rmtree('_test_dir')
50 class config:
51 DATABASE='_test_dir'
52 MAILHOST = 'localhost'
53 MAIL_DOMAIN = 'fill.me.in.'
54 INSTANCE_NAME = 'Roundup issue tracker'
55 ISSUE_TRACKER_EMAIL = 'issue_tracker@%s'%MAIL_DOMAIN
56 ISSUE_TRACKER_WEB = 'http://some.useful.url/'
57 ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN
58 FILTER_POSITION = 'bottom' # one of 'top', 'bottom', 'top and bottom'
59 ANONYMOUS_ACCESS = 'deny' # either 'deny' or 'allow'
60 ANONYMOUS_REGISTER = 'deny' # either 'deny' or 'allow'
61 MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no'
62 EMAIL_SIGNATURE_POSITION = 'bottom'
64 class anydbmDBTestCase(MyTestCase):
65 def setUp(self):
66 from roundup.backends import anydbm
67 # remove previous test, ignore errors
68 if os.path.exists(config.DATABASE):
69 shutil.rmtree(config.DATABASE)
70 os.makedirs(config.DATABASE + '/files')
71 self.db = anydbm.Database(config, 'test')
72 setupSchema(self.db, 1, anydbm)
73 self.db2 = anydbm.Database(config, 'test')
74 setupSchema(self.db2, 0, anydbm)
76 def testStringChange(self):
77 self.db.issue.create(title="spam", status='1')
78 self.assertEqual(self.db.issue.get('1', 'title'), 'spam')
79 self.db.issue.set('1', title='eggs')
80 self.assertEqual(self.db.issue.get('1', 'title'), 'eggs')
81 self.db.commit()
82 self.assertEqual(self.db.issue.get('1', 'title'), 'eggs')
83 self.db.issue.create(title="spam", status='1')
84 self.db.commit()
85 self.assertEqual(self.db.issue.get('2', 'title'), 'spam')
86 self.db.issue.set('2', title='ham')
87 self.assertEqual(self.db.issue.get('2', 'title'), 'ham')
88 self.db.commit()
89 self.assertEqual(self.db.issue.get('2', 'title'), 'ham')
91 def testLinkChange(self):
92 self.db.issue.create(title="spam", status='1')
93 self.assertEqual(self.db.issue.get('1', "status"), '1')
94 self.db.issue.set('1', status='2')
95 self.assertEqual(self.db.issue.get('1', "status"), '2')
97 def testDateChange(self):
98 self.db.issue.create(title="spam", status='1')
99 a = self.db.issue.get('1', "deadline")
100 self.db.issue.set('1', deadline=date.Date())
101 b = self.db.issue.get('1', "deadline")
102 self.db.commit()
103 self.assertNotEqual(a, b)
104 self.assertNotEqual(b, date.Date('1970-1-1 00:00:00'))
105 self.db.issue.set('1', deadline=date.Date())
107 def testIntervalChange(self):
108 self.db.issue.create(title="spam", status='1')
109 a = self.db.issue.get('1', "foo")
110 self.db.issue.set('1', foo=date.Interval('-1d'))
111 self.assertNotEqual(self.db.issue.get('1', "foo"), a)
113 def testBooleanChange(self):
114 self.db.user.create(username='foo', assignable=1)
115 a = self.db.user.get('1', 'assignable')
116 self.db.user.set('1', assignable='false')
117 self.assertNotEqual(self.db.user.get('1', 'assignable'), a)
118 self.db.user.set('1', assignable='FaLse')
119 self.db.user.set('1', assignable='nO')
120 self.db.user.set('1', assignable=0)
121 self.db.user.set('1', assignable='tRuE')
122 self.db.user.set('1', assignable='yEs')
123 self.db.user.set('1', assignable=1)
125 def testNumberChange(self):
126 self.db.user.create(username='foo', age='1')
127 a = self.db.user.get('1', 'age')
128 self.db.user.set('1', age='3')
129 self.assertNotEqual(self.db.user.get('1', 'age'), a)
130 self.db.user.set('1', age='1.0')
132 def testNewProperty(self):
133 ' make sure a new property is added ok '
134 self.db.issue.create(title="spam", status='1')
135 self.db.issue.addprop(fixer=Link("user"))
136 props = self.db.issue.getprops()
137 keys = props.keys()
138 keys.sort()
139 self.assertEqual(keys, ['activity', 'creation', 'creator', 'deadline',
140 'files', 'fixer', 'foo', 'id', 'messages', 'nosy', 'status',
141 'superseder', 'title'])
142 self.assertEqual(self.db.issue.get('1', "fixer"), None)
144 def testRetire(self):
145 self.db.issue.create(title="spam", status='1')
146 b = self.db.status.get('1', 'name')
147 a = self.db.status.list()
148 self.db.status.retire('1')
149 # make sure the list is different
150 self.assertNotEqual(a, self.db.status.list())
151 # can still access the node if necessary
152 self.assertEqual(self.db.status.get('1', 'name'), b)
153 self.db.commit()
154 self.assertEqual(self.db.status.get('1', 'name'), b)
155 self.assertNotEqual(a, self.db.status.list())
157 def testSerialisation(self):
158 self.db.issue.create(title="spam", status='1',
159 deadline=date.Date(), foo=date.Interval('-1d'))
160 self.db.commit()
161 assert isinstance(self.db.issue.get('1', 'deadline'), date.Date)
162 assert isinstance(self.db.issue.get('1', 'foo'), date.Interval)
163 self.db.user.create(username="fozzy",
164 password=password.Password('t. bear'))
165 self.db.commit()
166 assert isinstance(self.db.user.get('1', 'password'), password.Password)
168 def testTransactions(self):
169 # remember the number of items we started
170 num_issues = len(self.db.issue.list())
171 num_files = self.db.numfiles()
172 self.db.issue.create(title="don't commit me!", status='1')
173 self.assertNotEqual(num_issues, len(self.db.issue.list()))
174 self.db.rollback()
175 self.assertEqual(num_issues, len(self.db.issue.list()))
176 self.db.issue.create(title="please commit me!", status='1')
177 self.assertNotEqual(num_issues, len(self.db.issue.list()))
178 self.db.commit()
179 self.assertNotEqual(num_issues, len(self.db.issue.list()))
180 self.db.rollback()
181 self.assertNotEqual(num_issues, len(self.db.issue.list()))
182 self.db.file.create(name="test", type="text/plain", content="hi")
183 self.db.rollback()
184 self.assertEqual(num_files, self.db.numfiles())
185 for i in range(10):
186 self.db.file.create(name="test", type="text/plain",
187 content="hi %d"%(i))
188 self.db.commit()
189 num_files2 = self.db.numfiles()
190 self.assertNotEqual(num_files, num_files2)
191 self.db.file.create(name="test", type="text/plain", content="hi")
192 self.db.rollback()
193 self.assertNotEqual(num_files, self.db.numfiles())
194 self.assertEqual(num_files2, self.db.numfiles())
196 def testExceptions(self):
197 # this tests the exceptions that should be raised
198 ar = self.assertRaises
200 #
201 # class create
202 #
203 # string property
204 ar(TypeError, self.db.status.create, name=1)
205 # invalid property name
206 ar(KeyError, self.db.status.create, foo='foo')
207 # key name clash
208 ar(ValueError, self.db.status.create, name='unread')
209 # invalid link index
210 ar(IndexError, self.db.issue.create, title='foo', status='bar')
211 # invalid link value
212 ar(ValueError, self.db.issue.create, title='foo', status=1)
213 # invalid multilink type
214 ar(TypeError, self.db.issue.create, title='foo', status='1',
215 nosy='hello')
216 # invalid multilink index type
217 ar(ValueError, self.db.issue.create, title='foo', status='1',
218 nosy=[1])
219 # invalid multilink index
220 ar(IndexError, self.db.issue.create, title='foo', status='1',
221 nosy=['10'])
223 #
224 # key property
225 #
226 # key must be a String
227 ar(TypeError, self.db.user.setkey, 'password')
228 # key must exist
229 ar(KeyError, self.db.user.setkey, 'fubar')
231 #
232 # class get
233 #
234 # invalid node id
235 ar(IndexError, self.db.issue.get, '1', 'title')
236 # invalid property name
237 ar(KeyError, self.db.status.get, '2', 'foo')
239 #
240 # class set
241 #
242 # invalid node id
243 ar(IndexError, self.db.issue.set, '1', title='foo')
244 # invalid property name
245 ar(KeyError, self.db.status.set, '1', foo='foo')
246 # string property
247 ar(TypeError, self.db.status.set, '1', name=1)
248 # key name clash
249 ar(ValueError, self.db.status.set, '2', name='unread')
250 # set up a valid issue for me to work on
251 self.db.issue.create(title="spam", status='1')
252 # invalid link index
253 ar(IndexError, self.db.issue.set, '6', title='foo', status='bar')
254 # invalid link value
255 ar(ValueError, self.db.issue.set, '6', title='foo', status=1)
256 # invalid multilink type
257 ar(TypeError, self.db.issue.set, '6', title='foo', status='1',
258 nosy='hello')
259 # invalid multilink index type
260 ar(ValueError, self.db.issue.set, '6', title='foo', status='1',
261 nosy=[1])
262 # invalid multilink index
263 ar(IndexError, self.db.issue.set, '6', title='foo', status='1',
264 nosy=['10'])
265 # invalid number value
266 ar(TypeError, self.db.user.create, username='foo', age='a')
267 # invalid boolean value
268 ar(TypeError, self.db.user.create, username='foo', assignable='fubar')
269 self.db.user.create(username='foo')
270 # invalid number value
271 ar(TypeError, self.db.user.set, '3', username='foo', age='a')
272 # invalid boolean value
273 ar(TypeError, self.db.user.set, '3', username='foo', assignable='fubar')
275 def testJournals(self):
276 self.db.issue.addprop(fixer=Link("user", do_journal='yes'))
277 self.db.user.create(username="mary")
278 self.db.user.create(username="pete")
279 self.db.issue.create(title="spam", status='1')
280 self.db.commit()
282 # journal entry for issue create
283 journal = self.db.getjournal('issue', '1')
284 self.assertEqual(1, len(journal))
285 (nodeid, date_stamp, journaltag, action, params) = journal[0]
286 self.assertEqual(nodeid, '1')
287 self.assertEqual(journaltag, 'test')
288 self.assertEqual(action, 'create')
289 keys = params.keys()
290 keys.sort()
291 self.assertEqual(keys, ['deadline', 'files', 'fixer', 'foo',
292 'messages', 'nosy', 'status', 'superseder', 'title'])
293 self.assertEqual(None,params['deadline'])
294 self.assertEqual(None,params['fixer'])
295 self.assertEqual(None,params['foo'])
296 self.assertEqual([],params['nosy'])
297 self.assertEqual('1',params['status'])
298 self.assertEqual('spam',params['title'])
300 # journal entry for link
301 journal = self.db.getjournal('user', '1')
302 self.assertEqual(1, len(journal))
303 self.db.issue.set('1', fixer='1')
304 self.db.commit()
305 journal = self.db.getjournal('user', '1')
306 self.assertEqual(2, len(journal))
307 (nodeid, date_stamp, journaltag, action, params) = journal[1]
308 self.assertEqual('1', nodeid)
309 self.assertEqual('test', journaltag)
310 self.assertEqual('link', action)
311 self.assertEqual(('issue', '1', 'fixer'), params)
313 # journal entry for unlink
314 self.db.issue.set('1', fixer='2')
315 self.db.commit()
316 journal = self.db.getjournal('user', '1')
317 self.assertEqual(3, len(journal))
318 (nodeid, date_stamp, journaltag, action, params) = journal[2]
319 self.assertEqual('1', nodeid)
320 self.assertEqual('test', journaltag)
321 self.assertEqual('unlink', action)
322 self.assertEqual(('issue', '1', 'fixer'), params)
324 # test disabling journalling
325 # ... get the last entry
326 time.sleep(1)
327 entry = self.db.getjournal('issue', '1')[-1]
328 (x, date_stamp, x, x, x) = entry
329 self.db.issue.disableJournalling()
330 self.db.issue.set('1', title='hello world')
331 self.db.commit()
332 entry = self.db.getjournal('issue', '1')[-1]
333 (x, date_stamp2, x, x, x) = entry
334 # see if the change was journalled when it shouldn't have been
335 self.assertEqual(date_stamp, date_stamp2)
336 self.db.issue.enableJournalling()
337 self.db.issue.set('1', title='hello world 2')
338 self.db.commit()
339 entry = self.db.getjournal('issue', '1')[-1]
340 (x, date_stamp2, x, x, x) = entry
341 # see if the change was journalled
342 self.assertNotEqual(date_stamp, date_stamp2)
344 def testPack(self):
345 self.db.issue.create(title="spam", status='1')
346 self.db.commit()
347 self.db.issue.set('1', status='2')
348 self.db.commit()
349 self.db.issue.set('1', status='3')
350 self.db.commit()
351 pack_before = date.Date(". + 1d")
352 self.db.pack(pack_before)
353 journal = self.db.getjournal('issue', '1')
354 self.assertEqual(2, len(journal))
356 def testIDGeneration(self):
357 id1 = self.db.issue.create(title="spam", status='1')
358 id2 = self.db2.issue.create(title="eggs", status='2')
359 self.assertNotEqual(id1, id2)
361 def testSearching(self):
362 self.db.file.create(content='hello', type="text/plain")
363 self.db.file.create(content='world', type="text/frozz",
364 comment='blah blah')
365 self.db.issue.create(files=['1', '2'], title="flebble plop")
366 self.db.issue.create(title="flebble frooz")
367 self.db.commit()
368 self.assertEquals(self.db.indexer.search(['hello'], self.db.issue),
369 {'1': {'files': ['1']}})
370 self.assertEquals(self.db.indexer.search(['world'], self.db.issue), {})
371 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue),
372 {'2': {}})
373 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue),
374 {'2': {}, '1': {}})
376 def testReindexing(self):
377 self.db.issue.create(title="frooz")
378 self.db.commit()
379 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue),
380 {'1': {}})
381 self.db.issue.set('1', title="dooble")
382 self.db.commit()
383 self.assertEquals(self.db.indexer.search(['dooble'], self.db.issue),
384 {'1': {}})
385 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), {})
387 def testForcedReindexing(self):
388 self.db.issue.create(title="flebble frooz")
389 self.db.commit()
390 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue),
391 {'1': {}})
392 self.db.indexer.quiet = 1
393 self.db.indexer.force_reindex()
394 self.db.post_init()
395 self.db.indexer.quiet = 9
396 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue),
397 {'1': {}})
399 class anydbmReadOnlyDBTestCase(MyTestCase):
400 def setUp(self):
401 from roundup.backends import anydbm
402 # remove previous test, ignore errors
403 if os.path.exists(config.DATABASE):
404 shutil.rmtree(config.DATABASE)
405 os.makedirs(config.DATABASE + '/files')
406 db = anydbm.Database(config, 'test')
407 setupSchema(db, 1, anydbm)
408 self.db = anydbm.Database(config)
409 setupSchema(self.db, 0, anydbm)
410 self.db2 = anydbm.Database(config, 'test')
411 setupSchema(self.db2, 0, anydbm)
413 def testExceptions(self):
414 ' make sure exceptions are raised on writes to a read-only db '
415 # this tests the exceptions that should be raised
416 ar = self.assertRaises
418 # this tests the exceptions that should be raised
419 ar(DatabaseError, self.db.status.create, name="foo")
420 ar(DatabaseError, self.db.status.set, '1', name="foo")
421 ar(DatabaseError, self.db.status.retire, '1')
424 class bsddbDBTestCase(anydbmDBTestCase):
425 def setUp(self):
426 from roundup.backends import bsddb
427 # remove previous test, ignore errors
428 if os.path.exists(config.DATABASE):
429 shutil.rmtree(config.DATABASE)
430 os.makedirs(config.DATABASE + '/files')
431 self.db = bsddb.Database(config, 'test')
432 setupSchema(self.db, 1, bsddb)
433 self.db2 = bsddb.Database(config, 'test')
434 setupSchema(self.db2, 0, bsddb)
436 class bsddbReadOnlyDBTestCase(anydbmReadOnlyDBTestCase):
437 def setUp(self):
438 from roundup.backends import bsddb
439 # remove previous test, ignore errors
440 if os.path.exists(config.DATABASE):
441 shutil.rmtree(config.DATABASE)
442 os.makedirs(config.DATABASE + '/files')
443 db = bsddb.Database(config, 'test')
444 setupSchema(db, 1, bsddb)
445 self.db = bsddb.Database(config)
446 setupSchema(self.db, 0, bsddb)
447 self.db2 = bsddb.Database(config, 'test')
448 setupSchema(self.db2, 0, bsddb)
451 class bsddb3DBTestCase(anydbmDBTestCase):
452 def setUp(self):
453 from roundup.backends import bsddb3
454 # remove previous test, ignore errors
455 if os.path.exists(config.DATABASE):
456 shutil.rmtree(config.DATABASE)
457 os.makedirs(config.DATABASE + '/files')
458 self.db = bsddb3.Database(config, 'test')
459 setupSchema(self.db, 1, bsddb3)
460 self.db2 = bsddb3.Database(config, 'test')
461 setupSchema(self.db2, 0, bsddb3)
463 class bsddb3ReadOnlyDBTestCase(anydbmReadOnlyDBTestCase):
464 def setUp(self):
465 from roundup.backends import bsddb3
466 # remove previous test, ignore errors
467 if os.path.exists(config.DATABASE):
468 shutil.rmtree(config.DATABASE)
469 os.makedirs(config.DATABASE + '/files')
470 db = bsddb3.Database(config, 'test')
471 setupSchema(db, 1, bsddb3)
472 self.db = bsddb3.Database(config)
473 setupSchema(self.db, 0, bsddb3)
474 self.db2 = bsddb3.Database(config, 'test')
475 setupSchema(self.db2, 0, bsddb3)
478 class metakitDBTestCase(anydbmDBTestCase):
479 def setUp(self):
480 from roundup.backends import metakit
481 import weakref
482 metakit._instances = weakref.WeakValueDictionary()
483 # remove previous test, ignore errors
484 if os.path.exists(config.DATABASE):
485 shutil.rmtree(config.DATABASE)
486 os.makedirs(config.DATABASE + '/files')
487 self.db = metakit.Database(config, 'test')
488 setupSchema(self.db, 1, metakit)
489 self.db2 = metakit.Database(config, 'test')
490 setupSchema(self.db2, 0, metakit)
492 def testTransactions(self):
493 # remember the number of items we started
494 num_issues = len(self.db.issue.list())
495 self.db.issue.create(title="don't commit me!", status='1')
496 self.assertNotEqual(num_issues, len(self.db.issue.list()))
497 self.db.rollback()
498 self.assertEqual(num_issues, len(self.db.issue.list()))
499 self.db.issue.create(title="please commit me!", status='1')
500 self.assertNotEqual(num_issues, len(self.db.issue.list()))
501 self.db.commit()
502 self.assertNotEqual(num_issues, len(self.db.issue.list()))
503 self.db.rollback()
504 self.assertNotEqual(num_issues, len(self.db.issue.list()))
505 self.db.file.create(name="test", type="text/plain", content="hi")
506 self.db.rollback()
507 for i in range(10):
508 self.db.file.create(name="test", type="text/plain",
509 content="hi %d"%(i))
510 self.db.commit()
511 # TODO: would be good to be able to ensure the file is not on disk after
512 # a rollback...
513 self.assertNotEqual(num_files, num_files2)
514 self.db.file.create(name="test", type="text/plain", content="hi")
515 self.db.rollback()
517 class metakitReadOnlyDBTestCase(anydbmReadOnlyDBTestCase):
518 def setUp(self):
519 from roundup.backends import metakit
520 import weakref
521 metakit._instances = weakref.WeakValueDictionary()
522 # remove previous test, ignore errors
523 if os.path.exists(config.DATABASE):
524 shutil.rmtree(config.DATABASE)
525 os.makedirs(config.DATABASE + '/files')
526 db = metakit.Database(config, 'test')
527 setupSchema(db, 1, metakit)
528 self.db = metakit.Database(config)
529 setupSchema(self.db, 0, metakit)
530 self.db2 = metakit.Database(config, 'test')
531 setupSchema(self.db2, 0, metakit)
533 def suite():
534 l = [
535 unittest.makeSuite(anydbmDBTestCase, 'test'),
536 unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test')
537 ]
538 # return unittest.TestSuite(l)
540 try:
541 import bsddb
542 l.append(unittest.makeSuite(bsddbDBTestCase, 'test'))
543 l.append(unittest.makeSuite(bsddbReadOnlyDBTestCase, 'test'))
544 except:
545 print 'bsddb module not found, skipping bsddb DBTestCase'
547 try:
548 import bsddb3
549 l.append(unittest.makeSuite(bsddb3DBTestCase, 'test'))
550 l.append(unittest.makeSuite(bsddb3ReadOnlyDBTestCase, 'test'))
551 except:
552 print 'bsddb3 module not found, skipping bsddb3 DBTestCase'
554 try:
555 import metakit
556 l.append(unittest.makeSuite(metakitDBTestCase, 'test'))
557 l.append(unittest.makeSuite(metakitReadOnlyDBTestCase, 'test'))
558 except:
559 print 'metakit module not found, skipping metakit DBTestCase'
561 return unittest.TestSuite(l)
563 #
564 # $Log: not supported by cvs2svn $
565 # Revision 1.33 2002/07/18 11:50:58 richard
566 # added tests for number type too
567 #
568 # Revision 1.32 2002/07/18 11:41:10 richard
569 # added tests for boolean type, and fixes to anydbm backend
570 #
571 # Revision 1.31 2002/07/14 23:17:45 richard
572 # minor change to make testing easier
573 #
574 # Revision 1.30 2002/07/14 06:06:34 richard
575 # Did some old TODOs
576 #
577 # Revision 1.29 2002/07/14 04:03:15 richard
578 # Implemented a switch to disable journalling for a Class. CGI session
579 # database now uses it.
580 #
581 # Revision 1.28 2002/07/14 02:16:29 richard
582 # Fixes for the metakit backend (removed the cut-n-paste IssueClass, removed
583 # a special case for it in testing)
584 #
585 # Revision 1.27 2002/07/14 02:05:54 richard
586 # . all storage-specific code (ie. backend) is now implemented by the backends
587 #
588 # Revision 1.26 2002/07/11 01:11:03 richard
589 # Added metakit backend to the db tests and fixed the more easily fixable test
590 # failures.
591 #
592 # Revision 1.25 2002/07/09 04:19:09 richard
593 # Added reindex command to roundup-admin.
594 # Fixed reindex on first access.
595 # Also fixed reindexing of entries that change.
596 #
597 # Revision 1.24 2002/07/09 03:02:53 richard
598 # More indexer work:
599 # - all String properties may now be indexed too. Currently there's a bit of
600 # "issue" specific code in the actual searching which needs to be
601 # addressed. In a nutshell:
602 # + pass 'indexme="yes"' as a String() property initialisation arg, eg:
603 # file = FileClass(db, "file", name=String(), type=String(),
604 # comment=String(indexme="yes"))
605 # + the comment will then be indexed and be searchable, with the results
606 # related back to the issue that the file is linked to
607 # - as a result of this work, the FileClass has a default MIME type that may
608 # be overridden in a subclass, or by the use of a "type" property as is
609 # done in the default templates.
610 # - the regeneration of the indexes (if necessary) is done once the schema is
611 # set up in the dbinit.
612 #
613 # Revision 1.23 2002/06/20 23:51:48 richard
614 # Cleaned up the hyperdb tests
615 #
616 # Revision 1.22 2002/05/21 05:52:11 richard
617 # Well whadya know, bsddb3 works again.
618 # The backend is implemented _exactly_ the same as bsddb - so there's no
619 # using its transaction or locking support. It'd be nice to use those some
620 # day I suppose.
621 #
622 # Revision 1.21 2002/04/15 23:25:15 richard
623 # . node ids are now generated from a lockable store - no more race conditions
624 #
625 # We're using the portalocker code by Jonathan Feinberg that was contributed
626 # to the ASPN Python cookbook. This gives us locking across Unix and Windows.
627 #
628 # Revision 1.20 2002/04/03 05:54:31 richard
629 # Fixed serialisation problem by moving the serialisation step out of the
630 # hyperdb.Class (get, set) into the hyperdb.Database.
631 #
632 # Also fixed htmltemplate after the showid changes I made yesterday.
633 #
634 # Unit tests for all of the above written.
635 #
636 # Revision 1.19 2002/02/25 14:34:31 grubert
637 # . use blobfiles in back_anydbm which is used in back_bsddb.
638 # change test_db as dirlist does not work for subdirectories.
639 # ATTENTION: blobfiles now creates subdirectories for files.
640 #
641 # Revision 1.18 2002/01/22 07:21:13 richard
642 # . fixed back_bsddb so it passed the journal tests
643 #
644 # ... it didn't seem happy using the back_anydbm _open method, which is odd.
645 # Yet another occurrance of whichdb not being able to recognise older bsddb
646 # databases. Yadda yadda. Made the HYPERDBDEBUG stuff more sane in the
647 # process.
648 #
649 # Revision 1.17 2002/01/22 05:06:09 rochecompaan
650 # We need to keep the last 'set' entry in the journal to preserve
651 # information on 'activity' for nodes.
652 #
653 # Revision 1.16 2002/01/21 16:33:20 rochecompaan
654 # You can now use the roundup-admin tool to pack the database
655 #
656 # Revision 1.15 2002/01/19 13:16:04 rochecompaan
657 # Journal entries for link and multilink properties can now be switched on
658 # or off.
659 #
660 # Revision 1.14 2002/01/16 07:02:57 richard
661 # . lots of date/interval related changes:
662 # - more relaxed date format for input
663 #
664 # Revision 1.13 2002/01/14 02:20:15 richard
665 # . changed all config accesses so they access either the instance or the
666 # config attriubute on the db. This means that all config is obtained from
667 # instance_config instead of the mish-mash of classes. This will make
668 # switching to a ConfigParser setup easier too, I hope.
669 #
670 # At a minimum, this makes migration a _little_ easier (a lot easier in the
671 # 0.5.0 switch, I hope!)
672 #
673 # Revision 1.12 2001/12/17 03:52:48 richard
674 # Implemented file store rollback. As a bonus, the hyperdb is now capable of
675 # storing more than one file per node - if a property name is supplied,
676 # the file is called designator.property.
677 # I decided not to migrate the existing files stored over to the new naming
678 # scheme - the FileClass just doesn't specify the property name.
679 #
680 # Revision 1.11 2001/12/10 23:17:20 richard
681 # Added transaction tests to test_db
682 #
683 # Revision 1.10 2001/12/03 21:33:39 richard
684 # Fixes so the tests use commit and not close
685 #
686 # Revision 1.9 2001/12/02 05:06:16 richard
687 # . We now use weakrefs in the Classes to keep the database reference, so
688 # the close() method on the database is no longer needed.
689 # I bumped the minimum python requirement up to 2.1 accordingly.
690 # . #487480 ] roundup-server
691 # . #487476 ] INSTALL.txt
692 #
693 # I also cleaned up the change message / post-edit stuff in the cgi client.
694 # There's now a clearly marked "TODO: append the change note" where I believe
695 # the change note should be added there. The "changes" list will obviously
696 # have to be modified to be a dict of the changes, or somesuch.
697 #
698 # More testing needed.
699 #
700 # Revision 1.8 2001/10/09 07:25:59 richard
701 # Added the Password property type. See "pydoc roundup.password" for
702 # implementation details. Have updated some of the documentation too.
703 #
704 # Revision 1.7 2001/08/29 06:23:59 richard
705 # Disabled the bsddb3 module entirely in the unit testing. See CHANGES for
706 # details.
707 #
708 # Revision 1.6 2001/08/07 00:24:43 richard
709 # stupid typo
710 #
711 # Revision 1.5 2001/08/07 00:15:51 richard
712 # Added the copyright/license notice to (nearly) all files at request of
713 # Bizar Software.
714 #
715 # Revision 1.4 2001/07/30 03:45:56 richard
716 # Added more DB to test_db. Can skip tests where imports fail.
717 #
718 # Revision 1.3 2001/07/29 07:01:39 richard
719 # Added vim command to all source so that we don't get no steenkin' tabs :)
720 #
721 # Revision 1.2 2001/07/29 04:09:20 richard
722 # Added the fabricated property "id" to all hyperdb classes.
723 #
724 # Revision 1.1 2001/07/27 06:55:07 richard
725 # moving tests -> test
726 #
727 # Revision 1.7 2001/07/27 06:26:43 richard
728 # oops - wasn't deleting the test dir after the read-only tests
729 #
730 # Revision 1.6 2001/07/27 06:23:59 richard
731 # consistency
732 #
733 # Revision 1.5 2001/07/27 06:23:09 richard
734 # Added some new hyperdb tests to make sure we raise the right exceptions.
735 #
736 # Revision 1.4 2001/07/25 04:34:31 richard
737 # Added id and log to tests files...
738 #
739 #
740 # vim: set filetype=python ts=4 sw=4 et si