本文整理汇总了Python中mpx.service.subscription_manager.SUBSCRIPTION_MANAGER.node_reference_table方法的典型用法代码示例。如果您正苦于以下问题:Python SUBSCRIPTION_MANAGER.node_reference_table方法的具体用法?Python SUBSCRIPTION_MANAGER.node_reference_table怎么用?Python SUBSCRIPTION_MANAGER.node_reference_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpx.service.subscription_manager.SUBSCRIPTION_MANAGER
的用法示例。
在下文中一共展示了SUBSCRIPTION_MANAGER.node_reference_table方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_empty
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import node_reference_table [as 别名]
def test_empty(self):
sid = SUBSCRIPTION_MANAGER.create_polled(self.nrt1to4)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != self.nrt1to4:
raise "Initial node reference table mismatch."
SUBSCRIPTION_MANAGER.empty(sid)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != {}:
raise "Node reference table not empty."
return
示例2: test_replace
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import node_reference_table [as 别名]
def test_replace(self):
sid = SUBSCRIPTION_MANAGER.create_polled(self.nrt1to2)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != self.nrt1to2:
raise "Initial node reference table mismatch."
SUBSCRIPTION_MANAGER.replace(sid, self.nrt3to4)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != self.nrt3to4:
raise "Replaced node reference table mismatch."
return
示例3: test_poll_all
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import node_reference_table [as 别名]
def test_poll_all(self):
sid = SUBSCRIPTION_MANAGER.create_polled(self.nrt1to4)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != self.nrt1to4:
raise "Initial node reference table mismatch."
# Check that each invokation gets all values.
for i in range(0,10):
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
if len(all_values) != len(self.nrt1to4):
# We did not get all 4 values!
raise (
"poll_all(self.nrt1to4) did not return all values."
" (%d out of %d)" % (len(all_values),len(self.nrt1to4))
)
# Check that (eventually) all the values are result dictionaries.
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
t1 = time.time()
while (time.time() - t1) < 1.0:
if None not in all_values.values():
return
time.sleep(0.1)
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
if None in all_values.values():
raise (
"Never got changes for all four result dictionaries, %d." %
len(all_values)
)
return
示例4: test_modify
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import node_reference_table [as 别名]
def test_modify(self):
sid = SUBSCRIPTION_MANAGER.create_polled(self.nrt1to2)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != self.nrt1to2:
raise "Initial node reference table mismatch."
SUBSCRIPTION_MANAGER.modify(sid, self.ID2, self.ID3)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt == self.nrt1to2:
raise "Modified node reference table not modified."
if nrt != {self.ID1:self.ID1,self.ID2:self.ID3}:
raise "Modified node reference table mismatch."
try:
SUBSCRIPTION_MANAGER.modify(sid, self.ID3, self.ID2)
except ENoSuchNodeID:
pass
else:
raise "No such NodeID not detected."
return
示例5: test_remove
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import node_reference_table [as 别名]
def test_remove(self):
sid = SUBSCRIPTION_MANAGER.create_polled(self.nrt1to4)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != self.nrt1to4:
raise "Initial node reference table mismatch."
SUBSCRIPTION_MANAGER.remove(sid, self.ID2)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
nrt134 = {}
nrt134.update(self.nrt1to4)
del nrt134[self.ID2]
if nrt != nrt134:
raise "Node reference table mismatch."
try:
SUBSCRIPTION_MANAGER.remove(sid, self.ID2)
except ENoSuchNodeID:
pass
else:
raise "No such NodeID not detected."
return
示例6: test_add
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import node_reference_table [as 别名]
def test_add(self):
sid = SUBSCRIPTION_MANAGER.create_polled(self.nrt1to2)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != self.nrt1to2:
raise "Initial node reference table mismatch."
SUBSCRIPTION_MANAGER.add(sid, self.ID5, self.ID5)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
nrt125 = {}
nrt125.update(self.nrt1to2)
nrt125[self.ID5] = self.ID5
if nrt != nrt125:
raise "Node reference table mismatch."
try:
SUBSCRIPTION_MANAGER.add(sid, self.ID5, self.ID5)
except ENodeIDExists:
pass
else:
raise "Node ID in use not detected."
return
示例7: test_poll_changed
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import node_reference_table [as 别名]
def test_poll_changed(self):
sid = SUBSCRIPTION_MANAGER.create_polled(self.nrt1to4)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != self.nrt1to4:
raise "Initial node reference table mismatch."
all_values = {}
time.sleep(0.1)
t1 = time.time()
while (time.time() - t1) < 1.0:
time.sleep(0.1)
changed_values = SUBSCRIPTION_MANAGER.poll_changed(sid)
all_values.update(changed_values)
if len(all_values) == 4:
# We got all 4 values!
return
raise "Never got changes for all four values, %d." % len(all_values)
return
示例8: test_poll_all_plus_exceptions
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import node_reference_table [as 别名]
def test_poll_all_plus_exceptions(self):
SUBSCRIPTION_MANAGER._set_tunable_parameters({
'minimum_poll_interval':0.0,
})
nrt1to4bad5to6 = {}
nrt1to4bad5to6.update(self.nrt1to4)
nrt1to4bad5to6['/services/time/is/an/illusion'] = (
'/services/time/is/an/illusion'
)
nrt1to4bad5to6['/services/exception'] = '/services/exception'
sid = SUBSCRIPTION_MANAGER.create_polled(nrt1to4bad5to6)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != nrt1to4bad5to6:
raise "Initial node reference table mismatch."
# Check that each invokation gets all values.
for i in range(0,10):
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
if len(all_values) != len(nrt1to4bad5to6):
# We did not get all 4 values!
raise (
"poll_all(self.nrt1to4) did not return all values."
" (%d out of %d)" % (len(all_values),len(nrt1to4bad5to6))
)
# Check that (eventually) all the values are result dictionaries.
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
t1 = time.time()
while (time.time() - t1) < 1.0:
if None not in all_values.values():
self.__all_plus_exceptions_check(all_values)
# Finally, test that a new subscription gets the correct
# results.
time.sleep(0.1)
sid = SUBSCRIPTION_MANAGER.create_polled(nrt1to4bad5to6)
time.sleep(0.1)
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
self.__all_plus_exceptions_check(all_values)
time.sleep(0.1)
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
self.__all_plus_exceptions_check(all_values)
return
time.sleep(0.1)
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
if None in all_values.values():
raise ("Never got values for all nodes: %r." % all_values)
return
示例9: test_create_delivered
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import node_reference_table [as 别名]
def test_create_delivered(self):
sid = SUBSCRIPTION_MANAGER.create_delivered(self, self.nrt1to4)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != self.nrt1to4:
raise "Initial node reference table mismatch."
time.sleep(0.1)
t1 = time.time()
while (time.time() - t1) < 1.0:
self.__event_lock.acquire()
try:
if len(self.__event_updated_values) == 4:
# We got all 4 values!
return
finally:
self.__event_lock.release()
time.sleep(0.1)
if len(self.__event_updated_values) != 4:
raise (("Never got changes for all four values, only %d.\n"
"Values: %r") % (len(self.__event_updated_values),
self.__event_updated_values))
示例10: test_node_reference_table
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import node_reference_table [as 别名]
def test_node_reference_table(self):
sid = SUBSCRIPTION_MANAGER.create_polled(self.nrt1to2)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != self.nrt1to2:
raise "Node reference table mismatch."
return