diff --git a/test/testCode/BS001ContainerBasicScenario.php b/test/testCode/BS001ContainerBasicScenario.php index 660f16f..f8f8242 100644 --- a/test/testCode/BS001ContainerBasicScenario.php +++ b/test/testCode/BS001ContainerBasicScenario.php @@ -1,7 +1,10 @@ GRIDDB_NOTIFICATION_ADDRESS, - "port" => (int)GRIDDB_NOTIFICATION_PORT, - "clusterName" => GRIDDB_CLUSTER_NAME, - "username" => GRIDDB_USERNAME, - "password" => GRIDDB_PASSWORD]; + $storeInfo = [ + "host" => GRIDDB_NOTIFICATION_ADDRESS, + "port" => (int) GRIDDB_NOTIFICATION_PORT, + "clusterName" => GRIDDB_CLUSTER_NAME, + "username" => GRIDDB_USERNAME, + "password" => GRIDDB_PASSWORD, + ]; self::$gridstore = $factory->getStore($storeInfo); - } catch (\GSException $e){ - for ($i= 0; $i < $e->getErrorStackSize(); $i++) { - echo("\n[$i]\n"); - echo($e->getErrorCode($i)."\n"); - echo($e->getLocation($i)."\n"); - echo($e->getErrorMessage($i)."\n"); + } catch (\GSException $e) { + for ($i = 0; $i < $e->getErrorStackSize(); $i++) { + echo "\n[$i]\n"; + echo $e->getErrorCode($i) . "\n"; + echo $e->getLocation($i) . "\n"; + echo $e->getErrorMessage($i) . "\n"; } } catch (\Exception $e1) { - echo($e1."\n"); + echo $e1 . "\n"; } } @@ -40,12 +46,20 @@ public function providerDataTest() { /** * @dataProvider providerDataTest */ - public function testContainerPutGet($testId, $containerType, - $stringVal, $timestampVal, $byteVal, - $shortVal, $integerVal, $boolVal, - $floatVal, $doubleVal, $blobVal, - $expectedOutput) - { + public function testContainerPutGet( + $testId, + $containerType, + $stringVal, + $timestampVal, + $byteVal, + $shortVal, + $integerVal, + $boolVal, + $floatVal, + $doubleVal, + $blobVal, + $expectedOutput + ) { echo sprintf("Test case: %s put: %s:\n", $testId, $containerType); echo sprintf(" Expected has exception = %s\n", $expectedOutput); @@ -66,64 +80,88 @@ public function testContainerPutGet($testId, $containerType, // Test putRow try { - if ($containerType == "GS_CONTAINER_COLLECTION") { + if (strcmp($containerType, "GS_CONTAINER_COLLECTION")) { $containerName = "col01Collection"; - $columnInfoList = [["A", \Type::STRING], - ["B", \Type::TIMESTAMP], - ["C", \Type::BYTE], - ["D", \Type::SHORT], - ["E", \Type::INTEGER], - ["F", \Type::BOOL], - ["G", \Type::FLOAT], - ["H", \Type::DOUBLE], - ["I", \Type::BLOB]]; - $containerType = \ContainerType::COLLECTION; + $columnInfoList = [ + ["A", \Type::STRING], + ["B", \Type::TIMESTAMP], + ["C", \Type::BYTE], + ["D", \Type::SHORT], + ["E", \Type::INTEGER], + ["F", \Type::BOOL], + ["G", \Type::FLOAT], + ["H", \Type::DOUBLE], + ["I", \Type::BLOB], + ]; + $containerTypeObj = \ContainerType::COLLECTION; } else { $containerName = "col01Timeseries"; - $columnInfoList = [["A", \Type::TIMESTAMP], - ["B", \Type::STRING], - ["C", \Type::BYTE], - ["D", \Type::SHORT], - ["E", \Type::INTEGER], - ["F", \Type::BOOL], - ["G", \Type::FLOAT], - ["H", \Type::DOUBLE], - ["I", \Type::BLOB]]; - $containerType = \ContainerType::TIME_SERIES; + $columnInfoList = [ + ["A", \Type::TIMESTAMP], + ["B", \Type::STRING], + ["C", \Type::BYTE], + ["D", \Type::SHORT], + ["E", \Type::INTEGER], + ["F", \Type::BOOL], + ["G", \Type::FLOAT], + ["H", \Type::DOUBLE], + ["I", \Type::BLOB], + ]; + $containerTypeObj = \ContainerType::TIME_SERIES; } - $containerInfo = new \ContainerInfo(["name" => $containerName, - "columnInfoArray" => $columnInfoList, - "type" => $containerType, - "rowKey" => $rowKeyAssigned]); + $containerInfo = new \ContainerInfo([ + "name" => $containerName, + "columnInfoArray" => $columnInfoList, + "type" => $containerTypeObj, + "rowKey" => $rowKeyAssigned, + ]); self::$gridstore->dropContainer($containerName); - $container = self::$gridstore->putContainer($containerInfo, - $modifiable); - if ($containerType == "GS_CONTAINER_COLLECTION") { - $rowData = [$stringVal, $timestampVal, $byteVal, - $shortVal, $integerVal, $boolVal, - $floatVal, $doubleVal, $blobVal]; + $container = self::$gridstore->putContainer( + $containerInfo, + $modifiable + ); + if (strcmp($containerType, "GS_CONTAINER_COLLECTION")) { + $rowData = [ + $stringVal, + $timestampVal, + $byteVal, + $shortVal, + $integerVal, + $boolVal, + $floatVal, + $doubleVal, + $blobVal, + ]; } else { - $rowData = [$timestampVal, $stringVal, $byteVal, - $shortVal, $integerVal, $boolVal, - $floatVal, $doubleVal, $blobVal]; + $rowData = [ + $timestampVal, + $stringVal, + $byteVal, + $shortVal, + $integerVal, + $boolVal, + $floatVal, + $doubleVal, + $blobVal, + ]; } $existed = $container->put($rowData); - if ($containerType == "GS_CONTAINER_COLLECTION") { + if (strcmp($containerType, "GS_CONTAINER_COLLECTION")) { $rowDataGet = $container->get($stringVal); } else { $rowDataGet = $container->get($timestampVal); } self::$gridstore->dropContainer($containerName); } catch (\GSException $e) { - for ($i= 0; $i < $e->getErrorStackSize(); $i++) { - echo("\n[$i]\n"); - echo($e->getErrorCode($i)."\n"); - echo($e->getLocation($i)."\n"); - echo($e->getErrorMessage($i)."\n"); + for ($i = 0; $i < $e->getErrorStackSize(); $i++) { + echo "\n[$i]\n"; + echo $e->getErrorCode($i) . "\n"; + echo $e->getLocation($i) . "\n"; + echo $e->getErrorMessage($i) . "\n"; } $hasException = "1"; } catch (\Exception $e1) { - echo($e1."\n"); + echo $e1 . "\n"; $hasException = "1"; } @@ -132,4 +170,3 @@ public function testContainerPutGet($testId, $containerType, } } ?> - diff --git a/test/testCode/BS004ContainerPutGetNullSpec.php b/test/testCode/BS004ContainerPutGetNullSpec.php index 4cd84b0..952bcfa 100644 --- a/test/testCode/BS004ContainerPutGetNullSpec.php +++ b/test/testCode/BS004ContainerPutGetNullSpec.php @@ -1,7 +1,10 @@