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); }
/** * @depends testgetSourceGroupName * @depends test_whether_cluster */ public function testgetPartition() { $args_array = func_get_args(); $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']); $Partition = ''; while ($cursor = $array_find->getNext()) { $array = $cata->getError(); $this->assertEquals(0, $array['errno']); //print_r( $cursor ) ; if ($cursor['Name'] == 'cs_test.cl_test') { $Partition = $cursor['Partition']; break; } } if ('' == $Partition) { 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("/\"Partition\": (.+?),/", $cursor_str, $matches)) { var_dump($matches); $Partition = $matches[1]; echo $Partition; break; } } } } } return $Partition; } }