Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
neoppod
Commits
ba45542e
Commit
ba45542e
authored
Jan 18, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: minor improvements/cleanup/fixes to threaded.__init__
parent
09782dd8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
9 deletions
+29
-9
neo/tests/threaded/__init__.py
neo/tests/threaded/__init__.py
+29
-9
No files found.
neo/tests/threaded/__init__.py
View file @
ba45542e
...
@@ -182,6 +182,11 @@ class ServerNode(Node):
...
@@ -182,6 +182,11 @@ class ServerNode(Node):
LOCAL_IP
[:
-
1
]
+
chr
(
2
+
len
(
cls
.
_server_class_dict
)))
LOCAL_IP
[:
-
1
]
+
chr
(
2
+
len
(
cls
.
_server_class_dict
)))
cls
.
_server_class_dict
[
cls
.
_virtual_ip
]
=
cls
cls
.
_server_class_dict
[
cls
.
_virtual_ip
]
=
cls
@
staticmethod
def
resetPorts
():
for
cls
in
ServerNode
.
_server_class_dict
.
itervalues
():
del
cls
.
_node_list
[:]
@
classmethod
@
classmethod
def
newAddress
(
cls
):
def
newAddress
(
cls
):
address
=
cls
.
_virtual_ip
,
len
(
cls
.
_node_list
)
address
=
cls
.
_virtual_ip
,
len
(
cls
.
_node_list
)
...
@@ -242,6 +247,13 @@ class ServerNode(Node):
...
@@ -242,6 +247,13 @@ class ServerNode(Node):
except
AttributeError
:
except
AttributeError
:
pass
pass
def
stop
(
self
):
try
:
Serialized
.
release
(
stop
=
(
self
,))
self
.
join
()
finally
:
Serialized
.
acquire
()
def
getListeningAddress
(
self
):
def
getListeningAddress
(
self
):
try
:
try
:
return
self
.
listening_conn
.
getAddress
()
return
self
.
listening_conn
.
getAddress
()
...
@@ -469,8 +481,9 @@ class NEOCluster(object):
...
@@ -469,8 +481,9 @@ class NEOCluster(object):
self
.
_resource_dict
[
result
]
=
self
self
.
_resource_dict
[
result
]
=
self
return
result
[
1
]
return
result
[
1
]
def
_patch
(
cluster
):
@
staticmethod
cls
=
cluster
.
__class__
def
_patch
():
cls
=
NEOCluster
cls
.
_patch_count
+=
1
cls
.
_patch_count
+=
1
if
cls
.
_patch_count
>
1
:
if
cls
.
_patch_count
>
1
:
return
return
...
@@ -496,8 +509,9 @@ class NEOCluster(object):
...
@@ -496,8 +509,9 @@ class NEOCluster(object):
Storage
.
setupLog
=
lambda
*
args
,
**
kw
:
None
Storage
.
setupLog
=
lambda
*
args
,
**
kw
:
None
Serialized
.
init
()
Serialized
.
init
()
@
classmethod
@
staticmethod
def
_unpatch
(
cls
):
def
_unpatch
():
cls
=
NEOCluster
assert
cls
.
_patch_count
>
0
assert
cls
.
_patch_count
>
0
cls
.
_patch_count
-=
1
cls
.
_patch_count
-=
1
if
cls
.
_patch_count
:
if
cls
.
_patch_count
:
...
@@ -632,7 +646,9 @@ class NEOCluster(object):
...
@@ -632,7 +646,9 @@ class NEOCluster(object):
Serialized
.
acquire
()
Serialized
.
acquire
()
self
.
_unpatch
()
self
.
_unpatch
()
def
tic
(
self
,
force
=
False
):
@
staticmethod
def
tic
(
force
=
False
):
# XXX: Should we automatically switch client in slave mode if it isn't ?
if
force
:
if
force
:
Serialized
.
tic
()
Serialized
.
tic
()
while
Serialized
.
pending
:
while
Serialized
.
pending
:
...
@@ -655,14 +671,14 @@ class NEOCluster(object):
...
@@ -655,14 +671,14 @@ class NEOCluster(object):
self
.
client
.
setPoll
(
True
)
self
.
client
.
setPoll
(
True
)
return
Storage
.
Storage
(
None
,
self
.
name
,
_app
=
self
.
client
,
**
kw
)
return
Storage
.
Storage
(
None
,
self
.
name
,
_app
=
self
.
client
,
**
kw
)
def
populate
(
self
,
dummy_zodb
=
None
):
def
populate
(
self
,
dummy_zodb
=
None
,
random
=
random
):
if
dummy_zodb
is
None
:
if
dummy_zodb
is
None
:
from
..stat_zodb
import
PROD1
from
..stat_zodb
import
PROD1
dummy_zodb
=
PROD1
()
dummy_zodb
=
PROD1
(
random
)
importFrom
=
self
.
getZODBStorage
().
importFrom
preindex
=
{}
preindex
=
{}
as_storage
=
dummy_zodb
.
as_storage
as_storage
=
dummy_zodb
.
as_storage
return
lambda
count
:
importFrom
(
as_storage
(
count
),
preindex
=
preindex
)
return
lambda
count
:
self
.
getZODBStorage
().
importFrom
(
as_storage
(
count
),
preindex
=
preindex
)
def
getTransaction
(
self
):
def
getTransaction
(
self
):
txn
=
transaction
.
TransactionManager
()
txn
=
transaction
.
TransactionManager
()
...
@@ -690,6 +706,10 @@ class NEOThreadedTest(NeoTestBase):
...
@@ -690,6 +706,10 @@ class NEOThreadedTest(NeoTestBase):
log_file
=
os
.
path
.
join
(
getTempDirectory
(),
self
.
id
()
+
'.log'
)
log_file
=
os
.
path
.
join
(
getTempDirectory
(),
self
.
id
()
+
'.log'
)
setupLog
(
LoggerThreadName
(),
log_file
,
True
)
setupLog
(
LoggerThreadName
(),
log_file
,
True
)
def
tearDown
(
self
):
super
(
NEOThreadedTest
,
self
).
tearDown
()
ServerNode
.
resetPorts
()
def
getUnpickler
(
self
,
conn
):
def
getUnpickler
(
self
,
conn
):
reader
=
conn
.
_reader
reader
=
conn
.
_reader
def
unpickler
(
data
,
compression
=
False
):
def
unpickler
(
data
,
compression
=
False
):
...
...
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