Test to get all statistics info 61/200461/2
authorhyunuktak <hyunuk.tak@samsung.com>
Mon, 25 Feb 2019 09:11:59 +0000 (18:11 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Mon, 4 Mar 2019 13:21:37 +0000 (13:21 +0000)
Change-Id: If43661019a26727d5940bd2379531a0770f699a5
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
test/statistics.c

index b568cec..08671a2 100755 (executable)
@@ -138,6 +138,27 @@ static stc_callback_ret_e __test_stc_stats_info_cb(
        return STC_CALLBACK_CONTINUE;
 }
 
+void __test_stc_get_stats_finished_cb(stc_error_e result,
+               stc_all_stats_info_h info, void *user_data)
+{
+       if (result != STC_ERROR_NONE) {
+               msg("Response get stats finished error " LOG_RED "[%s]" LOG_END,
+                       test_stc_convert_error_type_to_string(result));
+               return;
+       }
+
+       int ret = STC_ERROR_NONE;
+
+       ret = stc_foreach_all_stats(info, __test_stc_stats_info_cb, NULL);
+       if (ret == STC_ERROR_NONE)
+               msg(LOG_GREEN "Success to get all stats info" LOG_END);
+       else
+               msg("Fail to Success to get all stats info " LOG_RED "[%s]" LOG_END,
+                       test_stc_convert_error_type_to_string(ret));
+
+       return;
+}
+
 static int __test_stc_set_reset_rule(MManager *mm, struct menu_data *menu)
 {
        int ret = STC_ERROR_NONE;
@@ -329,7 +350,7 @@ static int __test_stc_stats_get(MManager *mm, struct menu_data *menu)
        return ret;
 }
 
-static int __test_stc_foreach_stats(MManager *mm, struct menu_data *menu)
+static int __test_stc_stats_get_all(MManager *mm, struct menu_data *menu)
 {
        int ret = STC_ERROR_NONE;
        time_t from = 0;
@@ -344,9 +365,9 @@ static int __test_stc_foreach_stats(MManager *mm, struct menu_data *menu)
                msg("Fail to set time interval " LOG_RED "[%s]" LOG_END,
                        test_stc_convert_error_type_to_string(ret));
 
-       ret = stc_foreach_stats(g_stc,
+       ret = stc_get_all_stats(g_stc,
                g_stats_rule,
-               __test_stc_stats_info_cb,
+               __test_stc_get_stats_finished_cb,
                NULL);
        if (ret == STC_ERROR_NONE)
                msg(LOG_GREEN "Success to request stats all info" LOG_END);
@@ -470,7 +491,7 @@ static struct menu_data menu_reset[] = {
 static struct menu_data menu_stats[] = {
        { "1", LOG_LIGHTMAGENTA "[Set]" LOG_END " stats rule", menu_stats_rule, NULL, NULL},
        { "2", LOG_LIGHTBLUE "[Get]" LOG_END " stats", NULL, __test_stc_stats_get, NULL},
-       { "3", LOG_LIGHTBLUE "[Get]" LOG_END " all stats", NULL, __test_stc_foreach_stats, NULL},
+       { "3", LOG_LIGHTBLUE "[Get]" LOG_END " all stats", NULL, __test_stc_stats_get_all, NULL},
        { "4", LOG_LIGHTBLUE "[Get]" LOG_END " total stats", NULL, __test_stc_stats_get_total, NULL},
        { NULL, NULL, },
 };