public function testgetError() { $sdb = new Sequoiadb(); $sdb->connect("localhost"); $array = $sdb->getError(); $this->assertEquals(0, $array['errno']); $sdb->install('{ "install":false }'); $str = $sdb->getError(); $this->assertEquals('{"errno":0}', $str); }
public function testclose() { $sdb = new Sequoiadb(); $sdb->connect("localhost:50000"); $array = $sdb->getError(); $this->assertEquals(0, $array['errno']); $sdb->close(); $sdb->selectCS("cs_test"); $array = $sdb->getError(); $this->assertNotEquals(0, $array['errno']); }
/** * @depends testselectCL * @depends test_whether_cluster */ public function testgetSourceGroupName() { $args_array = func_get_args(); $cl = $args_array[0]; $isCluster = $args_array[1]; if ($isCluster) { $cata = new Sequoiadb(); $array = $cata->connect('localhost:30000'); $this->assertEquals(0, $array['errno']); $SYSCAT = $cata->selectCS('SYSCAT'); $array = $cata->getError(); $this->assertEquals(0, $array['errno']); $SYSCOLLECTIONS = $SYSCAT->selectCollection('SYSCOLLECTIONS'); $array = $cata->getError(); $this->assertEquals(0, $array['errno']); $array_find = $SYSCOLLECTIONS->find(); $array = $cata->getError(); $this->assertEquals(0, $array['errno']); $SourceGroupName = ''; while ($cursor = $array_find->getNext()) { $array = $cata->getError(); $this->assertEquals(0, $array['errno']); if ($cursor['Name'] == 'cs_test.cl_test') { $SourceGroupName = $cursor['CataInfo'][0]['GroupName']; echo $SourceGroupName; break; } } if ('' == $SourceGroupName) { echo "output array still have problem\n"; $cata->install('{install:false}'); $array_find = $SYSCOLLECTIONS->find(); while ($cursor_str = $array_find->getNext()) { $str = $cata->getError(); $this->assertEquals('{"errno":0}', $str); if (preg_match("/\"Name\": \"(.+)\", \"Version\"/", $cursor_str, $matches)) { print_r($matches); if ($matches[1] == 'cs_test.cl_test') { if (preg_match("/\"GroupName\": \"(.+?)\"/", $cursor_str, $matches)) { var_dump($matches); $SourceGroupName = $matches[1]; echo $SourceGroupName; break; } } } } } return $SourceGroupName; } }