本文整理汇总了Python中zato.server.base.parallel.ParallelServer.invoke_startup_services方法的典型用法代码示例。如果您正苦于以下问题:Python ParallelServer.invoke_startup_services方法的具体用法?Python ParallelServer.invoke_startup_services怎么用?Python ParallelServer.invoke_startup_services使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zato.server.base.parallel.ParallelServer
的用法示例。
在下文中一共展示了ParallelServer.invoke_startup_services方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__startup_services
# 需要导入模块: from zato.server.base.parallel import ParallelServer [as 别名]
# 或者: from zato.server.base.parallel.ParallelServer import invoke_startup_services [as 别名]
def test__startup_services(self):
class FakeBrokerClient(object):
def __init__(self):
self.messages = {}
def invoke_async(self, msg):
self.messages[msg['service']] = msg
broker_client = FakeBrokerClient()
startup_services = Bunch()
for x in range(10):
name = rand_string()
payload = rand_string()
startup_services[name] = payload
ps = ParallelServer()
ps.broker_client = broker_client
ps.fs_server_config = Bunch()
ps.fs_server_config.startup_services = startup_services
ps.invoke_startup_services()
for expected_service, expected_payload in startup_services.items():
msg = Bunch(broker_client.messages[expected_service])
eq_(msg.action, SERVICE.PUBLISH)
eq_(msg.channel, CHANNEL.STARTUP_SERVICE)
eq_(msg.payload, expected_payload)
eq_(msg.service, expected_service)
ok_(msg.cid.startswith('K'))
self.assertEquals(len(msg.cid), 40)