echo "\n";
}
// 订阅参数
$conf_dir = './conf';
$conf_file = 'util_1.conf';
$args = $_SERVER['argv'];
$prog_name = array_shift($args);
if (2 == count($args)) {
    // 读取命令行参数
    $conf_dir = $args[0];
    $conf_file = $args[1];
}
printf("load configure [dir:%s][file:%s]\n", $conf_dir, $conf_file);
$conf_content = config_load($conf_dir, $conf_file);
if (false === $conf_content) {
    echo config_error_message();
    die;
}
$stat = null;
$ret = BigpipeQueueAdministrationTools::create_queue($conf_content['meta'], $conf_content['UTIL'], $stat);
if (false === $ret) {
    echo "afwul\n";
} else {
    echo "success\n";
    print_r($stat);
    echo "\n";
}
BigpipeLog::close();
?>

    echo "\n";
}
// 订阅参数
$conf_dir = './conf';
$conf_file = 'util_1.conf';
$name = 'autopush_t1';
$token = 'token';
$args = $_SERVER['argv'];
$prog_name = array_shift($args);
if (4 == count($args)) {
    // 读取命令行参数
    $conf_dir = $args[0];
    $conf_file = $args[1];
    $name = $args[2];
    $token = $args[3];
}
$conf_content = config_load($conf_dir, $conf_file);
if (false === $conf_content) {
    echo config_error_message();
    die;
}
$ret = BigpipeQueueAdministrationTools::delete_queue($name, $token, $conf_content['meta']);
if (false === $ret) {
    echo "afwul delete queue\n";
} else {
    echo "\n queue deleted \n";
}
BigpipeLog::close();
?>

 /**
  * ²âÊÔ delete_queue½Ó¿Ú
  */
 public function testDeleteQueue()
 {
     // ²âÊÔ1 queue param´íÎó
     $states = null;
     $name = 'queue';
     $token = 'token';
     $this->assertFalse(BigpipeQueueAdministrationTools::delete_queue($name, null, $this->meta_conf, $states));
     // ²âÊÔ2 _init_meta´íÎó
     BigpipeQueueAdministrationTools::$stub_meta = false;
     $this->assertFalse(BigpipeQueueAdministrationTools::delete_queue($name, $token, $this->meta_conf, $states));
     // ¶¨Òåstub_metaÐÐΪ
     $this->stub_meta->expects($this->any())->method('delete_entry')->will($this->onConsecutiveCalls(false, true));
     $queue_started = array('token' => 'token', 'status' => BigpipeQueueStatus::STARTED);
     $queue_deleted = array('token' => 'token', 'status' => BigpipeQueueStatus::DELETED);
     $queue_normal = array('token' => 'token', 'status' => BigpipeQueueStatus::STOPPED);
     $queue_unauthor = array('token' => 'mistoken', 'status' => BigpipeQueueStatus::CREATED);
     $this->stub_meta->expects($this->any())->method('get_entry')->will($this->onConsecutiveCalls(false, $queue_unauthor, $queue_deleted, $queue_normal, $queue_normal));
     // ²âÊÔ3 get entry´íÎó
     BigpipeQueueAdministrationTools::$stub_meta = $this->stub_meta;
     $this->assertFalse(BigpipeQueueAdministrationTools::delete_queue($name, $token, $this->meta_conf, $states));
     // ²âÊÔ4 token´íÎó
     $this->assertFalse(BigpipeQueueAdministrationTools::delete_queue($name, $token, $this->meta_conf, $states));
     // ²âÊÔ5 queueÊÇÒÑɾ³ý״̬
     $this->assertFalse(BigpipeQueueAdministrationTools::delete_queue($name, $token, $this->meta_conf, $states));
     // ²âÊÔ6 delete entryʧ°Ü
     $this->assertFalse(BigpipeQueueAdministrationTools::delete_queue($name, $token, $this->meta_conf, $states));
     // ²âÊÔ7 ³É¹¦Á÷³Ì
     $this->assertTrue(BigpipeQueueAdministrationTools::delete_queue($name, $token, $this->meta_conf, $states));
 }
// 订阅参数
$conf_dir = './conf';
$conf_file = 'util_1.conf';
$name = 'autopush_t1';
$token = 'token';
$args = $_SERVER['argv'];
$prog_name = array_shift($args);
if (4 == count($args)) {
    // 读取命令行参数
    $conf_dir = $args[0];
    $conf_file = $args[1];
    $name = $args[2];
    $token = $args[3];
}
$conf_content = config_load($conf_dir, $conf_file);
if (false === $conf_content) {
    echo config_error_message();
    die;
}
$stat = null;
$ret = BigpipeQueueAdministrationTools::start_queue($name, $token, $conf_content['meta'], $stat);
if (false === $ret) {
    echo "afwul start queue\n";
} else {
    print_r($stat);
    echo "\n queue started \n";
}
BigpipeLog::close();
?>