public function setUp()
 {
     $meta_conf = new BigpipeMetaConf();
     $meta_conf->meta_host = '10.218.32.11:2181,10.218.32.20:2181,10.218.32.21:2181,10.218.32.22:2181,10.218.32.23:2181';
     $meta_conf->root_path = '/bigpipe_pvt_cluster3';
     $this->meta_params = $meta_conf->to_array();
     // 生成 zk_connection的mock实例
     $this->stub_zk = $this->getMockBuilder('ZooKeeperConnection')->disableOriginalConstructor()->getMock();
 }
 public function setUp()
 {
     $this->conf = new MetaAgentConf();
     $meta_conf = new BigpipeMetaConf();
     $this->conf->meta = $meta_conf->to_array();
     $this->conf->agents = array(array("socket_address" => "10.46.46.54", "socket_port" => 8021, "socket_timeout" => 300));
     $this->conf->conn_conf->try_time = 1;
     // 生成c_socket的一个mock实例
     $this->stub_conn = $this->getMockBuilder('BigpipeConnection')->disableOriginalConstructor()->getMock();
 }
 public function setUp()
 {
     $meta_conf = new BigpipeMetaConf();
     $meta_conf->meta_host = '10.218.32.11:2181,10.218.32.20:2181,10.218.32.21:2181,10.218.32.22:2181,10.218.32.23:2181';
     $meta_conf->root_path = '/bigpipe_pvt_cluster3';
     $this->meta_params = $meta_conf->to_array();
     $this->meta_params['zk_recv_timeout'] = 10000;
     // Éú³É zk_connectionµÄmockʵÀý
     $this->stub_zk = $this->getMockBuilder('Zookeeper')->disableOriginalConstructor()->getMock();
 }
require_once dirname(__FILE__) . '/../frame/bigpipe_configures.inc.php';
require_once dirname(__FILE__) . '/../frame/BigpipeLog.class.php';
require_once dirname(__FILE__) . '/../frame/bigpipe_utilities.inc.php';
// 初始化log配置
$log_conf = new BigpipeLogConf();
if (BigpipeLog::init($log_conf)) {
    echo '[Success] [open meta agent log]\\n';
    print_r($log_conf);
    echo '\\n';
} else {
    echo '[Failure] [open meta agent log]\\n';
    print_r($log_conf);
    echo '\\n';
}
// 准备meta agent
$meta_conf = new BigpipeMetaConf();
$meta_conf->meta_host = '10.218.32.11:2181,10.218.32.20:2181,10.218.32.21:2181,10.218.32.22:2181,10.218.32.23:2181';
$meta_conf->root_path = '/bigpipe_pvt_cluster3';
$agent_conf = new MetaAgentConf();
$agent_conf->meta = $meta_conf->to_array();
$agent_conf->agents = array(array("socket_address" => "10.46.46.54", "socket_port" => 8021, "socket_timeout" => 300));
$agent_conf->conn_conf->try_time = 1;
// 调试方便
$adapter = new MetaAgentAdapter();
if (false === $adapter->init($agent_conf)) {
    die;
}
if ($adapter->connect()) {
    echo "[Success] [connect to meta] [{$adapter->meta_name}]\n";
} else {
    echo "[Failure] [{$adapter->last_error_message}]\n";
 private function _load_meta($meta_arr)
 {
     $meta_node = new BigpipeMetaConf();
     if (false === $meta_node->load($meta_arr)) {
         BigpipeLog::fatal('[%s:%u][%s][fail to load meta "meta" in configure]', __FILE__, __LINE__, __FUNCTION__);
         return false;
     }
     $this->meta = $meta_node->to_array();
     return true;
 }