/**
  * ²âÊÔ create_queue½Ó¿Ú
  */
 public function testCreateQueue()
 {
     // ²âÊÔ1 queue param´íÎó
     $states = null;
     $this->assertFalse(BigpipeQueueAdministrationTools::create_queue($this->meta_conf, 369, $states));
     // ²âÊÔ2 _init_meta´íÎó
     BigpipeQueueAdministrationTools::$stub_meta = false;
     $this->assertFalse(BigpipeQueueAdministrationTools::create_queue($this->meta_conf, $this->queue_conf, $states));
     // ¶¨Òåstub_metaÐÐΪ
     $this->stub_meta->expects($this->any())->method('create_entry')->will($this->onConsecutiveCalls(false, true, true, true));
     $this->stub_meta->expects($this->any())->method('set_entry')->will($this->onConsecutiveCalls(false, true, true));
     $this->stub_meta->expects($this->any())->method('get_entry')->will($this->onConsecutiveCalls(false, 'ok'));
     // ²âÊÔ3 _normalize queu param´íÎó
     BigpipeQueueAdministrationTools::$stub_meta = $this->stub_meta;
     $pipelet_arr = array_slice($this->queue_conf['pipelet'], 0);
     $this->queue_conf['pipelet'] = null;
     print_r($this->queue_conf);
     $this->assertFalse(BigpipeQueueAdministrationTools::create_queue($this->meta_conf, $this->queue_conf, $states));
     $this->queue_conf['pipelet'] = array(0 => 1);
     $this->assertFalse(BigpipeQueueAdministrationTools::create_queue($this->meta_conf, $this->queue_conf, $states));
     $this->queue_conf['pipelet'] = array_slice($pipelet_arr, 0);
     // ²âÊÔ4 create entry´íÎó
     $this->assertFalse(BigpipeQueueAdministrationTools::create_queue($this->meta_conf, $this->queue_conf, $states));
     // ²âÊÔ5 set entry´íÎó
     $this->assertFalse(BigpipeQueueAdministrationTools::create_queue($this->meta_conf, $this->queue_conf, $states));
     // ²âÊÔ6 get entry´íÎó
     $this->assertFalse(BigpipeQueueAdministrationTools::create_queue($this->meta_conf, $this->queue_conf, $states));
     // ²âÊÔ7 ³É¹¦Á÷³Ì
     $this->assertTrue(BigpipeQueueAdministrationTools::create_queue($this->meta_conf, $this->queue_conf, $states));
 }
コード例 #2
0
    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();
?>