3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 #include <sync_agent.h>
21 #include "../../src/framework/event/oma_dm_api_common_internal.h"
24 POSITIVE_TC_IDX = 0x01,
28 static void startup(void);
29 static void cleanup(void);
31 void (*tet_startup) (void) = startup;
32 void (*tet_cleanup) (void) = cleanup;
34 #define TEST_FW_CONFIG_OMADM_FILE "../../../testcase/fw-test-cfg/test_fw_config_omadm.xml"
36 #define API_NAME_SYNC_START_UP "startup"
37 #define API_NAME_SYNC_CLEAN_UP "cleanup"
39 #define API_NAME_SYNC_AGENT_DM_REG_INIT "sync_agent_dm_reg_init"
40 #define API_NAME_SYNC_AGENT_DM_REG_ACCOUNT_REGISTRATION "sync_agent_dm_reg_account_registration"
41 #define API_NAME_SYNC_AGENT_DM_REG_DEINIT "sync_agent_dm_reg_deinit"
43 #define API_NAME_START_TEST_DM_AGENT "_start_test_dm_agent"
45 static void utc_sync_agent_framework_sync_agent_dm_reg_init_p(void);
46 static void utc_sync_agent_framework_sync_agent_dm_reg_account_registration_p(void);
47 static void utc_sync_agent_framework_sync_agent_dm_reg_deinit_p(void);
49 static void *_start_test_dm_agent(void *arg);
50 static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response);
52 struct tet_testlist tet_testlist[] = {
53 {utc_sync_agent_framework_sync_agent_dm_reg_init_p, POSITIVE_TC_IDX},
54 {utc_sync_agent_framework_sync_agent_dm_reg_account_registration_p, POSITIVE_TC_IDX},
55 {utc_sync_agent_framework_sync_agent_dm_reg_deinit_p, POSITIVE_TC_IDX},
59 static pthread_t test_dm_agent_thread_id;
61 static void startup(void)
64 pthread_create(&test_dm_agent_thread_id, 0, _start_test_dm_agent, 0);
69 static void cleanup(void)
72 pthread_cancel(test_dm_agent_thread_id);
74 sync_agent_stop_main_loop(1);
77 static void utc_sync_agent_framework_sync_agent_dm_reg_init_p(void)
79 char *api_name = API_NAME_SYNC_AGENT_DM_REG_INIT;
80 sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS;
82 dm_err = sync_agent_dm_reg_init();
83 if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) {
86 dts_message(api_name, "sync_agent_dm_reg_init : %d", dm_err);
91 static void utc_sync_agent_framework_sync_agent_dm_reg_account_registration_p(void)
93 char *api_name = API_NAME_SYNC_AGENT_DM_REG_ACCOUNT_REGISTRATION;
94 sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS;
96 dm_err = sync_agent_dm_reg_account_registration();
97 if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) {
100 dts_message(api_name, "sync_agent_dm_reg_account_registration : %d", dm_err);
105 static void utc_sync_agent_framework_sync_agent_dm_reg_deinit_p(void)
107 char *api_name = API_NAME_SYNC_AGENT_DM_REG_DEINIT;
108 sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS;
110 dm_err = sync_agent_dm_reg_deinit();
111 if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) {
114 dts_message(api_name, "sync_agent_dm_reg_deinit : %d", dm_err);
119 static void *_start_test_dm_agent(void *arg)
121 char *api_name = API_NAME_START_TEST_DM_AGENT;
122 sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS;
123 sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_OMADM_FILE);
124 if (init_error != SYNC_AGENT_INIT_SUCCESS) {
125 dts_message(api_name, "sync_agent_init : %d", init_error);
129 event_err = sync_agent_set_event_callback(EVENT_ACCOUNT_REGISTRATION, ___account_registration_cb);
130 if (event_err != SYNC_AGENT_EVENT_SUCCESS) {
131 dts_message(api_name, "sync_agent_set_event_callback : %d", event_err);
135 sync_agent_run_main_loop(1);
138 static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response)
140 g_print("%s Start \n", __func__);
142 int event_result = 1;
143 int response_type = 0;
145 // sync_agent_get_event_data_param(request, &response_type);
147 // sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result);
149 g_print("%s End \n", __func__);