コード例 #1
0
 def setUp(self):
     pettingzoo.utils.configure_logger()
     self.mock = True
     self.conn_string = '127.0.0.1:2181'
     if self.mock:
         import zc.zk.testing
         zc.zk.testing.setUp(self, connection_string=self.conn_string)
     self.connection = connect_to_zk(self.conn_string)
     self.path = '/test_discovery'
     pettingzoo.discovery.CONFIG_PATH = self.path
     self.sample = {
         'header': {
             'service_class': 'mysql',
             'metadata': {
                 'version': 1.0
             }
         },
         'username': '******',
         'host': 'localhost',
         'port': 3306,
         'password': '******',
         'database': 'reports',
         'encoding': 'utf8'
     }
     self.sample_slash = {
         'header': {
             'service_class': 'cassandra/thrift',
             'metadata': {
                 'version': 1.0
             }
         },
         'host': 'localhost',
         'port': 9160,
     }
コード例 #2
0
	def setUp(self):
		pettingzoo.utils.configure_logger()
		self.mock = True
		self.conn_string = '127.0.0.1:2181'
		if self.mock:
			import zc.zk.testing
			zc.zk.testing.setUp(self, connection_string=self.conn_string)
		self.connection = connect_to_zk(self.conn_string)
		self.path = '/test_discovery'
		pettingzoo.discovery.CONFIG_PATH = self.path
		self.sample = {
			'header': {
				'service_class': 'mysql', 'metadata': {'version': 1.0}
			},
			'username': '******',
			'host': 'localhost',
			'port': 3306,
			'password': '******',
			'database': 'reports',
			'encoding': 'utf8'
		}
		self.sample_slash = {
			'header': {
				'service_class': 'cassandra/thrift',
				'metadata': {'version': 1.0}
			},
			'host': 'localhost',
			'port': 9160,
		}
コード例 #3
0
	def setUp(self):
		self.conn_string = '127.0.0.1:2181'
		if DO_MOCK:
			zc.zk.testing.setUp(self, connection_string=self.conn_string)
			zc.zk.testing.ZooKeeper.create = pettingzoo.testing.create
			zc.zk.testing.ZooKeeper.exists = pettingzoo.testing.exists
			zc.zk.testing.Node.deleted = pettingzoo.testing.deleted
		self.connection = connect_to_zk(self.conn_string)
		self.path = '/test_exists'
コード例 #4
0
	def tearDown(self):
		pettingzoo.discovery.CONFIG_PATH = '/discovery'
		self.connection.close()
		self.connection = connect_to_zk('127.0.0.1:2181')
		self.connection.delete_recursive(self.path)
		self.connection.close()
		if self.mock:
			import zc.zk.testing
			zc.zk.testing.tearDown(self)
コード例 #5
0
 def setUp(self):
     self.conn_string = '127.0.0.1:2181'
     if DO_MOCK:
         zc.zk.testing.setUp(self, connection_string=self.conn_string)
         zc.zk.testing.ZooKeeper.create = pettingzoo.testing.create
         zc.zk.testing.ZooKeeper.exists = pettingzoo.testing.exists
         zc.zk.testing.Node.deleted = pettingzoo.testing.deleted
     self.connection = connect_to_zk(self.conn_string)
     self.path = '/test_exists'
コード例 #6
0
 def tearDown(self):
     pettingzoo.discovery.CONFIG_PATH = '/discovery'
     self.connection.close()
     self.connection = connect_to_zk('127.0.0.1:2181')
     self.connection.delete_recursive(self.path)
     self.connection.close()
     if self.mock:
         import zc.zk.testing
         zc.zk.testing.tearDown(self)
コード例 #7
0
 def tearDown(self):
     self.connection.close()
     self.connection = connect_to_zk('127.0.0.1:2181')
     try:
         self.connection.delete_recursive(self.path)
     except zookeeper.NoNodeException:
         pass  # does not exist
     finally:
         self.connection.close()
     if self.mock:
         import zc.zk.testing
         zc.zk.testing.tearDown(self)
コード例 #8
0
	def tearDown(self):
		self.connection.close()
		self.connection = connect_to_zk('127.0.0.1:2181')
		try:
			self.connection.delete_recursive(self.path)
		except zookeeper.NoNodeException:
			pass # does not exist
		finally:
			self.connection.close()
		if DO_MOCK:
			import zc.zk.testing
			zc.zk.testing.tearDown(self)
コード例 #9
0
 def setUp(self):
     self.mock = True
     self.conn_string = '127.0.0.1:2181'
     if self.mock:
         import zc.zk.testing
         import pettingzoo.testing
         zc.zk.testing.setUp(self, connection_string=self.conn_string)
         zc.zk.testing.ZooKeeper.create = pettingzoo.testing.create
         zc.zk.testing.ZooKeeper.exists = pettingzoo.testing.exists
         zc.zk.testing.Node.deleted = pettingzoo.testing.deleted
     self.connection = connect_to_zk(self.conn_string)
     self.path = '/test_dbag'
     self.touched = False
     configure_logger()
コード例 #10
0
    def setUp(self):
        self.mock = True
        self.conn_string = "127.0.0.1:2181"
        if self.mock:
            import zc.zk.testing
            import pettingzoo.testing

            zc.zk.testing.setUp(self, connection_string=self.conn_string)
            zc.zk.testing.ZooKeeper.create = pettingzoo.testing.create
            zc.zk.testing.ZooKeeper.exists = pettingzoo.testing.exists
            zc.zk.testing.Node.deleted = pettingzoo.testing.deleted
        self.connection = connect_to_zk(self.conn_string)
        self.path = "/test_dbag"
        self.touched = False
        configure_logger()
コード例 #11
0
 def setUp(self):
     pettingzoo.utils.configure_logger()
     self.mock = True
     self.conn_string = '127.0.0.1:2181'
     if self.mock:
         import zc.zk.testing
         zc.zk.testing.setUp(self, connection_string=self.conn_string)
     self.connection = connect_to_zk(self.conn_string)
     self.path = '/test_discovery'
     pettingzoo.discovery.CONFIG_PATH = self.path
     self.sample = {
         'header': {
             'service_class': 'mysql',
             'metadata': {
                 'version': 1.0
             }
         },
         'username': '******',
         'host': 'localhost',
         'port': 3306,
         'password': '******',
         'database': 'reports',
         'encoding': 'utf8'
     }
     self.sample2 = {
         'header': {
             'service_class': 'mysql',
             'metadata': {
                 'version': 1.0
             }
         },
         'username': '******',
         'host': 'notlocalhost',
         'port': 3306,
         'password': '******',
         'database': 'reports',
         'encoding': 'utf8'
     }
     pettingzoo.local_config.LocalConfig = pettingzoo.local_config.LocalConfigTest(
     )
     pettingzoo.local_config.LocalConfig().add_config(
         self.sample, 'discovery/mysql/exist')
     self.list_sample = {'server_list': [self.sample]}
     pettingzoo.local_config.LocalConfig().add_config(
         self.list_sample, 'discovery/mysql/list')
     self.list_sample2 = {'server_list': [self.sample, self.sample2]}
     pettingzoo.local_config.LocalConfig().add_config(
         self.list_sample2, 'discovery/mysql/mlist')
コード例 #12
0
	def setUp(self):
		pettingzoo.utils.configure_logger()
		self.mock = True
		self.conn_string = '127.0.0.1:2181'
		if self.mock:
			import zc.zk.testing
			zc.zk.testing.setUp(self, connection_string=self.conn_string)
		self.connection = connect_to_zk(self.conn_string)
		self.path = '/test_discovery'
		pettingzoo.discovery.CONFIG_PATH = self.path
		self.sample = {
			'header': {
				'service_class': 'mysql', 'metadata': {'version': 1.0}
			},
			'username': '******',
			'host': 'localhost',
			'port': 3306,
			'password': '******',
			'database': 'reports',
			'encoding': 'utf8'
		}
		self.sample2 = {
			'header': {
				'service_class': 'mysql', 'metadata': {'version': 1.0}
			},
			'username': '******',
			'host': 'notlocalhost',
			'port': 3306,
			'password': '******',
			'database': 'reports',
			'encoding': 'utf8'
		}
		pettingzoo.local_config.LocalConfig = pettingzoo.local_config.LocalConfigTest()
		pettingzoo.local_config.LocalConfig().add_config(
			self.sample, 'discovery/mysql/exist')
		self.list_sample = {'server_list': [self.sample]}
		pettingzoo.local_config.LocalConfig().add_config(
			self.list_sample, 'discovery/mysql/list')
		self.list_sample2 = {'server_list': [self.sample, self.sample2]}
		pettingzoo.local_config.LocalConfig().add_config(
			self.list_sample2, 'discovery/mysql/mlist')