root/trunk/bknr/datastore/src/data/tests.lisp

Revision 3942, 1.2 kB (checked in by hans, 2 months ago)

Merge from anon-transaction-fixes-2 branch. This changeset removes
make-object and initialize-persistent-instance, makes the allocation
of object IDs simpler and more safe and removes several relicts from
previous refactoring iterations. Also, the store tests have been
extended significantly to test pathological cases and create objects
from multiple threads.

Line 
1 ;; hier mal unit tests reintun, im moment nur rumgeteste
2 (in-package :bknr.datastore)
3
4 (define-persistent-class boeses-object ()
5   ((a :read)))
6
7 (define-persistent-class foobar ()
8   ((a :read :index-type unique-index :index-values all-foobars)))
9
10 (deftransaction boese-tx ()
11   (format t "BOESE BOESE!~%"))
12
13 (defmethod initialize-transient-instance ((boese boeses-object))
14   (boese-tx))
15
16 (make-instance 'mp-store :directory "/tmp/spackstore/"
17                          :subsystems (list (make-instance 'store-object-subsystem)))
18
19 (defmethod reinitialize-instance :around ((class persistent-class) &rest args)
20   (declare (ignore args))
21   (format t "reinit~%")
22   (call-next-method))
23
24 ;;; muesste fehler werfen weil transaction in initialize-transient-instance
25 (make-instance 'boeses-object)
26
27 (make-instance 'foobar :a 2)
28
29 ;;; jetzt foobar bitte nicht mehr persistent
30 (defclass foobar ()
31   ((a :initarg :a :reader foobar-a)))
32
33 ;;; jetzt muesste foobar ID:2 nicht mehr in all-store-objects drin
34 ;;; sein, soll das destroyed werden?
35
36 (define-persistent-class foobar ()
37   ((a :read :index-type unique-index :index-values all-foobars)))
38
39 (define-persistent-class foobar ()
40   ((a :read :index-type unique-index :index-values all-foobars)
41    (b :read :initform t)))
Note: See TracBrowser for help on using the browser.