本文整理匯總了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)