示例#1
0
 def test_get_value3(self):
     client = ApolloClient()
     client.init_with_conf()
     name = client.get_value(namespace='mongodb1.yaml',
                             key="name2",
                             default_val="默认值+")
     print name
示例#2
0
 def test_init1(self):
     client = ApolloClient()
     client.init_with_config(
         Config(app_id="demo",
                cluster="alpha",
                config_server_url="localhost:8080/"))
     print('\n'.join(['%s:%s' % item for item in client.__dict__.items()]))
示例#3
0
 def test_init2(self):
     client = ApolloClient()
     client.init_with_param(
         config_server_url="localhost:8080/",
         app_id="demo",
         cluster="alpha",
         timeout=62,
         env_local=False,
     )
     print('\n'.join(['%s:%s' % item for item in client.__dict__.items()]))
示例#4
0
 def test_get_config_by_namespace1(self):
     client = ApolloClient()
     client.init_with_conf()
     all_value = client.get_config_by_namespace(namespace='redis.json')
     print all_value
     self.assertEquals(
         all_value, {
             u'info': {
                 u'timeout': 60,
                 u'size': 1024
             },
             u'path': u'/usr/alphatest',
             u'enabled': True
         })
示例#5
0
 def test_get_config_by_namespace4(self):
     client = ApolloClient()
     client.init_with_conf()
     all_value = client.get_config_by_namespace(namespace='mongodb2.yaml')
     print all_value
示例#6
0
 def test_get_config_by_namespace2(self):
     client = ApolloClient()
     client.init_with_conf()
     all_value = client.get_config_by_namespace()
     print all_value
示例#7
0
 def test_init3(self):
     client = ApolloClient()
     client.init_with_conf()
     print('\n'.join(['%s:%s' % item for item in client.__dict__.items()]))
示例#8
0
 def test_stop(self):
     client = ApolloClient()
     client.init_with_conf()
     print client.config_server_url
     client.start(namespace="mongodb.yaml", func=update_oncallback)
     client.stop()
示例#9
0
 def test_start4(self):
     client = ApolloClient()
     client.init_with_conf()
     client.start(namespace="mongodb1.yaml", func=update_oncallback)
示例#10
0
 def test_start3(self):
     client = ApolloClient()
     client.init_with_conf()
     client.start(namespace="redis1.json", func=update_oncallback)
示例#11
0
 def test_start2(self):
     client = ApolloClient()
     client.init_with_conf()
     client.start(func=update_oncallback)
示例#12
0
 def test_get_value1(self):
     client = ApolloClient()
     client.init_with_conf()
     name = client.get_value(namespace='mongodb.yaml', key="name")
     print name
示例#13
0
 def test_get_value0(self):
     client = ApolloClient()
     client.init_with_conf()
     path = client.get_value(namespace="redis.json", key='path')
     print path
     self.assertEquals(path, "/usr/alphatest")
示例#14
0
 def test_get_value(self):
     client = ApolloClient()
     client.init_with_conf()
     timeout = client.get_value(key='timeout')
     self.assertEquals(timeout, 85)