[libgda] meta-tests: improved debuging messages



commit ce849d91b2b690ba32e52c157dd97f45fed05113
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date:   Tue Jan 8 19:19:04 2019 -0600

    meta-tests: improved debuging messages

 providers/reuseable/postgres/gda-postgres-meta.c |  1 -
 tests/providers/prov-test-common.c               | 68 ++++++++++++++++++------
 2 files changed, 52 insertions(+), 17 deletions(-)
---
diff --git a/providers/reuseable/postgres/gda-postgres-meta.c 
b/providers/reuseable/postgres/gda-postgres-meta.c
index dcea2138f..bc991c688 100644
--- a/providers/reuseable/postgres/gda-postgres-meta.c
+++ b/providers/reuseable/postgres/gda-postgres-meta.c
@@ -921,7 +921,6 @@ gboolean
 _gda_postgres_meta__tables_views (G_GNUC_UNUSED GdaServerProvider *prov, GdaConnection *cnc,
                                  GdaMetaStore *store, GdaMetaContext *context, GError **error)
 {
-  g_message ("Updating Tables Views meta data");
        GdaDataModel *tables_model, *views_model;
        gboolean retval = TRUE;
 
diff --git a/tests/providers/prov-test-common.c b/tests/providers/prov-test-common.c
index 2bb41db7f..00b19bc42 100644
--- a/tests/providers/prov-test-common.c
+++ b/tests/providers/prov-test-common.c
@@ -358,10 +358,19 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
         gda_server_operation_set_value_at (operation, "id", NULL, "/FIELDS_A/@COLUMN_NAME/0");
         gda_server_operation_set_value_at (operation, "int", NULL, "/FIELDS_A/@COLUMN_TYPE/0");
         gda_server_operation_set_value_at (operation, "TRUE", NULL, "/FIELDS_A/@COLUMN_PKEY/0");
+                               gchar *ops = gda_server_operation_render (operation, &error);
+                               if (ops == NULL) {
+                                       g_message ("Error while rendering operation to perform: %s",
+                                                                                error && error->message ? 
error->message : "No Error was set");
+                                       g_clear_error (error);
+                                       return 1;
+                               }
+                               g_print ("Operation to perform: %s\n", ops);
+                               g_free (ops);
         if (! gda_server_provider_perform_operation (provider, cnc, operation, &error)) {
 #ifdef CHECK_EXTRA_INFO
-                g_warning ("perform_operation(CREATE_TABLE) failed: %s\n", error && error->message ? 
-                          error->message : "???");
+                                       g_message ("perform_operation(CREATE_TABLE) failed: %s\n", error && 
error->message ?
+                                          error->message : "???");
 #endif
                 g_clear_error (&error);
                g_object_set (G_OBJECT (cnc), "options", options, NULL);
@@ -386,7 +395,7 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
        g_object_unref (store);
        if (! gda_connection_update_meta_store (cnc, update_all ? NULL : &mcontext, &error)) {
 #ifdef CHECK_EXTRA_INFO
-               g_warning ("Can't %s update meta store: %s\n",
+               g_message ("Can't %s update meta store: %s\n",
          update_all ? "FULL" : "PARTIAL",
                           error && error->message ? error->message : "No error message was set");
 #endif
@@ -406,8 +415,11 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
        g_assert (data);
        if (gda_data_model_get_n_rows (data) != 1) {
 #ifdef CHECK_EXTRA_INFO
-                g_warning ("gda_connection_get_meta_store_data(): wrong number of rows : %d\n",
-                          gda_data_model_get_n_rows (data));
+               g_message ("Getting Meta Tables: wrong number of rows : %d\n",
+               gda_data_model_get_n_rows (data));
+               gchar *sd1 = gda_data_model_dump_as_string (data);
+               g_message ("Returned Data Model: \n%s", sd1);
+               g_free (sd1);
 #endif
                gda_value_free (value);
                g_object_unref (data);
@@ -418,8 +430,11 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
        g_assert (cvalue);
        if (gda_value_compare (value, cvalue)) {
 #ifdef CHECK_EXTRA_INFO
-                g_warning ("gda_connection_get_meta_store_data(): expected %s and got %s\n",
-                          gda_value_stringify (cvalue), gda_value_stringify (value));
+               g_message ("Comparing data in returned meta data for tables: expected %s and got %s\n",
+                       gda_value_stringify (cvalue), gda_value_stringify (value));
+               gchar *sd2 = gda_data_model_dump_as_string (data);
+               g_message ("Returned Data Model: \n%s", sd2);
+               g_free (sd2);
 #endif
                gda_value_free (value);
                g_object_unref (data);
@@ -434,8 +449,11 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
        g_assert (data);
        if (gda_data_model_get_n_rows (data) != 1) {
 #ifdef CHECK_EXTRA_INFO
-                g_warning ("gda_connection_get_meta_store_data(): wrong number of rows : %d\n",
-                          gda_data_model_get_n_rows (data));
+               g_message ("Getting Meta for Fields: wrong number of rows : %d\n",
+                       gda_data_model_get_n_rows (data));
+               gchar *sd3 = gda_data_model_dump_as_string (data);
+               g_message ("Returned Data Model: \n%s", sd3);
+               g_free (sd3);
 #endif
                gda_value_free (value);
                g_object_unref (data);
@@ -447,8 +465,11 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
        g_value_set_string ((value2 = gda_value_new (G_TYPE_STRING)), "id");
        if (gda_value_compare (value2, cvalue)) {
 #ifdef CHECK_EXTRA_INFO
-                g_warning ("gda_connection_get_meta_store_data(): expected %s and got %s\n",
+                g_message ("Comparing data for returned data in meta data for Fields: expected %s and got 
%s\n",
                           gda_value_stringify (cvalue), gda_value_stringify (value));
+               gchar *sd4 = gda_data_model_dump_as_string (data);
+               g_message ("Returned Data Model: \n%s", sd4);
+               g_free (sd4);
 #endif
                gda_value_free (value);
                g_object_unref (data);
@@ -468,8 +489,11 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
         gda_server_operation_set_value_at (operation, "int", NULL, "/COLUMN_DEF_P/COLUMN_TYPE", NULL);
         if (! gda_server_provider_perform_operation (provider, cnc, operation, &error)) {
 #ifdef CHECK_EXTRA_INFO
-                g_warning ("perform_operation(ADD_COLUMN) failed: %s\n", error && error->message ? 
+                g_message ("perform_operation(ADD_COLUMN) failed: %s\n", error && error->message ?
                           error->message : "???");
+               gchar *sd5 = gda_data_model_dump_as_string (data);
+               g_message ("Returned Data Model: \n%s", sd5);
+               g_free (sd5);
 #endif
                 g_clear_error (&error);
                g_object_set (G_OBJECT (cnc), "options", options, NULL);
@@ -482,7 +506,7 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
 #endif
        if (! gda_connection_update_meta_store (cnc, update_all ? NULL : &mcontext, &error)) {
 #ifdef CHECK_EXTRA_INFO
-               g_warning ("Can't FULL update meta store: %s\n",
+               g_message ("Can't FULL update meta store: %s\n",
                           error && error->message ? error->message : "???");
 #endif
                g_clear_error (&error);
@@ -501,8 +525,11 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
        g_assert (data);
        if (gda_data_model_get_n_rows (data) != 1) {
 #ifdef CHECK_EXTRA_INFO
-                g_warning ("gda_connection_get_meta_store_data(): wrong number of rows : %d\n",
+                g_message ("Getting meta data for Tables (2): wrong number of rows : %d\n",
                           gda_data_model_get_n_rows (data));
+               gchar *sd6 = gda_data_model_dump_as_string (data);
+               g_message ("Returned Data Model: \n%s", sd6);
+               g_free (sd6);
 #endif
                gda_value_free (value);
                g_object_unref (data);
@@ -513,8 +540,11 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
        g_assert (cvalue);
        if (gda_value_compare (value, cvalue)) {
 #ifdef CHECK_EXTRA_INFO
-                g_warning ("gda_connection_get_meta_store_data(): expected %s and got %s\n",
+               g_message ("Comparing data in meta data fro tables: expected %s and got %s\n",
                           gda_value_stringify (cvalue), gda_value_stringify (value));
+               gchar *sd6a = gda_data_model_dump_as_string (data);
+               g_message ("Returned Data Model: \n%s", sd6a);
+               g_free (sd6a);
 #endif
                gda_value_free (value);
                g_object_unref (data);
@@ -531,8 +561,11 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
        g_assert (data);
        if (gda_data_model_get_n_rows (data) != 1) {
 #ifdef CHECK_EXTRA_INFO
-                g_warning ("gda_connection_get_meta_store_data(): wrong number of rows : %d\n",
+               g_message ("Getting meta data for Fields: wrong number of rows : %d\n",
                           gda_data_model_get_n_rows (data));
+               gchar *sd7 = gda_data_model_dump_as_string (data);
+               g_message ("Returned Data Model: \n%s", sd7);
+               g_free (sd7);
 #endif
                gda_value_free (value);
                g_object_unref (data);
@@ -543,8 +576,11 @@ prov_test_common_check_meta_identifiers (gboolean case_sensitive, gboolean updat
        g_assert (cvalue);
        if (gda_value_compare (value2, cvalue)) {
 #ifdef CHECK_EXTRA_INFO
-                g_warning ("gda_connection_get_meta_store_data(): expected %s and got %s\n",
+               g_message ("Comparing meta data from Fields: expected %s and got %s\n",
                           gda_value_stringify (cvalue), gda_value_stringify (value));
+               gchar *sd8 = gda_data_model_dump_as_string (data);
+               g_message ("Returned Data Model: \n%s", sd8);
+               g_free (sd8);
 #endif
                gda_value_free (value);
                g_object_unref (data);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]