Github user KanakaKumar commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2991#discussion_r243361889
--- Diff: store/CSDK/test/main.cpp ---
@@ -665,6 +699,208 @@ bool readFromS3(JNIEnv *env, char *path, char
*argv[]) {
printResult(env, reader);
}
+TEST(CSDKTest,tryCatchException) {
+ bool gotExp=tryCatchException(env);
+ EXPECT_TRUE(gotExp);
+}
+
+
+TEST(CSDKTest,tryCarbonRowException) {
+ char *smallFilePath = "../../../../resources/carbondata";
+ try {
+ bool result = tryCarbonRowException(env, smallFilePath);;
+ EXPECT_TRUE(result) << "Expected Exception as No Index File" <<
result;
+ } catch (runtime_error e) {
+ EXPECT_TRUE(true);
+ }
+}
+
+TEST(CSDKTest,testCarbonProperties) {
+ try {
+ bool result = testCarbonProperties(env);
+ EXPECT_TRUE(result) << "Carbon set properties not working ";
+ } catch (runtime_error e) {
+ EXPECT_TRUE(false) << " Exception is not expected while setting
carbon properties ";
+ }
+}
+
+TEST(CSDKTest,testWriteData) {
+ try {
+ bool result =testWriteData(env, "./data", my_argc, my_argv);
+ result = result && testWriteData(env, "./data", my_argc, my_argv);
+ EXPECT_TRUE(result) << "Either Data Loading Or Carbon Reader is
failed";
+ } catch (runtime_error e) {
+ EXPECT_TRUE(false) << " Exception is not expected while data
loading";
+ }
+}
+
+TEST(CSDKTest,readFromLocalWithoutProjection) {
+ try {
+ char *smallFilePath = "./data_withoutpro";
+ bool result =testWriteData(env, smallFilePath, my_argc, my_argv);
+ if(result){
+ bool proj_result = readFromLocalWithoutProjection(env,
smallFilePath);
+ EXPECT_TRUE(proj_result) << "Without Projection is failed";
+ } else {
+ EXPECT_TRUE(result) << "Either Data Loading Or Carbon Reader
is failed";
+ }
+ } catch (runtime_error e) {
+ EXPECT_TRUE(false) << " Exception is not expected ,During without
projection selection";
+ }
+}
+
+TEST(CSDKTest,readFromLocalWithProjection) {
+ try {
+ char *smallFilePath = "./data_pro";
+ bool result =testWriteData(env, smallFilePath, my_argc, my_argv);
+ if(result){
+ bool proj_result = readFromLocalWithProjection(env,
smallFilePath);
+ EXPECT_TRUE(proj_result) << "With Projection is failed";
+ } else {
+ EXPECT_TRUE(result) << "Either Data Loading Or Carbon Reader
is failed";
+ }
+ } catch (runtime_error e) {
+ EXPECT_TRUE(false) << " Exception is not expected ,During With
projection selection";
+ }
+}
+
+
+TEST(CSDKTest,readSchemaWithoutValidation) {
+ try {
+ char *path = "./data_readPath";
+ bool result =testWriteData(env, path, my_argc, my_argv);
+ if(result){
+ bool schema_result = readSchema(env, path, false);
+ EXPECT_TRUE(schema_result) << "Not Able to read readSchema
from given path";
+ } else {
+ EXPECT_TRUE(result) << "Either Data Loading Or Carbon Reader
is failed";
+ }
+ } catch (runtime_error e) {
+ EXPECT_TRUE(false) << " Exception is not expected ,During Read
Schema";
+ }
+}
+
+
+TEST(CSDKTest,readSchemaWithValidation) {
+ try {
+ char *path = "./data_readPathWithValidation";
+ bool result =testWriteData(env, path, my_argc, my_argv);
+ if(result){
+ bool schema_result = readSchema(env, path, true);
+ EXPECT_TRUE(schema_result) << "Not Able to read readSchema Or
validate from given path";
+ } else {
+ EXPECT_TRUE(result) << "Either Data Loading Or Carbon Reader
is failed";
+ }
+ } catch (runtime_error e) {
+ EXPECT_TRUE(false) << " Exception is not expected ,During Read
Schema";
+ }
+}
+
+TEST(CSDKTest,testReadNextRowWthtVector) {
+ try {
+ int printNum = 32000;
+ char *path = "./data_forVector";
+ bool result =testWriteData(env, path, my_argc, my_argv);
+ if(result){
+ bool readresultWithVector= testReadNextRow(env, path,
printNum, my_argv, 0, true);
+ EXPECT_TRUE(readresultWithVector) << "Vector reading is
failed";
+ } else {
+ EXPECT_TRUE(result) << "Either Data Loading Or Carbon Reader
is failed";
+ }
+ } catch (runtime_error e) {
+ EXPECT_TRUE(false) << " Exception is not expected ,During Vector
read";
+ }
+}
+
+
+TEST(CSDKTest,testReadNextRowWthoutVector) {
+ try {
+ int printNum = 32000;
+ char *path = "./data_forCarbonReader";
+ bool result =testWriteData(env, path, my_argc, my_argv);
+ if(result){
+ bool readresultWithVectorfalse=testReadNextRow(env, path,
printNum, my_argv, 0, false);
--- End diff --
At present all the methods in main.cpp are printing the results in the
console just for local verification.
I think we should leave main.cpp as an example file and add new test files
for test with detailed assertions.
---