Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
e28c9b79
Commit
e28c9b79
authored
May 10, 2009
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Launchpad #373583: ZODBMountPoint - fixed broken mount support and
extended the test suite.
parent
58a636c3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
10 deletions
+55
-10
doc/CHANGES.rst
doc/CHANGES.rst
+3
-0
src/Products/ZODBMountPoint/MountedObject.py
src/Products/ZODBMountPoint/MountedObject.py
+1
-3
src/Products/ZODBMountPoint/tests/testMountPoint.py
src/Products/ZODBMountPoint/tests/testMountPoint.py
+51
-7
No files found.
doc/CHANGES.rst
View file @
e28c9b79
...
@@ -23,6 +23,9 @@ Restructuring
...
@@ -23,6 +23,9 @@ Restructuring
Features Added
Features Added
++++++++++++++
++++++++++++++
- Launchpad #373583: ZODBMountPoint - fixed broken mount support and
extended the test suite.
- Launchpad #373621: catching and logging exceptions that could cause
- Launchpad #373621: catching and logging exceptions that could cause
leaking of worker threads.
leaking of worker threads.
...
...
src/Products/ZODBMountPoint/MountedObject.py
View file @
e28c9b79
...
@@ -59,9 +59,7 @@ class SimpleTrailblazer:
...
@@ -59,9 +59,7 @@ class SimpleTrailblazer:
factory
=
guarded_getattr
(
dispatcher
,
'manage_addFolder'
)
factory
=
guarded_getattr
(
dispatcher
,
'manage_addFolder'
)
factory
(
id
)
factory
(
id
)
o
=
context
.
restrictedTraverse
(
id
)
o
=
context
.
restrictedTraverse
(
id
)
# Commit a subtransaction to assign the new object to
context
.
_p_jar
.
add
(
o
.
aq_base
)
# the correct database.
transaction
.
savepoint
(
optimistic
=
True
)
return
o
return
o
def
traverseOrConstruct
(
self
,
path
,
omit_final
=
0
):
def
traverseOrConstruct
(
self
,
path
,
omit_final
=
0
):
...
...
src/Products/ZODBMountPoint/tests/testMountPoint.py
View file @
e28c9b79
...
@@ -83,6 +83,7 @@ class MountingTests(unittest.TestCase):
...
@@ -83,6 +83,7 @@ class MountingTests(unittest.TestCase):
databases
=
[
TestDBConfig
(
'test_main.fs'
,
[
'/'
]).
getDB
(),
databases
=
[
TestDBConfig
(
'test_main.fs'
,
[
'/'
]).
getDB
(),
TestDBConfig
(
'test_mount1.fs'
,
[
'/mount1'
]).
getDB
(),
TestDBConfig
(
'test_mount1.fs'
,
[
'/mount1'
]).
getDB
(),
TestDBConfig
(
'test_mount2.fs'
,
[
'/mount2'
]).
getDB
(),
TestDBConfig
(
'test_mount2.fs'
,
[
'/mount2'
]).
getDB
(),
TestDBConfig
(
'test_mount3.fs'
,
[
'/i/mount3'
]).
getDB
(),
]
]
mount_points
=
{}
mount_points
=
{}
mount_factories
=
{}
mount_factories
=
{}
...
@@ -102,13 +103,21 @@ class MountingTests(unittest.TestCase):
...
@@ -102,13 +103,21 @@ class MountingTests(unittest.TestCase):
root
=
conn
.
root
()
root
=
conn
.
root
()
root
[
'Application'
]
=
app
=
Application
()
root
[
'Application'
]
=
app
=
Application
()
self
.
app
=
app
self
.
app
=
app
install_products
(
app
,
'ZCatalog'
,
'PluginIndexes'
,
'OFSP'
)
# login
from
AccessControl.User
import
system
from
AccessControl.SecurityManagement
import
newSecurityManager
newSecurityManager
(
None
,
system
)
transaction
.
commit
()
# Get app._p_jar set
transaction
.
commit
()
# Get app._p_jar set
manage_addMounts
(
app
,
(
'/mount1'
,
'/mount2'
))
manage_addMounts
(
app
,
(
'/mount1'
,
'/mount2'
,
'/i/mount3'
))
transaction
.
commit
()
# Get the mount points ready
transaction
.
commit
()
# Get the mount points ready
def
tearDown
(
self
):
def
tearDown
(
self
):
# logout
from
AccessControl.SecurityManagement
import
noSecurityManager
noSecurityManager
()
App
.
config
.
setConfiguration
(
original_config
)
App
.
config
.
setConfiguration
(
original_config
)
transaction
.
abort
()
transaction
.
abort
()
self
.
app
.
_p_jar
.
close
()
self
.
app
.
_p_jar
.
close
()
...
@@ -120,6 +129,7 @@ class MountingTests(unittest.TestCase):
...
@@ -120,6 +129,7 @@ class MountingTests(unittest.TestCase):
def
testRead
(
self
):
def
testRead
(
self
):
self
.
assertEqual
(
self
.
app
.
mount1
.
id
,
'mount1'
)
self
.
assertEqual
(
self
.
app
.
mount1
.
id
,
'mount1'
)
self
.
assertEqual
(
self
.
app
.
mount2
.
id
,
'mount2'
)
self
.
assertEqual
(
self
.
app
.
mount2
.
id
,
'mount2'
)
self
.
assertEqual
(
self
.
app
.
i
.
mount3
.
id
,
'mount3'
)
def
testWrite
(
self
):
def
testWrite
(
self
):
app
=
self
.
app
app
=
self
.
app
...
@@ -144,6 +154,7 @@ class MountingTests(unittest.TestCase):
...
@@ -144,6 +154,7 @@ class MountingTests(unittest.TestCase):
self
.
assertEqual
(
getMountPoint
(
self
.
app
.
mount1
).
_path
,
'/mount1'
)
self
.
assertEqual
(
getMountPoint
(
self
.
app
.
mount1
).
_path
,
'/mount1'
)
self
.
assert_
(
getMountPoint
(
self
.
app
.
mount2
)
is
not
None
)
self
.
assert_
(
getMountPoint
(
self
.
app
.
mount2
)
is
not
None
)
self
.
assertEqual
(
getMountPoint
(
self
.
app
.
mount2
).
_path
,
'/mount2'
)
self
.
assertEqual
(
getMountPoint
(
self
.
app
.
mount2
).
_path
,
'/mount2'
)
self
.
assertEqual
(
getMountPoint
(
self
.
app
.
i
.
mount3
).
_path
,
'/i/mount3'
)
del
self
.
app
.
mount2
del
self
.
app
.
mount2
self
.
app
.
mount2
=
Folder
()
self
.
app
.
mount2
=
Folder
()
self
.
app
.
mount2
.
id
=
'mount2'
self
.
app
.
mount2
.
id
=
'mount2'
...
@@ -160,8 +171,13 @@ class MountingTests(unittest.TestCase):
...
@@ -160,8 +171,13 @@ class MountingTests(unittest.TestCase):
{
'status'
:
'Ok'
,
{
'status'
:
'Ok'
,
'path'
:
'/mount2'
,
'path'
:
'/mount2'
,
'name'
:
'test_mount2.fs'
,
'name'
:
'test_mount2.fs'
,
'exists'
:
1
}]
'exists'
:
1
},
self
.
assertEqual
(
expected
,
status
)
{
'status'
:
'Ok'
,
'path'
:
'/i/mount3'
,
'name'
:
'test_mount3.fs'
,
'exists'
:
1
},
]
self
.
assertEqual
(
sorted
(
expected
),
sorted
(
status
))
del
self
.
app
.
mount2
del
self
.
app
.
mount2
status
=
manage_getMountStatus
(
self
.
app
)
status
=
manage_getMountStatus
(
self
.
app
)
expected
=
[{
'status'
:
'Ok'
,
expected
=
[{
'status'
:
'Ok'
,
...
@@ -171,8 +187,14 @@ class MountingTests(unittest.TestCase):
...
@@ -171,8 +187,14 @@ class MountingTests(unittest.TestCase):
{
'status'
:
'Ready to create'
,
{
'status'
:
'Ready to create'
,
'path'
:
'/mount2'
,
'path'
:
'/mount2'
,
'name'
:
'test_mount2.fs'
,
'name'
:
'test_mount2.fs'
,
'exists'
:
0
}]
'exists'
:
0
},
self
.
assertEqual
(
expected
,
status
)
{
'status'
:
'Ok'
,
'path'
:
'/i/mount3'
,
'name'
:
'test_mount3.fs'
,
'exists'
:
1
},
]
self
.
assertEqual
(
sorted
(
expected
),
sorted
(
status
))
self
.
app
.
mount2
=
Folder
(
'mount2'
)
self
.
app
.
mount2
=
Folder
(
'mount2'
)
status
=
manage_getMountStatus
(
self
.
app
)
status
=
manage_getMountStatus
(
self
.
app
)
expected
=
[{
'status'
:
'Ok'
,
expected
=
[{
'status'
:
'Ok'
,
...
@@ -182,8 +204,13 @@ class MountingTests(unittest.TestCase):
...
@@ -182,8 +204,13 @@ class MountingTests(unittest.TestCase):
{
'status'
:
'** Something is in the way **'
,
{
'status'
:
'** Something is in the way **'
,
'path'
:
'/mount2'
,
'path'
:
'/mount2'
,
'name'
:
'test_mount2.fs'
,
'name'
:
'test_mount2.fs'
,
'exists'
:
1
}]
'exists'
:
1
},
self
.
assertEqual
(
expected
,
status
)
{
'status'
:
'Ok'
,
'path'
:
'/i/mount3'
,
'name'
:
'test_mount3.fs'
,
'exists'
:
1
},
]
self
.
assertEqual
(
sorted
(
expected
),
sorted
(
status
))
def
test_close
(
self
):
def
test_close
(
self
):
app
=
self
.
app
app
=
self
.
app
...
@@ -192,6 +219,7 @@ class MountingTests(unittest.TestCase):
...
@@ -192,6 +219,7 @@ class MountingTests(unittest.TestCase):
app
.
a3
=
'3'
app
.
a3
=
'3'
conn1
=
app
.
mount1
.
_p_jar
conn1
=
app
.
mount1
.
_p_jar
conn2
=
app
.
mount2
.
_p_jar
conn2
=
app
.
mount2
.
_p_jar
conn3
=
app
.
i
.
mount3
.
_p_jar
transaction
.
abort
()
transaction
.
abort
()
# Close the main connection
# Close the main connection
app
.
_p_jar
.
close
()
app
.
_p_jar
.
close
()
...
@@ -199,6 +227,22 @@ class MountingTests(unittest.TestCase):
...
@@ -199,6 +227,22 @@ class MountingTests(unittest.TestCase):
# Check that secondary connections have been closed too
# Check that secondary connections have been closed too
self
.
assertEqual
(
conn1
.
opened
,
None
)
self
.
assertEqual
(
conn1
.
opened
,
None
)
self
.
assertEqual
(
conn2
.
opened
,
None
)
self
.
assertEqual
(
conn2
.
opened
,
None
)
self
.
assertEqual
(
conn3
.
opened
,
None
)
def
install_products
(
app
,
*
prod
):
"""auxiliary function to install products *prod* (by names)."""
from
OFS.Application
import
get_folder_permissions
,
get_products
,
install_product
folder_permissions
=
get_folder_permissions
()
meta_types
=
[]
done
=
{}
products
=
get_products
()
for
priority
,
product_name
,
index
,
product_dir
in
products
:
if
product_name
not
in
prod
or
product_name
in
done
:
continue
done
[
product_name
]
=
1
install_product
(
app
,
product_dir
,
product_name
,
meta_types
,
folder_permissions
,
raise_exc
=
True
)
def
test_suite
():
def
test_suite
():
...
...
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