Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
4fc8acbd
Commit
4fc8acbd
authored
Apr 11, 2001
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test for multiple undos in the same transaction.
parent
b39c26bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
1 deletion
+53
-1
src/ZODB/tests/TransactionalUndoStorage.py
src/ZODB/tests/TransactionalUndoStorage.py
+53
-1
No files found.
src/ZODB/tests/TransactionalUndoStorage.py
View file @
4fc8acbd
...
@@ -102,7 +102,59 @@ class TransactionalUndoStorage(BasicStorage.BasicStorage):
...
@@ -102,7 +102,59 @@ class TransactionalUndoStorage(BasicStorage.BasicStorage):
data
,
revid2
=
self
.
_storage
.
load
(
oid2
,
''
)
data
,
revid2
=
self
.
_storage
.
load
(
oid2
,
''
)
assert
pickle
.
loads
(
data
)
==
51
assert
pickle
.
loads
(
data
)
==
51
def
_checkTwoObjectUndoAgain
(
self
):
def
checkTwoObjectUndoAtOnce
(
self
):
# Convenience
p30
,
p31
,
p32
,
p50
,
p51
,
p52
=
map
(
pickle
.
dumps
,
(
30
,
31
,
32
,
50
,
51
,
52
))
oid1
=
self
.
_storage
.
new_oid
()
oid2
=
self
.
_storage
.
new_oid
()
revid1
=
revid2
=
ZERO
# Store two objects in the same transaction
self
.
_storage
.
tpc_begin
(
self
.
_transaction
)
revid1
=
self
.
_storage
.
store
(
oid1
,
revid1
,
p30
,
''
,
self
.
_transaction
)
revid2
=
self
.
_storage
.
store
(
oid2
,
revid2
,
p50
,
''
,
self
.
_transaction
)
# Finish the transaction
self
.
_storage
.
tpc_vote
(
self
.
_transaction
)
self
.
_storage
.
tpc_finish
(
self
.
_transaction
)
assert
revid1
==
revid2
# Update those same two objects
self
.
_storage
.
tpc_begin
(
self
.
_transaction
)
revid1
=
self
.
_storage
.
store
(
oid1
,
revid1
,
p31
,
''
,
self
.
_transaction
)
revid2
=
self
.
_storage
.
store
(
oid2
,
revid2
,
p51
,
''
,
self
.
_transaction
)
# Finish the transaction
self
.
_storage
.
tpc_vote
(
self
.
_transaction
)
self
.
_storage
.
tpc_finish
(
self
.
_transaction
)
# Update those same two objects
self
.
_storage
.
tpc_begin
(
self
.
_transaction
)
revid1
=
self
.
_storage
.
store
(
oid1
,
revid1
,
p32
,
''
,
self
.
_transaction
)
revid2
=
self
.
_storage
.
store
(
oid2
,
revid2
,
p52
,
''
,
self
.
_transaction
)
# Finish the transaction
self
.
_storage
.
tpc_vote
(
self
.
_transaction
)
self
.
_storage
.
tpc_finish
(
self
.
_transaction
)
assert
revid1
==
revid2
# Make sure the objects have the current value
data
,
revid1
=
self
.
_storage
.
load
(
oid1
,
''
)
assert
pickle
.
loads
(
data
)
==
32
data
,
revid2
=
self
.
_storage
.
load
(
oid2
,
''
)
assert
pickle
.
loads
(
data
)
==
52
# Now attempt to undo the transaction containing two objects
info
=
self
.
_storage
.
undoInfo
()
tid
=
info
[
0
][
'id'
]
tid1
=
info
[
1
][
'id'
]
self
.
_storage
.
tpc_begin
(
self
.
_transaction
)
oids
=
self
.
_storage
.
transactionalUndo
(
tid
,
self
.
_transaction
)
oids1
=
self
.
_storage
.
transactionalUndo
(
tid1
,
self
.
_transaction
)
self
.
_storage
.
tpc_vote
(
self
.
_transaction
)
self
.
_storage
.
tpc_finish
(
self
.
_transaction
)
assert
len
(
oids
)
==
2
assert
len
(
oids1
)
==
2
assert
oid1
in
oids
and
oid2
in
oids
data
,
revid1
=
self
.
_storage
.
load
(
oid1
,
''
)
assert
pickle
.
loads
(
data
)
==
30
data
,
revid2
=
self
.
_storage
.
load
(
oid2
,
''
)
assert
pickle
.
loads
(
data
)
==
50
def
checkTwoObjectUndoAgain
(
self
):
p32
,
p33
,
p52
,
p53
=
map
(
pickle
.
dumps
,
(
32
,
33
,
52
,
53
))
p32
,
p33
,
p52
,
p53
=
map
(
pickle
.
dumps
,
(
32
,
33
,
52
,
53
))
# Like the above, but the first revision of the objects are stored in
# Like the above, but the first revision of the objects are stored in
# different transactions.
# different transactions.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment