Пример #1
0
    def test_broker(self):
        ip = Configuration.getbroker()['zookeeper']['ip']
        port = Configuration.getbroker()['zookeeper']['port']
        zb = ZooBorg(ip, port)
        try:
            broker_id = 'broker_test_id'
            zb.register(ZooBorg.BROKER, broker_id, self.stubhandler)
            # conf must be updated

            # broker id must be in broker list
            cl = zb.getList(ZooBorg.BROKER)
            #print "brokerlist:",cl
            assert broker_id in cl
            #the one created here + infra broker(s)
            assert len(cl) > 1
        except:
            traceback.print_exc()
            assert 0
        finally:
            zb.unregister(ZooBorg.BROKER, broker_id)