--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="native-cion-itc" version="0.1.0" api-version="3.0">
+ <label>NativeCionTest</label>
+ <author email="mymail@tizentest.com" href="www.tizentest.com">test</author>
+ <description>Native API test Application</description>
+ <ui-application appid="native.cion-itc" exec="/usr/apps/native-cion-itc/bin/tct-cion-native" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <background-category value="background-network"/>
+ <background-category value="download"/>
+ <background-category value="iot-communication"/>
+ <background-category value="location"/>
+ <background-category value="media"/>
+ <background-category value="sensor"/>
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/d2d.datasharing</privilege>
+ <privilege>http://tizen.org/privilege/d2d.remotelaunch</privilege>
+ <privilege>http://tizen.org/privilege/internet</privilege>
+ </privileges>
+</manifest>
--- /dev/null
+SET(PKG_NAME "cion")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-native")
+SET(RPM_NAME "native-${PKG_NAME}-itc")
+
+SET(CAPI_LIB "cion")
+SET(TC_SOURCES
+ ITs-cion-common.c
+ ITs-cion-client.c
+ ITs-cion-server.c
+ ITs-cion-payload.c
+ ITs-cion-payload-async-result.c
+ ITs-cion-peer-info.c
+ ITs-cion-group.c
+ ITs-cion-security.c
+)
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+ ${CAPI_LIB}
+ capi-appfw-application
+ glib-2.0
+ bundle
+ capi-system-info
+ dlog
+ elementary
+)
+
+INCLUDE_DIRECTORIES(
+ ${${CAPI_LIB}_INCLUDE_DIRS}
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES} ${COMMON_FILE})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+ ${${CAPI_LIB}_LIBRARIES}
+ bundle
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+ DESTINATION ${BIN_DIR}/${RPM_NAME}/bin
+)
+
+IF( DEFINED ASAN )
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -pie -g -fsanitize=address -fsanitize-recover=address -U_FORTIFY_SOURCE -fno-omit-frame-pointer")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,-fsanitize=address")
+ELSE()
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie")
+ENDIF()
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-cion-common.h"
+
+//& set: Cion
+
+/** @addtogroup itc-cion
+* @ingroup itc
+* @{
+*/
+bool g_bCallbackCalledDiscover;
+struct cbdata {
+ cion_client_h client;
+ bool connected;
+};
+static GMainLoop *main_loop;
+static guint source_id;
+static gboolean __timeout_cb(gpointer data)
+{
+ g_main_loop_quit(main_loop);
+ return FALSE;
+}
+
+static void RunPollingLoop(void) {
+ main_loop = g_main_loop_new(NULL, FALSE);
+ source_id = g_timeout_add(10000, __timeout_cb, NULL);\
+ g_main_loop_run(main_loop);\
+ g_source_remove(source_id);
+ main_loop = NULL;
+}
+
+static void StopPollingLoop(void) {
+ sleep(1);
+ g_source_remove(source_id);
+ g_main_loop_quit(main_loop);
+}
+
+struct send_data {
+ cion_client_h client;
+ unsigned char *return_data;
+ unsigned int return_data_size;
+ int ret;
+};
+
+static gpointer SendDataThread(gpointer data)
+{
+ FPRINTF("[Line : %d][%s] SendDataThread called\\n", __LINE__, API_NAMESPACE);
+ unsigned char str[] ="data_test";
+ struct send_data *send_data = (struct send_data *)data;
+
+ send_data->ret = cion_client_send_data(send_data->client, str, strlen((const char*)str),5000, &send_data->return_data, &send_data->return_data_size);
+ StopPollingLoop();
+
+ return NULL;
+}
+
+/**
+* @function ServerDataReceivedCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, const unsigned char *data,unsigned int data_size, unsigned char **return_data,unsigned int *return_data_size, void *user_data
+* @return NA
+*/
+void ServerDataReceivedCB(const char *service_name,const cion_peer_info_h peer_info, const unsigned char *data,unsigned int data_size, unsigned char **return_data,unsigned int *return_data_size, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Callback ServerDataReceivedCB called\\n", __LINE__, API_NAMESPACE);
+ char pszStr[] ="data_result";
+ *return_data = (unsigned char *)strdup(pszStr);
+ *return_data_size = strlen(pszStr);
+}
+
+/**
+* @function ServerConnectionRequestCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ServerConnectionRequestCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Callback ServerConnectionRequestCB called\\n", __LINE__, API_NAMESPACE);
+ int nRetVal = -1;
+ cion_server_h hServer = (cion_server_h)user_data;
+
+ nRetVal = cion_server_accept(hServer, peer_info);
+ if (nRetVal != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] Failed to accept client\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ClientServerDiscoveredCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ClientServerDiscoveredCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ sleep(2);
+ g_bCallbackCalled = true;
+ FPRINTF("[Line : %d][%s] Callback ClientServerDiscoveredCB called\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ClientServerDiscoveredCB2
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ClientServerDiscoveredCB2(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ g_bCallbackCalled = true;
+ FPRINTF("[Line : %d][%s] Callback ClientServerDiscoveredCB2 called\\n", __LINE__, API_NAMESPACE);
+ int nRetVal = -1;
+ cion_peer_info_h *pszPeer = (cion_peer_info_h *)user_data;
+
+ FPRINTF("[Line : %d][%s] server discovered\\n", __LINE__, API_NAMESPACE);
+ nRetVal = cion_peer_info_clone(peer_info, pszPeer);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] Failed cion_client_connect\\n", __LINE__, API_NAMESPACE);
+ }
+
+ StopPollingLoop();
+}
+
+/**
+* @function ClientServerDiscoveredCB3
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ClientServerDiscoveredCB3(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ g_bCallbackCalled = true;
+ FPRINTF("[Line : %d][%s] Callback ClientServerDiscoveredCB3 called\\n", __LINE__, API_NAMESPACE);
+ int nRetVal = -1;
+ struct cbdata *cbdata = (struct cbdata *)user_data;
+
+ FPRINTF("[Line : %d][%s] server discovered\\n", __LINE__, API_NAMESPACE);
+ nRetVal = cion_client_connect(cbdata->client, peer_info);
+ if (nRetVal != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] Failed cion_client_connect\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ClientServerDiscoveredCB4
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ClientServerDiscoveredCB4(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ g_bCallbackCalledDiscover = true;
+ FPRINTF("[Line : %d][%s] Callback ClientServerDiscoveredCB4 called\\n", __LINE__, API_NAMESPACE);
+ int nRetVal = -1;
+ struct cbdata *cbdata = (struct cbdata *)user_data;
+
+ FPRINTF("[Line : %d][%s] server discovered\\n", __LINE__, API_NAMESPACE);
+ nRetVal = cion_client_connect(cbdata->client, peer_info);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] Failed cion_client_connect\\n", __LINE__, API_NAMESPACE);
+ }
+ else
+ {
+ cbdata->connected = true;
+ }
+ StopPollingLoop();
+}
+
+/**
+* @function ClientDisconnectedCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ClientDisconnectedCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Callback ClientDisconnectedCB called\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ClientPayloadReceivedCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, const cion_payload_h payload,cion_payload_transfer_status_e status,void *user_data
+* @return NA
+*/
+static void ClientPayloadReceivedCB(const char *service_name,const cion_peer_info_h peer_info, const cion_payload_h payload,cion_payload_transfer_status_e status,void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Callback ClientPayloadReceivedCB called\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ClientConnectionResultCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info,const cion_connection_result_h result, void *user_data
+* @return NA
+*/
+static void ClientConnectionResultCB(const char *service_name,const cion_peer_info_h peer_info,const cion_connection_result_h result, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Callback ClientConnectionResultCB called\\n", __LINE__, API_NAMESPACE);
+ sleep(2);
+ StopPollingLoop();
+}
+
+/**
+* @function ClientConnectionResultCBAddRemove
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info,const cion_connection_result_h result, void *user_data
+* @return NA
+*/
+static void ClientConnectionResultCBAddRemove(const char *service_name,const cion_peer_info_h peer_info,const cion_connection_result_h result, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Callback ClientConnectionResultCBAddRemove called\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+ * @function ITs_cion_client_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_client_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+
+ return;
+}
+
+
+/**
+ * @function ITs_cion_client_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_client_cleanup(void)
+{
+ return;
+}
+
+/** @addtogroup itc-cion-testcases
+* @brief Integration testcases for module cion
+* @ingroup itc-cion
+* @{
+*/
+
+//& purpose: Creates and Destroy a Cion client handle
+//& type: auto
+/**
+* @testcase ITc_cion_client_create_destroy_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates and Destroy a Cion client handle
+* @scenario Creates and Destroy a Cion client handle
+* @apicovered cion_client_create,cion_client_destroy
+* @passcase If cion_client_create,cion_client_destroy is successfull
+* @failcase If cion_client_create,cion_client_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_client_create_destroy_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_client_h hClient = NULL;
+
+ nRetVal = cion_client_create(&hClient, "ITc_cion_client_create_destroy_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hClient,"cion_client_create");
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Tries and Stop to discover a Cion server.
+//& type: auto
+/**
+* @testcase ITc_cion_client_try_stop_discovery_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Tries and Stop to discover a Cion server.
+* @scenario Tries and Stop to discover a Cion server.
+* @apicovered cion_client_try_discovery,cion_client_stop_discovery
+* @passcase If cion_client_try_discovery,cion_client_stop_discovery is successfull
+* @failcase If cion_client_try_discovery,cion_client_stop_discovery fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_client_try_stop_discovery_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_client_h hClient = NULL;
+ cion_server_h hServer = NULL;
+ g_bCallbackCalled = false;
+ int nTimeoutId = -1;
+ struct send_data cbdata = { 0 };
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_client_try_stop_discovery_p","ITc_cion_client_try_stop_discovery_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_client_create(&hClient, "ITc_cion_client_try_stop_discovery_p",NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hClient,"cion_client_create");
+
+ nRetVal = cion_server_set_data_received_cb(hServer, ServerDataReceivedCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_set_data_received_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB,hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal));
+
+ nRetVal = cion_client_add_connection_result_cb(hClient,ClientConnectionResultCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_add_connection_result_cb", CionGetError(nRetVal));
+
+ cbdata.client = hClient;
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB4,&cbdata);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal));
+
+ RunPollingLoop();
+ if(g_bCallbackCalledDiscover != true)
+ {
+ FPRINTF("[Line : %d][%s] Callback ClientServerDiscoveredCB4 not invoked\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal));
+
+ nRetVal = cion_client_stop_discovery(hClient);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_stop_discovery", CionGetError(nRetVal));
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Tries to connect and disconnnect to the Cion server.
+//& type: auto
+/**
+* @testcase ITc_cion_client_connect_disconnect_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Tries to connect and disconnnect to the Cion server.
+* @scenario Tries to connect and disconnnect to the Cion server.
+* @apicovered cion_client_connect,cion_client_disconnect
+* @passcase If cion_client_connect,cion_client_disconnect is successfull
+* @failcase If cion_client_connect,cion_client_disconnect fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_client_connect_disconnect_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_client_h hClient = NULL;
+ cion_server_h hServer = NULL;
+ cion_peer_info_h hPeer = NULL;
+ g_bCallbackCalled = false;
+ int nTimeoutId = -1;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_client_connect_disconnect_p","ITc_cion_client_connect_disconnect_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_client_create(&hClient, "ITc_cion_client_connect_disconnect_p",NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal),cion_server_destroy(hServer));
+ CHECK_HANDLE(hClient,"cion_client_create");
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB,hServer);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB2,&hPeer);
+ RunPollingLoop();
+ if(g_bCallbackCalled != true)
+ {
+ FPRINTF("[Line : %d][%s] Callback ClientServerDiscoveredCB2 not invoked\\n", __LINE__, API_NAMESPACE);
+ cion_server_destroy(hServer);
+ cion_client_destroy(hClient);
+ return 1;
+ }
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+ CHECK_HANDLE(hPeer,"cion_client_try_discovery");
+
+ nRetVal = cion_client_connect(hClient, hPeer);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_connect", CionGetError(nRetVal),cion_peer_info_destroy(hPeer);cion_client_stop_discovery(hClient);cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_client_disconnect(hClient);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_disconnect", CionGetError(nRetVal),cion_peer_info_destroy(hPeer);cion_client_stop_discovery(hClient);cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_peer_info_destroy(hPeer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal));
+ hPeer = NULL;
+
+ nRetVal = cion_client_stop_discovery(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_stop_discovery", CionGetError(nRetVal));
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Sends the data.
+//& type: auto
+/**
+* @testcase ITc_cion_client_send_data_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sends the data.
+* @scenario Sends the data.
+* @apicovered cion_client_send_data
+* @passcase If cion_client_send_data is successfull
+* @failcase If cion_client_send_data fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_client_send_data_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_client_h hClient;
+ cion_server_h hServer;
+ g_bCallbackCalled = false;
+ g_bCallbackCalledDiscover = false;
+ int nTimeoutId = -1;
+
+ GThread *thread;
+ struct send_data cbdata = { 0 };
+ struct send_data send_data = { 0 };
+
+ nRetVal = cion_server_create(&hServer,"ITc_cion_client_send_data_p","ITc_cion_client_send_data_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_client_create(&hClient,"ITc_cion_client_send_data_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hClient,"cion_client_create");
+
+ nRetVal = cion_server_set_data_received_cb(hServer, ServerDataReceivedCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_set_data_received_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB,hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal));
+
+ nRetVal = cion_client_add_connection_result_cb(hClient,ClientConnectionResultCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_add_connection_result_cb", CionGetError(nRetVal));
+
+ cbdata.client = hClient;
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB4,&cbdata);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal));
+
+ RunPollingLoop();
+ if(g_bCallbackCalledDiscover != true)
+ {
+ FPRINTF("[Line : %d][%s] Callback ClientServerDiscoveredCB4 not invoked\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+ send_data.client = hClient;
+ thread = g_thread_new("send_data", SendDataThread, &send_data);
+
+ RunPollingLoop();
+ PRINT_RESULT(CION_ERROR_NONE, send_data.ret, "cion_client_try_discovery", CionGetError(send_data.ret));
+ if(strncmp((const char *)send_data.return_data, "data_result",send_data.return_data_size) != 0)
+ {
+ FPRINTF("[Line : %d][%s] data is not correct\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ FREE_MEMORY(send_data.return_data);
+ g_thread_unref(thread);
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Sends the payload asynchronously.
+//& type: auto
+/**
+* @testcase ITc_cion_client_send_payload_async_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sends the payload asynchronously.
+* @scenario Sends the payload asynchronously.
+* @apicovered cion_client_send_payload_async
+* @passcase If cion_client_send_payload_async is successfull
+* @failcase If cion_client_send_payload_async fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_client_send_payload_async_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_client_h hClient;
+ cion_server_h hServer;
+ cion_payload_h hPayload;
+ unsigned char pszData[] = "ITc_cion_client_send_payload_async_p";
+ struct cbdata cbdata;
+ g_bCallbackCalled = false;
+ int nTimeoutId = -1;
+
+ nRetVal = cion_server_create(&hServer,"ITc_cion_client_send_payload_async_p","ITc_cion_client_send_payload_async_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_client_create(&hClient,"ITc_cion_client_send_payload_async_p", NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal),cion_server_destroy(hServer));
+ CHECK_HANDLE(hClient,"cion_client_create");
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB,hServer);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal),cion_server_destroy(hServer);cion_client_destroy(hClient));
+
+ cbdata.client = hClient;
+ cbdata.connected = false;
+
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB3,&cbdata);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal),cion_server_destroy(hServer);cion_client_destroy(hClient));
+
+ RunPollingLoop();
+ if(g_bCallbackCalled != true)
+ {
+ FPRINTF("[Line : %d][%s] Callback ClientServerDiscoveredCB2 not invoked\\n", __LINE__, API_NAMESPACE);
+ cion_server_destroy(hServer);
+ cion_client_destroy(hClient);
+ return 1;
+ }
+
+ nRetVal = cion_payload_create(&hPayload, CION_PAYLOAD_TYPE_DATA);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal),cion_server_destroy(hServer);cion_client_destroy(hClient));
+ CHECK_HANDLE(hPayload,"cion_payload_create");
+
+ nRetVal = cion_payload_set_data(hPayload, pszData, sizeof(pszData));
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_set_data", CionGetError(nRetVal),cion_server_destroy(hServer);cion_client_destroy(hClient));
+
+ nRetVal = cion_client_send_payload_async(hClient, hPayload, NULL, NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_send_payload_async", CionGetError(nRetVal),cion_server_destroy(hServer);cion_client_destroy(hClient));
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Adds and remove callback function for connection result.
+//& type: auto
+/**
+* @testcase ITc_cion_client_add_remove_connection_result_cb_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Adds and remove callback function for connection result.
+* @scenario Adds and remove callback function for connection result.
+* @apicovered cion_client_add_connection_result_cb,cion_client_remove_connection_result_cb
+* @passcase If cion_client_add_connection_result_cb,cion_client_remove_connection_result_cb is successfull
+* @failcase If cion_client_add_connection_result_cb,cion_client_remove_connection_result_cb fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_client_add_remove_connection_result_cb_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_client_h hClient;
+
+ nRetVal = cion_client_create(&hClient,"ITc_cion_client_add_remove_connection_result_cb_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hClient,"cion_server_create");
+
+ nRetVal = cion_client_add_connection_result_cb(hClient,ClientConnectionResultCBAddRemove, NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_add_connection_result_cb", CionGetError(nRetVal),cion_client_destroy(hClient));
+
+ nRetVal = cion_client_remove_connection_result_cb(hClient,ClientConnectionResultCBAddRemove);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_remove_connection_result_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+//& purpose: Add and Removes callback function to receive payload.
+//& type: auto
+/**
+* @testcase ITc_cion_client_add_remove_payload_received_cb_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Add and Removes callback function to receive payload.
+* @scenario Add and Removes callback function to receive payload.
+* @apicovered cion_client_add_payload_received_cb,cion_client_remove_payload_received_cb
+* @passcase If cion_client_add_payload_received_cb,cion_client_remove_payload_received_cb is successfull
+* @failcase If cion_client_add_payload_received_cb,cion_client_remove_payload_received_cb fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_client_add_remove_payload_received_cb_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_client_h hClient;
+
+ nRetVal = cion_client_create(&hClient,"ITc_cion_client_add_remove_payload_received_cb_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hClient,"cion_server_create");
+
+ nRetVal = cion_client_add_payload_received_cb(hClient,ClientPayloadReceivedCB, NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_add_payload_received_cb", CionGetError(nRetVal),cion_client_destroy(hClient));
+
+ nRetVal = cion_client_remove_payload_received_cb(hClient,ClientPayloadReceivedCB);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_remove_payload_received_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+//& purpose: Adds and remove callback function for disconnection state.
+//& type: auto
+/**
+* @testcase ITc_cion_client_add_remove_disconnected_cb_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Adds and remove callback function for disconnection state.
+* @scenario Adds and remove callback function for disconnection state.
+* @apicovered cion_client_add_disconnected_cb,cion_client_remove_disconnected_cb
+* @passcase If cion_client_add_disconnected_cb,cion_client_remove_disconnected_cb is successfull
+* @failcase If cion_client_add_disconnected_cb,cion_client_remove_disconnected_cb fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_client_add_remove_disconnected_cb_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_client_h hClient;
+
+ nRetVal = cion_client_create(&hClient,"ITc_cion_client_add_remove_disconnected_cb_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hClient,"cion_server_create");
+
+ nRetVal = cion_client_add_disconnected_cb(hClient,ClientDisconnectedCB, NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_add_disconnected_cb", CionGetError(nRetVal),cion_client_destroy(hClient));
+
+ nRetVal = cion_client_remove_disconnected_cb(hClient,ClientDisconnectedCB);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_remove_disconnected_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+/** @} */
+/** @} */
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-cion-common.h"
+
+/** @addtogroup itc-cion
+* @ingroup itc
+* @{
+*/
+
+//Add helper function definitions here
+
+/**
+* @function CionGetError
+* @description print the error information
+* @parameter[in] nResult: the error code
+* @return pszErrorMsg: return the error message
+*/
+char *CionGetError(int nResult)
+{
+ char *pszErrorMsg = "UNDEFINED ERROR \n";
+
+ switch ( nResult )
+ {
+ case CION_ERROR_NONE :
+ pszErrorMsg = "CION_ERROR_NONE \n";
+ break;
+ case CION_ERROR_IO_ERROR :
+ pszErrorMsg = "CION_ERROR_IO_ERROR \n";
+ break;
+ case CION_ERROR_OUT_OF_MEMORY :
+ pszErrorMsg = "CION_ERROR_OUT_OF_MEMORY \n";
+ break;
+ case CION_ERROR_PERMISSION_DENIED :
+ pszErrorMsg = "CION_ERROR_PERMISSION_DENIED \n";
+ break;
+ case CION_ERROR_INVALID_PARAMETER :
+ pszErrorMsg = "CION_ERROR_INVALID_PARAMETER \n";
+ break;
+ case CION_ERROR_INVALID_OPERATION:
+ pszErrorMsg = "CION_ERROR_INVALID_OPERATION \n";
+ break;
+ case CION_ERROR_ALREADY_IN_PROGRESS:
+ pszErrorMsg = "CION_ERROR_ALREADY_IN_PROGRESS \n";
+ break;
+ case CION_ERROR_NOT_SUPPORTED :
+ pszErrorMsg = "CION_ERROR_NOT_SUPPORTED \n";
+ break;
+ case CION_ERROR_TIMED_OUT :
+ pszErrorMsg = "CION_ERROR_TIMED_OUT \n";
+ break;
+ case CION_ERROR_OPERATION_FAILED :
+ pszErrorMsg = "CION_ERROR_OPERATION_FAILED \n";
+ break;
+ default:
+ break;
+ }
+ return pszErrorMsg;
+}
+
+/**
+* @function Timeout
+* @description Called if some callback is not invoked for a particular timeout
+* @parameter gpointer data
+* @return gboolean
+*/
+gboolean Timeout(gpointer data)
+{
+ GMainLoop *pMainLoop = NULL;
+ pMainLoop = (GMainLoop *)data;
+ if ( pMainLoop != NULL )
+ {
+ g_main_loop_quit(pMainLoop);
+ }
+ FPRINTF("[Line : %d][%s] Callback Timeout\\n", __LINE__, API_NAMESPACE);
+ return false;
+}
+
+/** @} */
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef _ITS_CION_COMMON_H_
+#define _ITS_CION_COMMON_H_
+
+//Add test package related includes here
+#include "tct_common.h"
+#include <cion.h>
+#include <glib.h>
+#include <dlog.h>
+#include <app_manager.h>
+#include <app_control.h>
+#include <app.h>
+
+#define API_NAMESPACE "CION_ITC"
+#define TIMEOUT_CB 10000
+#define TIMEOUT_CB1 5000
+/** @addtogroup itc-%{MODULE_NAME}
+* @ingroup itc
+* @{
+*/
+#define START_TEST {\
+ FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\
+}
+
+#define START_TEST_PAYLOAD {\
+ FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\
+ if ( !g_bCionPayloadCreation )\
+{\
+ FPRINTF("[Line : %d][%s] Precondition of cion failed so leaving test\\n", __LINE__, API_NAMESPACE);\
+ return 1;\
+}\
+}
+
+#define RUN_POLLING_LOOP {\
+ if(g_bCallbackCalled == false)\
+ {\
+ g_pMainLoop = g_main_loop_new(NULL, false);\
+ g_nTimeoutId = g_timeout_add(TIMEOUT_CB, Timeout, g_pMainLoop);\
+ g_main_loop_run(g_pMainLoop);\
+ g_source_remove(g_nTimeoutId);\
+ g_pMainLoop = NULL;\
+ }\
+}
+
+#define RUN_POLLING_LOOP1 {\
+ if(g_bCallbackCalled == false)\
+ {\
+ g_pMainLoop = g_main_loop_new(NULL, false);\
+ g_nTimeoutId = g_timeout_add(TIMEOUT_CB1, Timeout, g_pMainLoop);\
+ g_main_loop_run(g_pMainLoop);\
+ g_source_remove(g_nTimeoutId);\
+ g_pMainLoop = NULL;\
+ }\
+}
+
+#define CHECK_HANDLE_CLEANUP(Handle, API, FreeResource) {\
+ if ( Handle == NULL )\
+ {\
+ FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\
+ FreeResource;\
+ return 1;\
+ }\
+}
+//Add helper function declarations here
+bool g_bCionPayloadCreation;
+int g_nTimeoutId;
+static GMainLoop *g_pMainLoop = NULL;
+bool g_bCallbackCalled;
+gboolean Timeout(gpointer data);
+char *CionGetError(int nResult);
+
+/** @} */
+#endif //_ITS_CION_COMMON_H_
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-cion-common.h"
+
+//& set: Cion
+
+/** @addtogroup itc-cion
+* @ingroup itc
+* @{
+*/
+
+/**
+ * @function ITs_cion_group_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_group_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+
+ return;
+}
+
+
+/**
+ * @function ITs_cion_group_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_group_cleanup(void)
+{
+ return;
+}
+
+/** @addtogroup itc-cion-testcases
+* @brief Integration testcases for module cion
+* @ingroup itc-cion
+* @{
+*/
+
+//& purpose: Creates and destroy a Cion group handle
+//& type: auto
+/**
+* @testcase ITc_cion_group_create_destroy_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates and destroy a Cion group handle
+* @scenario Creates and destroy a Cion group handle
+* @apicovered cion_group_create,cion_group_destroy
+* @passcase If cion_group_create,cion_group_destroy is successfull
+* @failcase If cion_group_create,cion_group_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_group_create_destroy_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_group_h hGroup = NULL;
+
+ nRetVal = cion_group_create(&hGroup, "ITc_cion_group_create_destroy_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_group_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hGroup,"cion_group_create");
+
+ nRetVal = cion_group_destroy(hGroup);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_group_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Subscribes and Unsubscribes to a topic that the group handle has.
+//& type: auto
+/**
+* @testcase ITc_cion_group_subscribe_unsubscribe_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Subscribes and Unsubscribes to a topic that the group handle has.
+* @scenario Subscribes and Unsubscribes to a topic that the group handle has.
+* @apicovered cion_group_subscribe,cion_group_unsubscribe
+* @passcase If cion_group_subscribe,cion_group_unsubscribe is successfull
+* @failcase If cion_group_subscribe,cion_group_unsubscribe fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_group_subscribe_unsubscribe_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_group_h hGroup = NULL;
+
+ nRetVal = cion_group_create(&hGroup, "ITc_cion_group_subscribe_unsubscribe_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_group_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hGroup,"cion_group_create");
+
+ nRetVal = cion_group_subscribe(hGroup);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_group_subscribe", CionGetError(nRetVal),cion_group_destroy(hGroup));
+
+ nRetVal = cion_group_unsubscribe(hGroup);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_group_unsubscribe", CionGetError(nRetVal),cion_group_destroy(hGroup));
+
+ nRetVal = cion_group_destroy(hGroup);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_group_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Publishes data to the group.
+//& type: auto
+/**
+* @testcase ITc_cion_group_publish_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Publishes data to the group.
+* @scenario Publishes data to the group.
+* @apicovered cion_group_publish
+* @passcase If cion_group_publish is successfull
+* @failcase If cion_group_publish fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_group_publish_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_group_h hGroup = NULL;
+ cion_payload_h hPayload;
+ unsigned char data[] = "test data";
+
+ nRetVal = cion_group_create(&hGroup, "ITc_cion_group_publish_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_group_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hGroup,"cion_group_create");
+
+ nRetVal = cion_group_subscribe(hGroup);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_group_subscribe", CionGetError(nRetVal),cion_group_destroy(hGroup));
+
+ nRetVal = cion_payload_create(&hPayload, CION_PAYLOAD_TYPE_DATA);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal),cion_group_unsubscribe(hGroup);cion_group_destroy(hGroup));
+ CHECK_HANDLE(hPayload,"cion_payload_create");
+
+ nRetVal = cion_payload_set_data(hPayload, data, sizeof(data));
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_set_data", CionGetError(nRetVal),cion_group_unsubscribe(hGroup);cion_group_destroy(hGroup));
+
+ nRetVal = cion_group_publish(hGroup, hPayload);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_group_publish", CionGetError(nRetVal),cion_group_unsubscribe(hGroup);cion_group_destroy(hGroup));
+
+ nRetVal = cion_group_unsubscribe(hGroup);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_group_unsubscribe", CionGetError(nRetVal),cion_group_destroy(hGroup));
+
+ nRetVal = cion_group_destroy(hGroup);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_group_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+/** @} */
+/** @} */
\ No newline at end of file
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-cion-common.h"
+
+//& set: Cion
+
+/** @addtogroup itc-cion
+* @ingroup itc
+* @{
+*/
+static cion_server_h g_hServer;
+static cion_client_h g_hClient;
+bool connected = false;
+bool g_asyncResult;
+
+/**
+* @function ConnectionRequestCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ConnectionRequestCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ConnectionRequestCB\\n", __LINE__, API_NAMESPACE);
+ int nRetVal = -1;
+ nRetVal = cion_server_accept(g_hServer, peer_info);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_server_accept Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+}
+
+/**
+* @function ServerDiscoveredCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ServerDiscoveredCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ServerDiscoveredCB\\n", __LINE__, API_NAMESPACE);
+ int nRetVal = -1;
+ nRetVal = cion_client_connect(g_hClient, peer_info);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_client_connect Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+}
+
+/**
+* @function ConnectionResultCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info,const cion_connection_result_h result, void *user_data
+* @return NA
+*/
+static void ConnectionResultCB(const char *service_name,const cion_peer_info_h peer_info,const cion_connection_result_h result, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ConnectionResultCB\\n", __LINE__, API_NAMESPACE);
+ cion_connection_status_e eStatus;
+ int nRetVal = -1;
+ nRetVal = cion_connection_result_get_status(result, &eStatus);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_connection_result_get_status Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ if (eStatus == CION_CONNECTION_STATUS_OK)
+ {
+ FPRINTF("[Line : %d][%s] Connection established\\n", __LINE__, API_NAMESPACE);
+ connected = true;
+ }
+ if (g_pMainLoop )
+ {
+ g_main_loop_quit(g_pMainLoop);
+ g_pMainLoop = NULL;
+ }
+}
+
+/**
+* @function PayloadAsyncResultCB
+* @description Callback function
+* @parameter const cion_payload_async_result_h result,void *user_data
+* @return NA
+*/
+void PayloadAsyncResultCB(const cion_payload_async_result_h result,void *user_data)
+{
+ g_asyncResult = true;
+ FPRINTF("[Line : %d][%s] Inside PayloadAsyncResultCB\\n", __LINE__, API_NAMESPACE);
+ int nRetVal = -1;
+ cion_payload_async_result_h *hClone =(cion_payload_async_result_h *)user_data;
+
+ nRetVal = cion_payload_async_result_clone(result, hClone);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] Failed to clone payload async result\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ if (g_pMainLoop )
+ {
+ g_main_loop_quit(g_pMainLoop);
+ g_pMainLoop = NULL;
+ }
+}
+/**
+ * @function ITs_cion_payload_async_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_payload_async_startup(void)
+{
+ g_bCionPayloadCreation = false;
+ g_hClient = NULL;
+ g_hServer = NULL;
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+ int nRetVal = -1;
+ if (connected)
+ return;
+
+ nRetVal = cion_server_create(&g_hServer,"ITs_cion_payload_async_startup","ITs_cion_payload_async_startup", NULL);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_server_create Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ nRetVal = cion_client_create(&g_hClient,"ITs_cion_payload_async_startup", NULL);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_client_create Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ nRetVal = cion_server_listen(g_hServer, ConnectionRequestCB,g_hServer);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_server_listen Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ nRetVal = cion_client_add_connection_result_cb(g_hClient,ConnectionResultCB, NULL);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_client_add_connection_result_cb Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ nRetVal = cion_client_try_discovery(g_hClient, ServerDiscoveredCB, NULL);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_client_try_discovery Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ RUN_POLLING_LOOP1;
+ sleep(2);
+ g_bCionPayloadCreation = true;
+ return;
+}
+
+
+/**
+ * @function ITs_cion_payload_async_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_payload_async_cleanup(void)
+{
+ int nRetVal = -1;
+ connected = false;
+ if(g_hClient)
+ {
+ nRetVal = cion_client_destroy(g_hClient);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_client_destroy Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ g_hClient = NULL;
+ }
+ if(g_hServer)
+ {
+ nRetVal = cion_server_destroy(g_hServer);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_server_destroy Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ g_hServer = NULL;
+ }
+ return;
+}
+
+/** @addtogroup itc-cion-testcases
+* @brief Integration testcases for module cion
+* @ingroup itc-cion
+* @{
+*/
+
+//& purpose: Creates a clone of payload async result.
+//& type: auto
+/**
+* @testcase ITc_cion_payload_async_result_clone_destroy_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates a clone of payload async result.
+* @scenario Creates a clone of payload async result.
+* @apicovered cion_payload_async_result_clone,cion_payload_async_result_destroy
+* @passcase If cion_payload_async_result_clone,cion_payload_async_result_destroy is successfull
+* @failcase If cion_payload_async_result_clone,cion_payload_async_result_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_async_result_clone_destroy_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ cion_payload_h hPayload;
+ g_asyncResult = false;
+ cion_payload_async_result_h hResult = NULL;
+ unsigned char data[] = "ITc_cion_payload_async_result_clone_destroy_p";
+
+ if (!connected)
+ {
+ FPRINTF("[Line : %d][%s] cion_server_accept Failed\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_payload_create(&hPayload, CION_PAYLOAD_TYPE_DATA);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_set_data(hPayload, data, sizeof(data));
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_set_data", CionGetError(nRetVal),cion_payload_destroy(hPayload));
+
+ nRetVal = cion_client_send_payload_async(g_hClient, hPayload,PayloadAsyncResultCB, &hResult);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_send_payload_async", CionGetError(nRetVal),cion_payload_destroy(hPayload));
+
+ RUN_POLLING_LOOP1;
+ if(g_asyncResult == false)
+ {
+ FPRINTF("[Line : %d][%s] PayloadAsyncResultCB callback not hit\\n", __LINE__, API_NAMESPACE);
+ cion_payload_destroy(hPayload);
+ return 1;
+ }
+ CHECK_HANDLE(hResult,"cion_client_send_payload_async");
+
+ nRetVal = cion_payload_destroy(hPayload);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_destroy", CionGetError(nRetVal),cion_payload_async_result_destroy(hResult));
+
+ nRetVal = cion_payload_async_result_destroy(hResult);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_async_result_destroy", CionGetError(nRetVal));
+ g_asyncResult = false;
+
+ return 0;
+}
+
+//& purpose: Gets the peer information from async result.
+//& type: auto
+/**
+* @testcase ITc_cion_payload_async_result_clone_destroy_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the peer information from async result.
+* @scenario Gets the peer information from async result.
+* @apicovered cion_payload_async_result_get_peer_info
+* @passcase If cion_payload_async_result_get_peer_info is successfull
+* @failcase If cion_payload_async_result_get_peer_info fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_async_result_get_peer_info_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ cion_payload_h hPayload;
+ g_asyncResult = false;
+ cion_payload_async_result_h hResult = NULL;
+ unsigned char data[] = "ITc_cion_payload_async_result_get_peer_info_p";
+ cion_peer_info_h hPeer = NULL;
+
+ if (!connected)
+ {
+ FPRINTF("[Line : %d][%s] cion_server_accept Failed\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_payload_create(&hPayload, CION_PAYLOAD_TYPE_DATA);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_set_data(hPayload, data, sizeof(data));
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_set_data", CionGetError(nRetVal),cion_peer_info_destroy(hPeer));
+
+ nRetVal = cion_client_send_payload_async(g_hClient, hPayload,PayloadAsyncResultCB, &hResult);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_send_payload_async", CionGetError(nRetVal),cion_peer_info_destroy(hPeer));
+
+ RUN_POLLING_LOOP1;
+ if(g_asyncResult == false)
+ {
+ FPRINTF("[Line : %d][%s] PayloadAsyncResultCB callback not hit\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+ CHECK_HANDLE(hResult,"cion_payload_async_result_get_peer_info");
+
+ nRetVal = cion_payload_async_result_get_peer_info(hResult, &hPeer);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_async_result_get_peer_info", CionGetError(nRetVal),cion_peer_info_destroy(hPeer));
+ CHECK_HANDLE(hPeer,"cion_payload_async_result_get_peer_info");
+
+ nRetVal = cion_peer_info_destroy(hPeer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_destroy(hPayload);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_payload_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_async_result_destroy(hResult);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_payload_async_result_destroy", CionGetError(nRetVal));
+ g_asyncResult = false;
+
+ return 0;
+}
+
+//& purpose: Gets the payload ID.
+//& type: auto
+/**
+* @testcase ITc_cion_payload_async_result_get_payload_id_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the payload ID.
+* @scenario Gets the payload ID.
+* @apicovered cion_payload_async_result_get_payload_id
+* @passcase If cion_payload_async_result_get_payload_id is successfull
+* @failcase If cion_payload_async_result_get_payload_id fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_async_result_get_payload_id_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ cion_payload_h hPayload;
+ g_asyncResult = false;
+ cion_payload_async_result_h hResult = NULL;
+ unsigned char data[] = "ITc_cion_payload_async_result_get_payload_id_p";
+ char *payload_id = NULL;
+
+ if (!connected)
+ {
+ FPRINTF("[Line : %d][%s] cion_server_accept Failed\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_payload_create(&hPayload, CION_PAYLOAD_TYPE_DATA);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_set_data(hPayload, data, sizeof(data));
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal),cion_payload_destroy(hPayload));
+
+ nRetVal = cion_client_send_payload_async(g_hClient, hPayload,PayloadAsyncResultCB, &hResult);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal),cion_payload_destroy(hPayload));
+
+ RUN_POLLING_LOOP1;
+ if(g_asyncResult == false)
+ {
+ FPRINTF("[Line : %d][%s] PayloadAsyncResultCB callback not hit\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+ CHECK_HANDLE(hResult,"cion_client_send_payload_async");
+
+ nRetVal = cion_payload_async_result_get_payload_id(hResult, &payload_id);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_async_result_get_payload_id", CionGetError(nRetVal),cion_payload_destroy(hPayload));
+ CHECK_HANDLE(payload_id,"cion_payload_async_result_get_payload_id");
+
+ FREE_MEMORY(payload_id);
+ nRetVal = cion_payload_destroy(hPayload);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_async_result_destroy(hResult);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal));
+ g_asyncResult = false;
+ return 0;
+}
+
+/** @} */
+/** @} */
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-cion-common.h"
+
+//& set: Cion
+
+/** @addtogroup itc-cion
+* @ingroup itc
+* @{
+*/
+static cion_payload_h g_hPayload;
+static GMainLoop *main_loop;
+static guint source_id;
+static gboolean __timeout_cb(gpointer data)
+{
+ g_main_loop_quit(main_loop);
+ return FALSE;
+}
+
+static void RunPollingLoop(void) {
+ main_loop = g_main_loop_new(NULL, FALSE);
+ source_id = g_timeout_add(5000, __timeout_cb, NULL);\
+ g_main_loop_run(main_loop);\
+ g_source_remove(source_id);
+ main_loop = NULL;
+}
+
+static void StopPollingLoop(void) {
+ sleep(1);
+ g_source_remove(source_id);
+ g_main_loop_quit(main_loop);
+}
+
+struct cbdata {
+ cion_client_h client;
+ bool connected;
+};
+
+/**
+* @function ServerConnectionRequestCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ServerConnectionRequestCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ int ret;
+ cion_server_h server = (cion_server_h)user_data;
+ ret = cion_server_accept(server, peer_info);
+ if (ret != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ClientServerDiscoveredCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ClientServerDiscoveredCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ int ret;
+ cion_client_h client = (cion_client_h)user_data;
+
+ ret = cion_client_connect(client, peer_info);
+ if (ret != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ConnectionResultCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info,const cion_connection_result_h result, void *user_data
+* @return NA
+*/
+static void ConnectionResultCB(const char *service_name,const cion_peer_info_h peer_info,const cion_connection_result_h result, void *user_data)
+{
+ int ret;
+ cion_connection_status_e status = CION_CONNECTION_STATUS_ERROR;
+ bool *connected = (bool *)user_data;
+
+ ret = cion_connection_result_get_status(result, &status);
+ if (ret != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+
+ if (status == CION_CONNECTION_STATUS_OK) {
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ *connected = true;
+ } else {
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ *connected = false;
+ }
+
+ StopPollingLoop();
+}
+
+/**
+* @function ServerPayloadReceivedCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, const cion_payload_h payload,cion_payload_transfer_status_e status, void *user_data
+* @return NA
+*/
+static void ServerPayloadReceivedCB(const char *service_name,const cion_peer_info_h peer_info, const cion_payload_h payload,cion_payload_transfer_status_e status, void *user_data)
+{
+ char *data_path;
+ char save_as[PATH_MAX];
+ int *result = (int *)user_data;
+
+ if (status == CION_PAYLOAD_TRANSFER_STATUS_FAILURE) {
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ if (status == CION_PAYLOAD_TRANSFER_STATUS_IN_PROGRESS) {
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ data_path = app_get_data_path();
+ snprintf(save_as, sizeof(save_as), "%s/download.png", data_path);
+ free(data_path);
+
+ *result = cion_payload_save_as_file(payload, save_as);
+
+ StopPollingLoop();
+}
+
+/**
+* @function ServerPayloadReceivedCB2
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, const cion_payload_h payload,cion_payload_transfer_status_e status, void *user_data
+* @return NA
+*/
+static void ServerPayloadReceivedCB2(const char *service_name,
+ const cion_peer_info_h peer_info, const cion_payload_h payload,
+ cion_payload_transfer_status_e status, void *user_data)
+{
+ int *result = (int *)user_data;
+ char *file_name;
+
+ if (status == CION_PAYLOAD_TRANSFER_STATUS_FAILURE) {
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ if (status == CION_PAYLOAD_TRANSFER_STATUS_IN_PROGRESS) {
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ *result = cion_payload_get_received_file_name(payload, &file_name);
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ free(file_name);
+ StopPollingLoop();
+}
+
+/**
+* @function ServerPayloadReceivedCB3
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, const cion_payload_h payload,cion_payload_transfer_status_e status, void *user_data
+* @return NA
+*/
+static void ServerPayloadReceivedCB3(const char *service_name,
+ const cion_peer_info_h peer_info, const cion_payload_h payload,
+ cion_payload_transfer_status_e status, void *user_data)
+{
+ int *result = (int *)user_data;
+ uint64_t bytes;
+
+ if (status == CION_PAYLOAD_TRANSFER_STATUS_FAILURE) {
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ if (status == CION_PAYLOAD_TRANSFER_STATUS_IN_PROGRESS) {
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ *result = cion_payload_get_received_bytes(payload, &bytes);
+ StopPollingLoop();
+}
+
+/**
+* @function ServerPayloadReceivedCB4
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, const cion_payload_h payload,cion_payload_transfer_status_e status, void *user_data
+* @return NA
+*/
+static void ServerPayloadReceivedCB4(const char *service_name,
+ const cion_peer_info_h peer_info, const cion_payload_h payload,
+ cion_payload_transfer_status_e status, void *user_data)
+{
+ int *result = (int *)user_data;
+ uint64_t bytes;
+
+ if (status == CION_PAYLOAD_TRANSFER_STATUS_FAILURE) {
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ if (status == CION_PAYLOAD_TRANSFER_STATUS_IN_PROGRESS) {
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ *result = cion_payload_get_total_bytes(payload, &bytes);
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ StopPollingLoop();
+}
+/**
+ * @function ITs_cion_payload_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_payload_startup(void)
+{
+ g_bCionPayloadCreation = false;
+ g_hPayload = NULL;
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+ int nRetVal = -1;
+ nRetVal = cion_payload_create(&g_hPayload, CION_PAYLOAD_TYPE_DATA);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] Failed to create payload handle\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ g_bCionPayloadCreation = true;
+ return;
+}
+
+
+/**
+ * @function ITs_cion_payload_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_payload_cleanup(void)
+{
+ if(g_hPayload)
+ {
+ cion_payload_destroy(g_hPayload);
+ g_hPayload = NULL;
+ }
+ return;
+}
+
+/** @addtogroup itc-cion-testcases
+* @brief Integration testcases for module cion
+* @ingroup itc-cion
+* @{
+*/
+
+//& purpose: Creates and destroy a payload handle.
+//& type: auto
+/**
+* @testcase ITc_cion_payload_create_destroy_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates and destroy a payload handle.
+* @scenario Creates and destroy a payload handle.
+* @apicovered cion_payload_create,cion_payload_destroy
+* @passcase If cion_payload_create,cion_payload_destroy is successfull
+* @failcase If cion_payload_create,cion_payload_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_create_destroy_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+
+ nRetVal = cion_payload_destroy(g_hPayload);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_create(&g_hPayload, CION_PAYLOAD_TYPE_DATA);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal));
+ CHECK_HANDLE(g_hPayload,"cion_payload_create");
+
+ nRetVal = cion_payload_destroy(g_hPayload);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_create(&g_hPayload, CION_PAYLOAD_TYPE_DATA);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal));
+ CHECK_HANDLE(g_hPayload,"cion_payload_create");
+
+ return 0;
+}
+
+//& purpose: Gets the type of payload.
+//& type: auto
+/**
+* @testcase ITc_cion_payload_get_type_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the type of payload.
+* @scenario Gets the type of payload.
+* @apicovered cion_payload_get_type
+* @passcase If cion_payload_get_type is successfull
+* @failcase If cion_payload_get_type fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_get_type_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ cion_payload_type_e eType;
+
+ nRetVal = cion_payload_get_type(g_hPayload, &eType);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_get_type", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Sets and Gets the data to payload.
+//& type: auto
+/**
+* @testcase ITc_cion_payload_set_get_data_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets and Gets the data to payload.
+* @scenario Sets and Gets the data to payload.
+* @apicovered cion_payload_set_data,cion_payload_get_data
+* @passcase If cion_payload_set_data,cion_payload_get_data is successfull
+* @failcase If cion_payload_set_data,cion_payload_get_data fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_set_get_data_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ unsigned char pszData[] = "ITc_cion_payload_get_data_p";
+ unsigned char *pszGetData = NULL;
+ unsigned int nDataSize = 0;
+
+ nRetVal = cion_payload_set_data(g_hPayload, pszData, sizeof(pszData));
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_set_data", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_get_data(g_hPayload, &pszGetData, &nDataSize);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_get_data", CionGetError(nRetVal));
+ CHECK_HANDLE(pszGetData,"cion_payload_get_data");
+ if(nDataSize != sizeof(pszData))
+ {
+ FPRINTF("[Line : %d][%s] Value Mismatch\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ return 0;
+}
+
+//& purpose: Sets the file path to send payload.
+//& type: auto
+/**
+* @testcase ITc_cion_payload_set_file_path_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets the file path to send payload.
+* @scenario Sets the file path to send payload.
+* @apicovered cion_payload_set_file_path
+* @passcase If cion_payload_set_file_path is successfull
+* @failcase Ifcion_payload_set_file_path fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_set_file_path_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ cion_payload_h hFilePayload;
+ char *pszResPath;
+ char pszPath[PATH_MAX];
+
+ pszResPath = app_get_shared_resource_path();
+ snprintf(pszPath, sizeof(pszPath), "%s/cion-native-itc.png", pszResPath);
+ FREE_MEMORY(pszResPath);
+
+ nRetVal = cion_payload_create(&hFilePayload, CION_PAYLOAD_TYPE_FILE);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_set_file_path(hFilePayload, pszPath);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_set_file_path", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Gets the ID of payload.
+//& type: auto
+/**
+* @testcase ITc_cion_payload_get_payload_id_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the ID of payload.
+* @scenario Gets the ID of payload.
+* @apicovered cion_payload_get_payload_id
+* @passcase If cion_payload_get_payload_id is successfull
+* @failcase If cion_payload_get_payload_id fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_get_payload_id_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ char *pszPayloadID = NULL;
+
+ nRetVal = cion_payload_get_payload_id(g_hPayload, &pszPayloadID);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_get_payload_id", CionGetError(nRetVal));
+
+ FREE_MEMORY(pszPayloadID);
+
+ return 0;
+}
+
+//& purpose: Saves the payload as a file.
+//& type: auto
+/**
+* @testcase ITc_cion_payload_save_as_file_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Saves the payload as a file.
+* @scenario Saves the payload as a file.
+* @apicovered cion_payload_save_as_file
+* @passcase If cion_payload_save_as_file is successfull
+* @failcase If cion_payload_save_as_file fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_save_as_file_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ cion_client_h hClient;
+ cion_server_h hServer;
+ bool connected = false;
+ cion_payload_h payload;
+ char icon_path[PATH_MAX];
+ char *shared_res_path;
+ int result = CION_ERROR_OPERATION_FAILED;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_payload_save_as_file_p","ITc_cion_payload_save_as_file_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_client_create(&hClient, "ITc_cion_payload_save_as_file_p", NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal),cion_server_destroy(hServer));
+
+
+ nRetVal = cion_client_add_connection_result_cb(hClient,ConnectionResultCB, &connected);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_add_connection_result_cb", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB, hServer);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB, hClient);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ RunPollingLoop();
+
+ nRetVal = cion_server_add_payload_received_cb(hServer,ServerPayloadReceivedCB, &result);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_server_add_payload_received_cb", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ shared_res_path = app_get_shared_resource_path();
+ snprintf(icon_path, sizeof(icon_path), "%s/cion-native-itc.png",
+ shared_res_path);
+ free(shared_res_path);
+
+ nRetVal = cion_payload_create(&payload, CION_PAYLOAD_TYPE_FILE);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_payload_set_file_path(payload, icon_path);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_set_file_path", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_client_send_payload_async(hClient, payload, NULL, NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_send_payload_async", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ RunPollingLoop();
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, result, "cion_client_send_payload_async", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Gets the name of received file from the payload.
+//& type: auto
+/**
+* @testcase ITc_cion_payload_get_received_file_name_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the name of received file from the payload.
+* @scenario Gets the name of received file from the payload.
+* @apicovered cion_payload_get_received_file_name
+* @passcase If cion_payload_get_received_file_name is successfull
+* @failcase If cion_payload_get_received_file_name fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_get_received_file_name_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ cion_client_h hClient;
+ cion_server_h hServer;
+ bool connected = false;
+ cion_payload_h payload;
+ char icon_path[PATH_MAX];
+ char *shared_res_path;
+ int result = CION_ERROR_OPERATION_FAILED;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_payload_get_received_file_name_p","ITc_cion_payload_get_received_file_name_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_client_create(&hClient, "ITc_cion_payload_get_received_file_name_p", NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal),cion_server_destroy(hServer));
+
+
+ nRetVal = cion_client_add_connection_result_cb(hClient,ConnectionResultCB, &connected);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_add_connection_result_cb", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB, hServer);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB, hClient);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ RunPollingLoop();
+
+ nRetVal = cion_server_add_payload_received_cb(hServer,ServerPayloadReceivedCB2, &result);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_server_add_payload_received_cb", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ shared_res_path = app_get_shared_resource_path();
+ snprintf(icon_path, sizeof(icon_path), "%s/cion-native-itc.png",shared_res_path);
+ free(shared_res_path);
+
+ nRetVal = cion_payload_create(&payload, CION_PAYLOAD_TYPE_FILE);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_payload_set_file_path(payload, icon_path);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_set_file_path", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_client_send_payload_async(hClient, payload, NULL, NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_send_payload_async", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ RunPollingLoop();
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, result, "cion_client_try_discovery", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Gets the size of currently received file from the payload.
+//& type: auto
+/**
+* @testcase ITc_cion_payload_get_received_bytes_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the size of currently received file from the payload.
+* @scenario Gets the size of currently received file from the payload.
+* @apicovered cion_payload_get_received_bytes
+* @passcase If cion_payload_get_received_bytes is successfull
+* @failcase If cion_payload_get_received_bytes fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_get_received_bytes_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ cion_client_h hClient;
+ cion_server_h hServer;
+ bool connected = false;
+ cion_payload_h payload;
+ char icon_path[PATH_MAX];
+ char *shared_res_path;
+ int result = CION_ERROR_OPERATION_FAILED;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_payload_get_received_bytes_p","ITc_cion_payload_get_received_bytes_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_client_create(&hClient, "ITc_cion_payload_get_received_bytes_p", NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal),cion_server_destroy(hServer));
+
+
+ nRetVal = cion_client_add_connection_result_cb(hClient,ConnectionResultCB, &connected);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_add_connection_result_cb", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB, hServer);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB, hClient);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ RunPollingLoop();
+
+ nRetVal = cion_server_add_payload_received_cb(hServer,ServerPayloadReceivedCB3, &result);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_server_add_payload_received_cb", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ shared_res_path = app_get_shared_resource_path();
+ snprintf(icon_path, sizeof(icon_path), "%s/cion-native-itc.png",shared_res_path);
+ free(shared_res_path);
+
+ nRetVal = cion_payload_create(&payload, CION_PAYLOAD_TYPE_FILE);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_payload_set_file_path(payload, icon_path);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_set_file_path", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_client_send_payload_async(hClient, payload, NULL, NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_send_payload_async", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ RunPollingLoop();
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, result, "cion_client_send_payload_async", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Gets the total size of file from the payload
+//& type: auto
+/**
+* @testcase ITc_cion_payload_get_total_bytes_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the total size of file from the payload
+* @scenario Gets the total size of file from the payload
+* @apicovered cion_payload_get_total_bytes
+* @passcase If cion_payload_get_total_bytes is successfull
+* @failcase If cion_payload_get_total_bytes fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_payload_get_total_bytes_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ cion_client_h hClient;
+ cion_server_h hServer;
+ bool connected = false;
+ cion_payload_h payload;
+ char icon_path[PATH_MAX];
+ char *shared_res_path;
+ int result = CION_ERROR_OPERATION_FAILED;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_payload_get_total_bytes_p","ITc_cion_payload_get_total_bytes_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_client_create(&hClient, "ITc_cion_payload_get_total_bytes_p", NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal),cion_server_destroy(hServer));
+
+
+ nRetVal = cion_client_add_connection_result_cb(hClient,ConnectionResultCB, &connected);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_add_connection_result_cb", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB, hServer);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB, hClient);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ RunPollingLoop();
+
+ nRetVal = cion_server_add_payload_received_cb(hServer,ServerPayloadReceivedCB4, &result);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_server_add_payload_received_cb", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ shared_res_path = app_get_shared_resource_path();
+ snprintf(icon_path, sizeof(icon_path), "%s/cion-native-itc.png",shared_res_path);
+ free(shared_res_path);
+
+ nRetVal = cion_payload_create(&payload, CION_PAYLOAD_TYPE_FILE);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_payload_set_file_path(payload, icon_path);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_payload_set_file_path", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ nRetVal = cion_client_send_payload_async(hClient, payload, NULL, NULL);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_client_send_payload_async", CionGetError(nRetVal),cion_client_destroy(hClient);cion_server_destroy(hServer));
+
+ RunPollingLoop();
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, result, "cion_client_try_discovery", CionGetError(nRetVal));
+
+ return 0;
+}
+
+
+/** @} */
+/** @} */
\ No newline at end of file
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-cion-common.h"
+
+//& set: Cion
+
+/** @addtogroup itc-cion
+* @ingroup itc
+* @{
+*/
+static cion_server_h g_hServer;
+static cion_client_h g_hClient;
+static cion_peer_info_h g_hPeer;
+bool bIsServerDiscovered = false;
+
+/**
+* @function ConnectionRequestCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ConnectionRequestCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Callback ConnectionRequestCB called\\n", __LINE__, API_NAMESPACE);
+ int nRetVal = -1;
+ cion_server_h hServer = (cion_server_h)user_data;
+
+ nRetVal = cion_server_accept(hServer, peer_info);
+ if (nRetVal != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] Failed to accept client\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ServerDiscoveredCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ServerDiscoveredCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Callback ServerDiscoveredCB called\\n", __LINE__, API_NAMESPACE);
+ int nRetVal = -1;
+ nRetVal = cion_peer_info_clone(peer_info, &g_hPeer);
+ if (nRetVal != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] Failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ bIsServerDiscovered = true;
+
+ if (g_pMainLoop )
+ {
+ g_main_loop_quit(g_pMainLoop);
+ g_pMainLoop = NULL;
+ }
+}
+
+/**
+ * @function ITs_cion_peer_info_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_peer_info_startup(void)
+{
+ g_bCionPayloadCreation = false;
+ g_hClient = NULL;
+ g_hServer = NULL;
+ g_hPeer = NULL;
+ bIsServerDiscovered = false;
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+ int nRetVal = -1;
+ nRetVal = cion_server_create(&g_hServer, "ITs_cion_peer_info_startup","ITs_cion_peer_info_startup", NULL);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_server_create Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ if (g_hServer == NULL)
+ {
+ FPRINTF("[Line : %d][%s] g_hServer is NULL\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ nRetVal = cion_client_create(&g_hClient, "ITs_cion_peer_info_startup",NULL);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_client_create Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ if (g_hClient == NULL)
+ {
+ FPRINTF("[Line : %d][%s] g_hClient is NULL\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ nRetVal = cion_server_listen(g_hServer, ConnectionRequestCB,NULL);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_server_listen Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+
+ nRetVal = cion_client_try_discovery(g_hClient, ServerDiscoveredCB, NULL);
+ RUN_POLLING_LOOP;
+ sleep(2);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_client_try_discovery Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ g_bCionPayloadCreation = true;
+ return;
+}
+
+
+/**
+ * @function ITs_cion_peer_info_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_peer_info_cleanup(void)
+{
+ int nRetVal = -1;
+ bIsServerDiscovered = false;
+ if(g_hPeer)
+ {
+ nRetVal = cion_peer_info_destroy(g_hPeer);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_peer_info_destroy Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ g_hPeer = NULL;
+ }
+ if(g_hClient)
+ {
+ nRetVal = cion_client_stop_discovery(g_hClient);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_client_destroy Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ nRetVal = cion_client_destroy(g_hClient);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_client_destroy Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ g_hClient = NULL;
+ }
+ if(g_hServer)
+ {
+ nRetVal = cion_server_destroy(g_hServer);
+ if (nRetVal != CION_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] cion_server_destroy Failed\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ g_hServer = NULL;
+ }
+ return;
+}
+
+/** @addtogroup itc-cion-testcases
+* @brief Integration testcases for module cion
+* @ingroup itc-cion
+* @{
+*/
+
+//& purpose: Creates and Destroy a clone of peer info handle.
+//& type: auto
+/**
+* @testcase ITc_cion_peer_info_clone_destroy_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates and Destroy a clone of peer info handle.
+* @scenario Creates and Destroy a clone of peer info handle.
+* @apicovered cion_peer_info_clone,cion_peer_info_destroy
+* @passcase If cion_peer_info_clone,cion_peer_info_destroy is successfull
+* @failcase If cion_peer_info_clone,cion_peer_info_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_peer_info_clone_destroy_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ cion_peer_info_h hClone;
+
+ if (bIsServerDiscovered == false)
+ {
+ FPRINTF("[Line : %d][%s] precondition failed. server not discovered\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_peer_info_clone(g_hPeer, &hClone);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_clone", CionGetError(nRetVal));
+
+ nRetVal = cion_peer_info_destroy(hClone);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal));
+ hClone = NULL;
+
+ return 0;
+}
+
+//& purpose: Gets the device ID.
+//& type: auto
+/**
+* @testcase ITc_cion_peer_info_get_device_id_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the device ID.
+* @scenario Gets the device ID.
+* @apicovered cion_peer_info_get_device_id
+* @passcase If cion_peer_info_get_device_id is successfull
+* @failcase If cion_peer_info_get_device_id fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_peer_info_get_device_id_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ char *device_id = NULL;
+
+ if (bIsServerDiscovered == false)
+ {
+ FPRINTF("[Line : %d][%s] precondition failed. server not discovered\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_peer_info_get_device_id(g_hPeer, &device_id);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_get_device_id", CionGetError(nRetVal));
+ if (device_id == NULL)
+ {
+ FPRINTF("[Line : %d][%s] device_id is NULL\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ FREE_MEMORY(device_id);
+
+ return 0;
+}
+
+//& purpose: Gets the device name.
+//& type: auto
+/**
+* @testcase ITc_cion_peer_info_get_device_name_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the device name.
+* @scenario Gets the device name.
+* @apicovered cion_peer_info_get_device_name
+* @passcase If cion_peer_info_get_device_name is successfull
+* @failcase If cion_peer_info_get_device_name fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_peer_info_get_device_name_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ char *device_name = NULL;
+
+ if (bIsServerDiscovered == false)
+ {
+ FPRINTF("[Line : %d][%s] precondition failed. server not discovered\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_peer_info_get_device_name(g_hPeer, &device_name);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_get_device_id", CionGetError(nRetVal));
+ if (device_name == NULL)
+ {
+ FPRINTF("[Line : %d][%s] device_name is NULL\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ FREE_MEMORY(device_name);
+
+ return 0;
+}
+
+//& purpose: Gets the device's platform.
+//& type: auto
+/**
+* @testcase ITc_cion_peer_info_get_device_platform_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the device's platform.
+* @scenario Gets the device's platform.
+* @apicovered cion_peer_info_get_device_platform
+* @passcase If cion_peer_info_get_device_platform is successfull
+* @failcase If cion_peer_info_get_device_platform fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_peer_info_get_device_platform_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ char *device_platform = NULL;
+
+ if (bIsServerDiscovered == false)
+ {
+ FPRINTF("[Line : %d][%s] precondition failed. server not discovered\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_peer_info_get_device_platform(g_hPeer, &device_platform);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_get_device_platform", CionGetError(nRetVal));
+ if (device_platform == NULL)
+ {
+ FPRINTF("[Line : %d][%s] device_platform is NULL\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ FREE_MEMORY(device_platform);
+
+ return 0;
+}
+
+//& purpose: Gets the device's platform version.
+//& type: auto
+/**
+* @testcase ITc_cion_peer_info_get_device_platform_version_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the device's platform version.
+* @scenario Gets the device's platform version.
+* @apicovered cion_peer_info_get_device_platform_version
+* @passcase If cion_peer_info_get_device_platform_version is successfull
+* @failcase If cion_peer_info_get_device_platform_version fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_peer_info_get_device_platform_version_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ char *device_platform_version = NULL;
+
+ if (bIsServerDiscovered == false)
+ {
+ FPRINTF("[Line : %d][%s] precondition failed. server not discovered\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_peer_info_get_device_platform_version(g_hPeer,&device_platform_version);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_get_device_platform_version", CionGetError(nRetVal));
+ if (device_platform_version == NULL)
+ {
+ FPRINTF("[Line : %d][%s] device_platform_version is NULL\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+
+ FREE_MEMORY(device_platform_version);
+
+ return 0;
+}
+
+//& purpose: Gets the device's type.
+//& type: auto
+/**
+* @testcase ITc_cion_peer_info_get_device_type_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the device's type.
+* @scenario Gets the device's type.
+* @apicovered cion_peer_info_get_device_type
+* @passcase If cion_peer_info_get_device_type is successfull
+* @failcase If cion_peer_info_get_device_type fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_peer_info_get_device_type_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ char *device_type = NULL;
+
+ if (bIsServerDiscovered == false)
+ {
+ FPRINTF("[Line : %d][%s] precondition failed. server not discovered\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_peer_info_get_device_type(g_hPeer, &device_type);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_get_device_type", CionGetError(nRetVal));
+ if (device_type == NULL)
+ {
+ FPRINTF("[Line : %d][%s] device_type is NULL\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ FREE_MEMORY(device_type);
+
+ return 0;
+}
+
+//& purpose: Gets application ID of peer.
+//& type: auto
+/**
+* @testcase ITc_cion_peer_info_get_app_id_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets application ID of peer.
+* @scenario Gets application ID of peer.
+* @apicovered cion_peer_info_get_app_id
+* @passcase If cion_peer_info_get_app_id is successfull
+* @failcase If cion_peer_info_get_app_id fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_peer_info_get_app_id_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ char *app_id = NULL;
+
+ if (bIsServerDiscovered == false)
+ {
+ FPRINTF("[Line : %d][%s] precondition failed. server not discovered\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_peer_info_get_app_id(g_hPeer, &app_id);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_get_app_id", CionGetError(nRetVal));
+ if (app_id == NULL)
+ {
+ FPRINTF("[Line : %d][%s] app_id is NULL\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ FREE_MEMORY(app_id);
+
+ return 0;
+}
+
+//& purpose: Gets application version of peer.
+//& type: auto
+/**
+* @testcase ITc_cion_peer_info_get_app_version_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets application version of peer.
+* @scenario Gets application version of peer.
+* @apicovered cion_peer_info_get_app_version
+* @passcase If cion_peer_info_get_app_version is successfull
+* @failcase If cion_peer_info_get_app_version fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_peer_info_get_app_version_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ char *app_version = NULL;
+
+ if (bIsServerDiscovered == false)
+ {
+ FPRINTF("[Line : %d][%s] precondition failed. server not discovered\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_peer_info_get_app_version(g_hPeer, &app_version);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_get_app_id", CionGetError(nRetVal));
+ if (app_version == NULL)
+ {
+ FPRINTF("[Line : %d][%s] app_version is NULL\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ FREE_MEMORY(app_version);
+
+ return 0;
+}
+
+//& purpose: Gets UUID of peer.
+//& type: auto
+/**
+* @testcase ITc_cion_peer_info_get_uuid_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets UUID of peer.
+* @scenario Gets UUID of peer.
+* @apicovered cion_peer_info_get_uuid
+* @passcase If cion_peer_info_get_uuid is successfull
+* @failcase If cion_peer_info_get_uuid fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_peer_info_get_uuid_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ char *uuid = NULL;
+
+ if (bIsServerDiscovered == false)
+ {
+ FPRINTF("[Line : %d][%s] precondition failed. server not discovered\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_peer_info_get_uuid(g_hPeer, &uuid);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_get_uuid", CionGetError(nRetVal));
+ if (uuid == NULL)
+ {
+ FPRINTF("[Line : %d][%s] uuid is NULL\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ FREE_MEMORY(uuid);
+
+ return 0;
+}
+
+//& purpose: Gets display name of peer.
+//& type: auto
+/**
+* @testcase ITc_cion_peer_info_get_display_name_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets display name of peer.
+* @scenario Gets display name of peer.
+* @apicovered cion_peer_info_get_display_name
+* @passcase If cion_peer_info_get_display_name is successfull
+* @failcase If cion_peer_info_get_display_name fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_peer_info_get_display_name_p(void)
+{
+ START_TEST_PAYLOAD;
+ int nRetVal = -1;
+ char *display_name = NULL;
+
+ if (bIsServerDiscovered == false)
+ {
+ FPRINTF("[Line : %d][%s] precondition failed. server not discovered\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRetVal = cion_peer_info_get_display_name(g_hPeer, &display_name);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_get_display_name", CionGetError(nRetVal));
+ if (display_name == NULL)
+ {
+ FPRINTF("[Line : %d][%s] display_name is NULL\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ FREE_MEMORY(display_name);
+
+ return 0;
+}
+
+/** @} */
+/** @} */
\ No newline at end of file
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-cion-common.h"
+
+//& set: Cion
+
+/** @addtogroup itc-cion
+* @ingroup itc
+* @{
+*/
+
+/**
+ * @function ITs_cion_security_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_security_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+
+ return;
+}
+
+
+/**
+ * @function ITs_cion_security_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_security_cleanup(void)
+{
+ return;
+}
+
+/** @addtogroup itc-cion-testcases
+* @brief Integration testcases for module cion
+* @ingroup itc-cion
+* @{
+*/
+
+//& purpose: Creates and destroy the Cion security handle.
+//& type: auto
+/**
+* @testcase ITc_cion_security_create_destory_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates and destroy the Cion security handle.
+* @scenario Creates and destroy the Cion security handle.
+* @apicovered cion_security_create,cion_security_destroy
+* @passcase If cion_security_create,cion_security_destroy is successfull
+* @failcase If cion_security_create,cion_security_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_security_create_destory_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_security_h hSecurity = NULL;
+
+ nRetVal = cion_security_create(&hSecurity);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_security_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hSecurity,"cion_security_create");
+
+ nRetVal = cion_security_destroy(hSecurity);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_security_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Sets and Gets the path of certificate authority certificates.
+//& type: auto
+/**
+* @testcase ITc_cion_security_create_destory_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates and destroy the Cion security handle.
+* @scenario Creates and destroy the Cion security handle.
+* @apicovered cion_security_set_ca_path,cion_security_get_ca_path
+* @passcase If cion_security_set_ca_path,cion_security_get_ca_path is successfull
+* @failcase If cion_security_set_ca_path,cion_security_get_ca_path fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_security_set_get_ca_path_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_security_h hSecurity = NULL;
+ char *pszSetPath = "path";
+ char *pszGetPath;
+
+ nRetVal = cion_security_create(&hSecurity);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_security_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hSecurity,"cion_security_create");
+
+ nRetVal = cion_security_set_ca_path(hSecurity, pszSetPath);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_security_set_ca_path", CionGetError(nRetVal),cion_security_destroy(hSecurity));
+
+ nRetVal = cion_security_get_ca_path(hSecurity, &pszGetPath);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_security_get_ca_path", CionGetError(nRetVal),cion_security_destroy(hSecurity));
+ if(strcmp(pszSetPath ,pszGetPath) != 0)
+ {
+ FREE_MEMORY(pszGetPath);
+ nRetVal = cion_security_destroy(hSecurity);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_security_destroy", CionGetError(nRetVal));
+ return 1;
+ }
+ FREE_MEMORY(pszGetPath);
+ nRetVal = cion_security_destroy(hSecurity);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_security_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Sets and Gets the path of certificate.
+//& type: auto
+/**
+* @testcase ITc_cion_security_set_get_cert_path_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets and Gets the path of certificate.
+* @scenario Sets and Gets the path of certificate.
+* @apicovered cion_security_set_cert_path,cion_security_get_cert_path
+* @passcase If cion_security_set_cert_path,cion_security_get_cert_path is successfull
+* @failcase If cion_security_set_cert_path,cion_security_get_cert_path fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_security_set_get_cert_path_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_security_h hSecurity = NULL;
+ char *pszSetPath = "path";
+ char *pszGetPath;
+
+ nRetVal = cion_security_create(&hSecurity);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_security_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hSecurity,"cion_security_create");
+
+ nRetVal = cion_security_set_cert_path(hSecurity, pszSetPath);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_security_set_cert_path", CionGetError(nRetVal),cion_security_destroy(hSecurity));
+
+ nRetVal = cion_security_get_cert_path(hSecurity, &pszGetPath);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_security_get_cert_path", CionGetError(nRetVal),cion_security_destroy(hSecurity));
+ if(strcmp(pszSetPath ,pszGetPath) != 0)
+ {
+ FREE_MEMORY(pszGetPath);
+ nRetVal = cion_security_destroy(hSecurity);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_security_destroy", CionGetError(nRetVal));
+ return 1;
+ }
+ FREE_MEMORY(pszGetPath);
+ nRetVal = cion_security_destroy(hSecurity);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_security_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Sets and Gets the path of private key.
+//& type: auto
+/**
+* @testcase ITc_cion_security_set_get_cert_path_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets and Gets the path of private key.
+* @scenario Sets and Gets the path of private key.
+* @apicovered cion_security_set_private_key_path,cion_security_get_private_key_path
+* @passcase If cion_security_set_private_key_path,cion_security_get_private_key_path is successfull
+* @failcase If cion_security_set_private_key_path,cion_security_get_private_key_path fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_security_set_get_private_key_path_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_security_h hSecurity = NULL;
+ char *pszSetPath = "path";
+ char *pszGetPath;
+
+ nRetVal = cion_security_create(&hSecurity);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_security_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hSecurity,"cion_security_create");
+
+ nRetVal = cion_security_set_private_key_path(hSecurity, pszSetPath);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_security_set_private_key_path", CionGetError(nRetVal),cion_security_destroy(hSecurity));
+
+ nRetVal = cion_security_get_private_key_path(hSecurity, &pszGetPath);
+ PRINT_RESULT_CLEANUP(CION_ERROR_NONE, nRetVal, "cion_security_get_private_key_path", CionGetError(nRetVal),cion_security_destroy(hSecurity));
+ if(strcmp(pszSetPath ,pszGetPath) != 0)
+ {
+ FREE_MEMORY(pszGetPath);
+ nRetVal = cion_security_destroy(hSecurity);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_security_destroy", CionGetError(nRetVal));
+ return 1;
+ }
+ FREE_MEMORY(pszGetPath);
+ nRetVal = cion_security_destroy(hSecurity);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_security_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-cion-common.h"
+
+//& set: Cion
+
+/** @addtogroup itc-cion
+* @ingroup itc
+* @{
+*/
+
+struct cbdata {
+ cion_server_h server;
+ cion_peer_info_h peer;
+};
+
+static GMainLoop *main_loop;
+static guint source_id;
+static gboolean __timeout_cb(gpointer data)
+{
+ g_main_loop_quit(main_loop);
+ return FALSE;
+}
+
+static void RunPollingLoop(void) {
+ main_loop = g_main_loop_new(NULL, FALSE);
+ source_id = g_timeout_add(10000, __timeout_cb, NULL);\
+ g_main_loop_run(main_loop);\
+ g_source_remove(source_id);
+ main_loop = NULL;
+}
+
+static void StopPollingLoop(void) {
+ sleep(1);
+ g_source_remove(source_id);
+ g_main_loop_quit(main_loop);
+}
+
+/**
+* @function ClientServerDiscoveredCB2
+* @description Callback function
+* @parameter const char *service_name, const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ClientServerDiscoveredCB2(const char *service_name, const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ClientServerDiscoveredCB2\\n", __LINE__, API_NAMESPACE);
+ int ret;
+ cion_peer_info_h *peer = (cion_peer_info_h *)user_data;
+
+ ret = cion_peer_info_clone(peer_info, peer);
+ if (ret != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ StopPollingLoop();
+}
+
+/**
+* @function ClientServerDiscoveredCB3
+* @description Callback function
+* @parameter const char *service_name, const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ClientServerDiscoveredCB3(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ClientServerDiscoveredCB3\\n", __LINE__, API_NAMESPACE);
+ int ret;
+ cion_peer_info_h *peer = (cion_peer_info_h *)user_data;
+
+ ret = cion_peer_info_clone(peer_info, peer);
+ if (ret != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+ StopPollingLoop();
+}
+
+/**
+* @function ServerConnectionRequestCB4
+* @description Callback function
+* @parameter const char *service_name, const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ServerConnectionRequestCB4(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ServerConnectionRequestCB4\\n", __LINE__, API_NAMESPACE);
+ int ret;
+ cion_peer_info_h *peer = (cion_peer_info_h *)user_data;
+
+ ret = cion_peer_info_clone(peer_info, peer);
+ if (ret != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+
+ StopPollingLoop();
+}
+
+/**
+* @function ServerConnectionRequestCB3
+* @description Callback function
+* @parameter const char *service_name, const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ServerConnectionRequestCB3(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ServerConnectionRequestCB3\\n", __LINE__, API_NAMESPACE);
+ int ret;
+ cion_peer_info_h *peer = (cion_peer_info_h *)user_data;
+
+ ret = cion_peer_info_clone(peer_info, peer);
+ if (ret != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] failed cion_peer_info_clone\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ServerConnectionResultCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, const cion_connection_result_h result, void *user_data
+* @return NA
+*/
+static void ServerConnectionResultCB(const char *service_name,const cion_peer_info_h peer_info, const cion_connection_result_h result, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ServerConnectionResultCB\\n", __LINE__, API_NAMESPACE);
+ int ret;
+ cion_connection_status_e status;
+
+ ret = cion_connection_result_get_status(result, &status);
+ if (ret != CION_ERROR_NONE) {
+ FPRINTF("[Line : %d][%s] failed cion_connection_result_get_status\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ StopPollingLoop();
+}
+
+/**
+* @function ServerConnectionRequestCB2
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ServerConnectionRequestCB2(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ServerConnectionRequestCB2\\n", __LINE__, API_NAMESPACE);
+ int ret;
+ struct cbdata *data = (struct cbdata *)user_data;
+
+ ret = cion_peer_info_clone(peer_info, &(data->peer));
+ if (ret != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] failed to clone peer info\\n", __LINE__, API_NAMESPACE);
+ ret = cion_server_accept(data->server, peer_info);
+ if (ret != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] failed to accept client\\n", __LINE__, API_NAMESPACE);
+
+}
+
+/**
+* @function ClientServerDiscoveredCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ClientServerDiscoveredCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ClientServerDiscoveredCB\\n", __LINE__, API_NAMESPACE);
+ int ret;
+ cion_client_h client = (cion_client_h)user_data;
+
+ if (peer_info == NULL)
+ FPRINTF("[Line : %d][%s] peerinfo is null\\n", __LINE__, API_NAMESPACE);
+
+ ret = cion_client_connect(client, peer_info);
+ if (ret != CION_ERROR_NONE)
+ FPRINTF("[Line : %d][%s] failed to connect to server\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ServerPayloadAsyncResultCB
+* @description Callback function
+* @parameter const cion_payload_async_result_h result, void *user_data
+* @return NA
+*/
+static void ServerPayloadAsyncResultCB( const cion_payload_async_result_h result, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ServerPayloadAsyncResultCB\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ServerConnectedPeerInfoCB
+* @description Callback function
+* @parameter const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static bool ServerConnectedPeerInfoCB(const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ServerConnectedPeerInfoCB\\n", __LINE__, API_NAMESPACE);
+ return true;
+}
+
+/**
+* @function ServerPayloadReceivedCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, const cion_payload_h payload,cion_payload_transfer_status_e status,void *user_data
+* @return NA
+*/
+static void ServerPayloadReceivedCB(const char *service_name,const cion_peer_info_h peer_info, const cion_payload_h payload,cion_payload_transfer_status_e status,void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ServerPayloadReceivedCB\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ServerConnectionRequestCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ServerConnectionRequestCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ServerConnectionRequestCB\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ServerDataReceivedCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, const unsigned char *data,unsigned int data_size, unsigned char **return_data,unsigned int *return_data_size, void *user_data
+* @return NA
+*/
+static void ServerDataReceivedCB(const char *service_name,const cion_peer_info_h peer_info, const unsigned char *data,unsigned int data_size, unsigned char **return_data,unsigned int *return_data_size, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ServerDataReceivedCB\\n", __LINE__, API_NAMESPACE);
+}
+
+/**
+* @function ServerDisconnectedCB
+* @description Callback function
+* @parameter const char *service_name,const cion_peer_info_h peer_info, void *user_data
+* @return NA
+*/
+static void ServerDisconnectedCB(const char *service_name,const cion_peer_info_h peer_info, void *user_data)
+{
+ FPRINTF("[Line : %d][%s] Inside ServerDisconnectedCB\\n", __LINE__, API_NAMESPACE);
+}
+/**
+ * @function ITs_cion_server_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_server_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+
+ return;
+}
+
+
+/**
+ * @function ITs_cion_server_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_cion_server_cleanup(void)
+{
+ return;
+}
+
+/** @addtogroup itc-cion-testcases
+* @brief Integration testcases for module cion
+* @ingroup itc-cion
+* @{
+*/
+
+//& purpose: Creates and Destroy the Cion server handle.
+//& type: auto
+/**
+* @testcase ITc_cion_server_create_destroy_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Creates and Destroy the Cion server handle.
+* @scenario Creates and Destroy the Cion server handle.
+* @apicovered cion_server_create,cion_server_destroy
+* @passcase If cion_server_create,cion_server_destroy is successfull
+* @failcase If cion_server_create,cion_server_destroy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_create_destroy_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_create_destroy_p","ITc_cion_server_create_destroy_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Starts and Stops listening to connection requests from clients.
+//& type: auto
+/**
+* @testcase ITc_cion_server_listen_top_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Starts and Stops listening to connection requests from clients.
+* @scenario Starts and Stops listening to connection requests from clients.
+* @apicovered cion_server_listen,cion_server_stop
+* @passcase If cion_server_listen,cion_server_stop is successfull
+* @failcase If cion_server_listen,cion_server_stop fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_listen_stop_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_listen_stop_p","ITc_cion_server_listen_stop_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal));
+
+ nRetVal = cion_server_stop(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_stop", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Disconnects from a client.
+//& type: auto
+/**
+* @testcase ITc_cion_server_disconnect_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Disconnects from a client.
+* @scenario Disconnects from a client.
+* @apicovered cion_server_disconnect
+* @passcase If cion_server_disconnect is successfull
+* @failcase If cion_server_disconnect fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_disconnect_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+ cion_client_h hClient;
+ struct cbdata data;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_disconnect_p","ITc_cion_server_disconnect_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_server_add_connection_result_cb(hServer, ServerConnectionResultCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_add_connection_result_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_client_create(&hClient, "ITc_cion_server_disconnect_p",NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hClient,"cion_client_create");
+
+ data.server = hServer;
+ data.peer = NULL;
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB2,&data);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal));
+
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB,hClient);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal));
+
+ RunPollingLoop();
+
+ // nRetVal = cion_server_stop(hServer);
+ // PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_stop", CionGetError(nRetVal));
+
+ nRetVal = cion_server_disconnect(hServer, data.peer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_disconnect", CionGetError(nRetVal));
+
+ nRetVal = cion_peer_info_destroy(data.peer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ // nRetVal = cion_server_remove_connection_result_cb(hServer,ServerConnectionResultCB);
+ // PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_server_remove_connection_result_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT_NORETURN(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Sends payload asynchronously
+//& type: auto
+/**
+* @testcase ITc_cion_server_send_payload_async_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sends payload asynchronously
+* @scenario Sends payload asynchronously
+* @apicovered cion_server_send_payload_async
+* @passcase If cion_server_send_payload_async is successfull
+* @failcase If cion_server_send_payload_async fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_send_payload_async_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+ cion_client_h hClient;
+ cion_payload_h hPayload;
+ struct cbdata data;
+ unsigned char payload_data[] = "ITc_cion_server_send_payload_async_p";
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_send_payload_async_p","ITc_cion_server_send_payload_async_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_server_add_connection_result_cb(hServer, ServerConnectionResultCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_add_connection_result_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_client_create(&hClient,"ITc_cion_server_send_payload_async_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal));
+
+ data.server = hServer;
+ data.peer = NULL;
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB2,&data);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal));
+
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB,hClient);
+ RunPollingLoop();
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_create(&hPayload, CION_PAYLOAD_TYPE_DATA);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_create", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_set_data(hPayload, payload_data,sizeof(payload_data));
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_set_data", CionGetError(nRetVal));
+
+ nRetVal = cion_server_send_payload_async(hServer, data.peer, hPayload, NULL,NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_send_payload_async", CionGetError(nRetVal));
+
+ nRetVal = cion_payload_destroy(hPayload);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_payload_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_server_remove_connection_result_cb(hServer,ServerConnectionResultCB);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_remove_connection_result_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Adds and Removes callback function for connection result.
+//& type: auto
+/**
+* @testcase ITc_cion_server_add_remove_connection_result_cb_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Adds and Removes callback function for connection result.
+* @scenario Adds and Removes callback function for connection result.
+* @apicovered cion_server_add_connection_result_cb,cion_server_remove_connection_result_cb
+* @passcase If cion_server_add_connection_result_cb,cion_server_remove_connection_result_cb is successfull
+* @failcase If cion_server_add_connection_result_cb,cion_server_remove_connection_result_cb fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_add_remove_connection_result_cb_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_add_remove_connection_result_cb_p","ITc_cion_server_add_remove_connection_result_cb_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_server_add_connection_result_cb(hServer,ServerConnectionResultCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_add_connection_result_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_remove_connection_result_cb(hServer,ServerConnectionResultCB);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_remove_connection_result_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Adds and Removes callback function to receive payload.
+//& type: auto
+/**
+* @testcase ITc_cion_server_add_remove_payload_received_cb_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Adds and Removes callback function to receive payload.
+* @scenario Adds and Removes callback function to receive payload.
+* @apicovered cion_server_add_payload_received_cb,cion_server_remove_payload_received_cb
+* @passcase If cion_server_add_payload_received_cb,cion_server_remove_payload_received_cb is successfull
+* @failcase If cion_server_add_payload_received_cb,cion_server_remove_payload_received_cb fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_add_remove_payload_received_cb_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_add_remove_payload_received_cb_p","ITc_cion_server_add_remove_payload_received_cb_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_server_add_payload_received_cb(hServer,ServerPayloadReceivedCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_add_payload_received_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_remove_payload_received_cb(hServer,ServerPayloadReceivedCB);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_remove_payload_received_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Sets and Unsets callback function to receive data.
+//& type: auto
+/**
+* @testcase ITc_cion_server_set_unset_data_received_cb_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets and Unsets callback function to receive data.
+* @scenario Sets and Unsets callback function to receive data.
+* @apicovered cion_server_set_data_received_cb,cion_server_unset_data_received_cb
+* @passcase If cion_server_set_data_received_cb,cion_server_unset_data_received_cb is successfull
+* @failcase If cion_server_set_data_received_cb,cion_server_unset_data_received_cb fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_set_unset_data_received_cb_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_set_unset_data_received_cb_p","ITc_cion_server_set_unset_data_received_cb_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_server_set_data_received_cb(hServer,ServerDataReceivedCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_set_data_received_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_unset_data_received_cb(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_unset_data_received_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Adds and Removes callback function for disconnect state.
+//& type: auto
+/**
+* @testcase ITc_cion_server_add_remove_disconnected_cb_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets and Unsets callback function to receive data.
+* @scenario Sets and Unsets callback function to receive data.
+* @apicovered cion_server_add_disconnected_cb,cion_server_remove_disconnected_cb
+* @passcase If cion_server_add_disconnected_cb,cion_server_remove_disconnected_cb is successfull
+* @failcase If cion_server_add_disconnected_cb,cion_server_remove_disconnected_cb fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_add_remove_disconnected_cb_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_add_remove_disconnected_cb_p","ITc_cion_server_add_remove_disconnected_cb_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_server_add_disconnected_cb(hServer,ServerDisconnectedCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_add_disconnected_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_remove_disconnected_cb(hServer,ServerDisconnectedCB);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_remove_disconnected_cb", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Accepts the connection request from a peer.
+//& type: auto
+/**
+* @testcase ITc_cion_server_accept_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Accepts the connection request from a peer.
+* @scenario Accepts the connection request from a peer.
+* @apicovered cion_server_accept
+* @passcase If cion_server_accept is successfull
+* @failcase If cion_server_accept fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_accept_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+ cion_client_h hClient;
+ cion_peer_info_h hPeerClient = NULL;
+ cion_peer_info_h hPeerServer = NULL;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_accept_p","ITc_cion_server_accept_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_client_create(&hClient, "ITc_cion_server_accept_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal));
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB3,&hPeerClient);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal));
+
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB2,&hPeerServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal));
+
+ RunPollingLoop();
+ sleep(2);
+ CHECK_HANDLE(hPeerServer,"cion_client_try_discovery");
+
+ nRetVal = cion_client_connect(hClient, hPeerServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_connect", CionGetError(nRetVal));
+
+ RunPollingLoop();
+
+ nRetVal = cion_server_accept(hServer, hPeerClient);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_accept", CionGetError(nRetVal));
+
+ nRetVal = cion_peer_info_destroy(hPeerServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_peer_info_destroy(hPeerClient);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Sets the server display name.
+//& type: auto
+/**
+* @testcase ITc_cion_server_set_display_name_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets the server display name.
+* @scenario Sets the server display name.
+* @apicovered cion_server_set_display_name
+* @passcase If cion_server_set_display_name is successfull
+* @failcase If cion_server_set_display_name fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_set_display_name_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_set_display_name_p","ITc_cion_server_set_display_name_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_server_set_display_name(hServer, "display_name");
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Sets on-demand launch state.
+//& type: auto
+/**
+* @testcase ITc_cion_server_set_on_demand_launch_enabled_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets on-demand launch state.
+* @scenario Sets on-demand launch state.
+* @apicovered cion_server_set_on_demand_launch_enabled
+* @passcase If cion_server_set_on_demand_launch_enabled is successfull
+* @failcase If cion_server_set_on_demand_launch_enabled fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_set_on_demand_launch_enabled_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_set_on_demand_launch_enabled_p","ITc_cion_server_set_on_demand_launch_enabled_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_server_set_on_demand_launch_enabled(hServer, true);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_set_on_demand_launch_enabled", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Gets connected peers information.
+//& type: auto
+/**
+* @testcase ITc_cion_server_foreach_connected_peer_info_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets connected peers information.
+* @scenario Gets connected peers information.
+* @apicovered cion_server_foreach_connected_peer_info
+* @passcase If cion_server_foreach_connected_peer_info is successfull
+* @failcase If cion_server_foreach_connected_peer_info fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_foreach_connected_peer_info_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_foreach_connected_peer_info_p","ITc_cion_server_foreach_connected_peer_info_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_server_foreach_connected_peer_info(hServer,ServerConnectedPeerInfoCB, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_set_on_demand_launch_enable", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+
+//& purpose: Rejects the connection request from a peer.
+//& type: auto
+/**
+* @testcase ITc_cion_server_reject_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Rejects the connection request from a peer.
+* @scenario Rejects the connection request from a peer.
+* @apicovered cion_server_reject
+* @passcase If cion_server_reject is successfull
+* @failcase If cion_server_reject fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_cion_server_reject_p(void)
+{
+ START_TEST;
+ int nRetVal = -1;
+ cion_server_h hServer;
+ cion_client_h hClient;
+ cion_peer_info_h hPeerClient = NULL;
+ cion_peer_info_h hPeerServer = NULL;
+
+ nRetVal = cion_server_create(&hServer, "ITc_cion_server_reject_p","ITc_cion_server_reject_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_create", CionGetError(nRetVal));
+ CHECK_HANDLE(hServer,"cion_server_create");
+
+ nRetVal = cion_client_create(&hClient, "ITc_cion_server_reject_p", NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_create", CionGetError(nRetVal));
+
+ nRetVal = cion_server_listen(hServer, ServerConnectionRequestCB4,&hPeerClient);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_listen", CionGetError(nRetVal));
+
+ nRetVal = cion_client_try_discovery(hClient, ClientServerDiscoveredCB3,&hPeerServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_try_discovery", CionGetError(nRetVal));
+
+ RunPollingLoop();
+ sleep(2);
+ CHECK_HANDLE(hPeerServer,"cion_client_try_discovery");
+
+ nRetVal = cion_client_connect(hClient, hPeerServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_connect", CionGetError(nRetVal));
+
+ RunPollingLoop();
+
+ nRetVal = cion_server_reject(hServer, hPeerClient, NULL);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_reject", CionGetError(nRetVal));
+
+ nRetVal = cion_peer_info_destroy(hPeerServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_peer_info_destroy(hPeerClient);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_peer_info_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_client_destroy(hClient);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_client_destroy", CionGetError(nRetVal));
+
+ nRetVal = cion_server_destroy(hServer);
+ PRINT_RESULT(CION_ERROR_NONE, nRetVal, "cion_server_destroy", CionGetError(nRetVal));
+
+ return 0;
+}
+/** @} */
+/** @} */
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "tct_common.h"
+
+#ifdef MOBILE //Starts MOBILE
+#include "tct-cion-native_mobile.h"
+#endif //MOBILE //End MOBILE
+
+#ifdef WEARABLE //Starts WEARABLE
+#include "tct-cion-native_wearable.h"
+#endif //WEARABLE //End WEARABLE
+
+#ifdef TV //Starts TV
+#include "tct-cion-native_tv.h"
+#endif //TV //End TV
+
+#ifdef TIZENIOT //Starts TIZENIOT
+#include "tct-cion-native_tizeniot.h"
+#endif //TIZENIOT //End TIZENIOT
+
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <glib.h>
+#include <stdbool.h>
+#include <app.h>
+#include <dlog.h>
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <errno.h>
+
+#include <Elementary.h>
+
+typedef struct appdata {
+ Evas_Object *win;
+ Evas_Object *conform;
+ Evas_Object *label;
+} appdata_s;
+
+static bool app_create(void *data)
+{
+ return true;
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+ char* pszGetTCName = NULL;
+ int i=0, result=0, nRet=0;
+ nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName);
+ if(nRet != APP_CONTROL_ERROR_NONE)
+ {
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__);
+ PRINT_TC_RESULT("%d",1);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName);
+ for ( i = 0; tc_array[i].name; i++ )
+ {
+ if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) )
+ {
+ if ( tc_array[i].startup )
+ {
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName);
+ tc_array[i].startup();
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName);
+ result = tc_array[i].function();
+ dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result);
+
+ if ( tc_array[i].cleanup )
+ {
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName);
+ tc_array[i].cleanup();
+ }
+
+ PRINT_TC_RESULT("%d",result);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+ }
+ }
+
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName);
+ PRINT_TC_RESULT("%d",1);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+}
+
+static void app_terminate(void *data)
+{
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__);
+}
+
+int main(int argc, char *argv[])
+{
+ int ret = 0;
+ appdata_s ad = {0,};
+
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.app_control = app_control;
+
+ //setting gcda file location for coverage
+ setenv("GCOV_PREFIX","/tmp",1);
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__);
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__);
+ ret = ui_app_main(argc, argv, &event_callback, &ad);
+ if (ret != APP_ERROR_NONE)
+ {
+ dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret);
+ PRINT_TC_RESULT("%d",1);
+ return ret;
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__);
+ return ret;
+}
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_CION_NATIVE_H__
+#define __TCT_CION_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_cion_client_startup(void);
+extern void ITs_cion_client_cleanup(void);
+extern void ITs_cion_group_startup(void);
+extern void ITs_cion_group_cleanup(void);
+extern void ITs_cion_security_startup(void);
+extern void ITs_cion_security_cleanup(void);
+extern void ITs_cion_payload_startup(void);
+extern void ITs_cion_payload_cleanup(void);
+extern void ITs_cion_payload_async_startup(void);
+extern void ITs_cion_payload_async_cleanup(void);
+extern void ITs_cion_peer_info_startup(void);
+extern void ITs_cion_peer_info_cleanup(void);
+extern void ITs_cion_server_startup(void);
+extern void ITs_cion_server_cleanup(void);
+
+extern int ITc_cion_payload_async_result_clone_destroy_p(void);
+extern int ITc_cion_payload_async_result_get_peer_info_p(void);
+extern int ITc_cion_payload_async_result_get_payload_id_p(void);
+extern int ITc_cion_peer_info_clone_destroy_p(void);
+extern int ITc_cion_peer_info_get_device_id_p(void);
+extern int ITc_cion_peer_info_get_device_name_p(void);
+extern int ITc_cion_peer_info_get_device_platform_p(void);
+extern int ITc_cion_peer_info_get_device_platform_version_p(void);
+extern int ITc_cion_peer_info_get_device_type_p(void);
+extern int ITc_cion_peer_info_get_app_id_p(void);
+extern int ITc_cion_peer_info_get_app_version_p(void);
+extern int ITc_cion_peer_info_get_uuid_p(void);
+extern int ITc_cion_peer_info_get_display_name_p(void);
+extern int ITc_cion_client_create_destroy_p(void);
+extern int ITc_cion_client_send_data_p(void);
+extern int ITc_cion_client_try_stop_discovery_p(void);
+extern int ITc_cion_client_connect_disconnect_p(void);
+extern int ITc_cion_client_send_payload_async_p(void);
+extern int ITc_cion_client_add_remove_connection_result_cb_p(void);
+extern int ITc_cion_client_add_remove_payload_received_cb_p(void);
+extern int ITc_cion_client_add_remove_disconnected_cb_p(void);
+extern int ITc_cion_group_create_destroy_p(void);
+extern int ITc_cion_group_subscribe_unsubscribe_p(void);
+extern int ITc_cion_group_publish_p(void);
+extern int ITc_cion_security_create_destory_p(void);
+extern int ITc_cion_security_set_get_ca_path_p(void);
+extern int ITc_cion_security_set_get_cert_path_p(void);
+extern int ITc_cion_security_set_get_private_key_path_p(void);
+extern int ITc_cion_payload_create_destroy_p(void);
+extern int ITc_cion_payload_get_type_p(void);
+extern int ITc_cion_payload_set_get_data_p(void);
+extern int ITc_cion_payload_set_file_path_p(void);
+extern int ITc_cion_payload_get_payload_id_p(void);
+extern int ITc_cion_payload_save_as_file_p(void);
+extern int ITc_cion_payload_get_received_file_name_p(void);
+extern int ITc_cion_payload_get_received_bytes_p(void);
+extern int ITc_cion_payload_get_total_bytes_p(void);
+extern int ITc_cion_server_create_destroy_p(void);
+extern int ITc_cion_server_listen_stop_p(void);
+extern int ITc_cion_server_add_remove_connection_result_cb_p(void);
+extern int ITc_cion_server_add_remove_payload_received_cb_p(void);
+extern int ITc_cion_server_set_unset_data_received_cb_p(void);
+extern int ITc_cion_server_add_remove_disconnected_cb_p(void);
+extern int ITc_cion_server_accept_p(void);
+extern int ITc_cion_server_set_display_name_p(void);
+extern int ITc_cion_server_foreach_connected_peer_info_p(void);
+extern int ITc_cion_server_set_on_demand_launch_enabled_p(void);
+extern int ITc_cion_server_reject_p(void);
+extern int ITc_cion_server_disconnect_p(void);
+extern int ITc_cion_server_send_payload_async_p(void);
+
+testcase tc_array[] = {
+ {"ITc_cion_payload_async_result_clone_destroy_p", ITc_cion_payload_async_result_clone_destroy_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_payload_async_result_get_peer_info_p", ITc_cion_payload_async_result_get_peer_info_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_payload_async_result_get_payload_id_p", ITc_cion_payload_async_result_get_payload_id_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_peer_info_clone_destroy_p",ITc_cion_peer_info_clone_destroy_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_id_p", ITc_cion_peer_info_get_device_id_p,ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_name_p",ITc_cion_peer_info_get_device_name_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_platform_p",ITc_cion_peer_info_get_device_platform_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_platform_version_p",ITc_cion_peer_info_get_device_platform_version_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_type_p",ITc_cion_peer_info_get_device_type_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_app_id_p",ITc_cion_peer_info_get_app_id_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_app_version_p",ITc_cion_peer_info_get_app_version_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_uuid_p",ITc_cion_peer_info_get_uuid_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_display_name_p",ITc_cion_peer_info_get_display_name_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_client_create_destroy_p", ITc_cion_client_create_destroy_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_send_data_p", ITc_cion_client_send_data_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_try_stop_discovery_p", ITc_cion_client_try_stop_discovery_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_connect_disconnect_p", ITc_cion_client_connect_disconnect_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_send_payload_async_p", ITc_cion_client_send_payload_async_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_connection_result_cb_p", ITc_cion_client_add_remove_connection_result_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_payload_received_cb_p", ITc_cion_client_add_remove_payload_received_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_disconnected_cb_p", ITc_cion_client_add_remove_disconnected_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_group_create_destroy_p", ITc_cion_group_create_destroy_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_group_subscribe_unsubscribe_p", ITc_cion_group_subscribe_unsubscribe_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_group_publish_p", ITc_cion_group_publish_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_security_create_destory_p", ITc_cion_security_create_destory_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_ca_path_p", ITc_cion_security_set_get_ca_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_cert_path_p", ITc_cion_security_set_get_cert_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_private_key_path_p", ITc_cion_security_set_get_private_key_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_payload_create_destroy_p", ITc_cion_payload_create_destroy_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_type_p", ITc_cion_payload_get_type_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_file_path_p", ITc_cion_payload_set_file_path_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_file_path_p", ITc_cion_payload_set_file_path_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_get_data_p",ITc_cion_payload_set_get_data_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_payload_id_p", ITc_cion_payload_get_payload_id_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_save_as_file_p", ITc_cion_payload_save_as_file_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_received_file_name_p", ITc_cion_payload_get_received_file_name_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_received_bytes_p", ITc_cion_payload_get_received_bytes_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_total_bytes_p", ITc_cion_payload_get_total_bytes_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_server_create_destroy_p",ITc_cion_server_create_destroy_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_listen_stop_p",ITc_cion_server_listen_stop_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_connection_result_cb_p",ITc_cion_server_add_remove_connection_result_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_payload_received_cb_p",ITc_cion_server_add_remove_payload_received_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_unset_data_received_cb_p",ITc_cion_server_set_unset_data_received_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_disconnected_cb_p",ITc_cion_server_add_remove_disconnected_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_accept_p",ITc_cion_server_accept_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_display_name_p",ITc_cion_server_set_display_name_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_foreach_connected_peer_info_p",ITc_cion_server_foreach_connected_peer_info_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_on_demand_launch_enabled_p",ITc_cion_server_set_on_demand_launch_enabled_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_reject_p",ITc_cion_server_reject_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_disconnect_p",ITc_cion_server_disconnect_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_send_payload_async_p",ITc_cion_server_send_payload_async_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_CION_NATIVE_H__
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_CION_NATIVE_H__
+#define __TCT_CION_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_cion_client_startup(void);
+extern void ITs_cion_client_cleanup(void);
+extern void ITs_cion_group_startup(void);
+extern void ITs_cion_group_cleanup(void);
+extern void ITs_cion_security_startup(void);
+extern void ITs_cion_security_cleanup(void);
+extern void ITs_cion_payload_startup(void);
+extern void ITs_cion_payload_cleanup(void);
+extern void ITs_cion_payload_async_startup(void);
+extern void ITs_cion_payload_async_cleanup(void);
+extern void ITs_cion_peer_info_startup(void);
+extern void ITs_cion_peer_info_cleanup(void);
+extern void ITs_cion_server_startup(void);
+extern void ITs_cion_server_cleanup(void);
+
+extern int ITc_cion_payload_async_result_clone_destroy_p(void);
+extern int ITc_cion_payload_async_result_get_peer_info_p(void);
+extern int ITc_cion_payload_async_result_get_payload_id_p(void);
+extern int ITc_cion_peer_info_clone_destroy_p(void);
+extern int ITc_cion_peer_info_get_device_id_p(void);
+extern int ITc_cion_peer_info_get_device_name_p(void);
+extern int ITc_cion_peer_info_get_device_platform_p(void);
+extern int ITc_cion_peer_info_get_device_platform_version_p(void);
+extern int ITc_cion_peer_info_get_device_type_p(void);
+extern int ITc_cion_peer_info_get_app_id_p(void);
+extern int ITc_cion_peer_info_get_app_version_p(void);
+extern int ITc_cion_peer_info_get_uuid_p(void);
+extern int ITc_cion_peer_info_get_display_name_p(void);
+extern int ITc_cion_client_create_destroy_p(void);
+extern int ITc_cion_client_send_data_p(void);
+extern int ITc_cion_client_try_stop_discovery_p(void);
+extern int ITc_cion_client_connect_disconnect_p(void);
+extern int ITc_cion_client_send_payload_async_p(void);
+extern int ITc_cion_client_add_remove_connection_result_cb_p(void);
+extern int ITc_cion_client_add_remove_payload_received_cb_p(void);
+extern int ITc_cion_client_add_remove_disconnected_cb_p(void);
+extern int ITc_cion_group_create_destroy_p(void);
+extern int ITc_cion_group_subscribe_unsubscribe_p(void);
+extern int ITc_cion_group_publish_p(void);
+extern int ITc_cion_security_create_destory_p(void);
+extern int ITc_cion_security_set_get_ca_path_p(void);
+extern int ITc_cion_security_set_get_cert_path_p(void);
+extern int ITc_cion_security_set_get_private_key_path_p(void);
+extern int ITc_cion_payload_create_destroy_p(void);
+extern int ITc_cion_payload_get_type_p(void);
+extern int ITc_cion_payload_set_get_data_p(void);
+extern int ITc_cion_payload_set_file_path_p(void);
+extern int ITc_cion_payload_get_payload_id_p(void);
+extern int ITc_cion_payload_save_as_file_p(void);
+extern int ITc_cion_payload_get_received_file_name_p(void);
+extern int ITc_cion_payload_get_received_bytes_p(void);
+extern int ITc_cion_payload_get_total_bytes_p(void);
+extern int ITc_cion_server_create_destroy_p(void);
+extern int ITc_cion_server_listen_stop_p(void);
+extern int ITc_cion_server_add_remove_connection_result_cb_p(void);
+extern int ITc_cion_server_add_remove_payload_received_cb_p(void);
+extern int ITc_cion_server_set_unset_data_received_cb_p(void);
+extern int ITc_cion_server_add_remove_disconnected_cb_p(void);
+extern int ITc_cion_server_accept_p(void);
+extern int ITc_cion_server_set_display_name_p(void);
+extern int ITc_cion_server_foreach_connected_peer_info_p(void);
+extern int ITc_cion_server_set_on_demand_launch_enabled_p(void);
+extern int ITc_cion_server_reject_p(void);
+extern int ITc_cion_server_disconnect_p(void);
+extern int ITc_cion_server_send_payload_async_p(void);
+
+testcase tc_array[] = {
+ {"ITc_cion_payload_async_result_clone_destroy_p", ITc_cion_payload_async_result_clone_destroy_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_payload_async_result_get_peer_info_p", ITc_cion_payload_async_result_get_peer_info_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_payload_async_result_get_payload_id_p", ITc_cion_payload_async_result_get_payload_id_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_peer_info_clone_destroy_p",ITc_cion_peer_info_clone_destroy_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_id_p", ITc_cion_peer_info_get_device_id_p,ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_name_p",ITc_cion_peer_info_get_device_name_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_platform_p",ITc_cion_peer_info_get_device_platform_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_platform_version_p",ITc_cion_peer_info_get_device_platform_version_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_type_p",ITc_cion_peer_info_get_device_type_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_app_id_p",ITc_cion_peer_info_get_app_id_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_app_version_p",ITc_cion_peer_info_get_app_version_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_uuid_p",ITc_cion_peer_info_get_uuid_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_display_name_p",ITc_cion_peer_info_get_display_name_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_client_create_destroy_p", ITc_cion_client_create_destroy_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_send_data_p", ITc_cion_client_send_data_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_try_stop_discovery_p", ITc_cion_client_try_stop_discovery_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_connect_disconnect_p", ITc_cion_client_connect_disconnect_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_send_payload_async_p", ITc_cion_client_send_payload_async_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_connection_result_cb_p", ITc_cion_client_add_remove_connection_result_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_payload_received_cb_p", ITc_cion_client_add_remove_payload_received_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_disconnected_cb_p", ITc_cion_client_add_remove_disconnected_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_group_create_destroy_p", ITc_cion_group_create_destroy_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_group_subscribe_unsubscribe_p", ITc_cion_group_subscribe_unsubscribe_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_group_publish_p", ITc_cion_group_publish_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_security_create_destory_p", ITc_cion_security_create_destory_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_ca_path_p", ITc_cion_security_set_get_ca_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_cert_path_p", ITc_cion_security_set_get_cert_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_private_key_path_p", ITc_cion_security_set_get_private_key_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_payload_create_destroy_p", ITc_cion_payload_create_destroy_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_type_p", ITc_cion_payload_get_type_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_file_path_p", ITc_cion_payload_set_file_path_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_file_path_p", ITc_cion_payload_set_file_path_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_get_data_p",ITc_cion_payload_set_get_data_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_payload_id_p", ITc_cion_payload_get_payload_id_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_save_as_file_p", ITc_cion_payload_save_as_file_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_received_file_name_p", ITc_cion_payload_get_received_file_name_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_received_bytes_p", ITc_cion_payload_get_received_bytes_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_total_bytes_p", ITc_cion_payload_get_total_bytes_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_server_create_destroy_p",ITc_cion_server_create_destroy_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_listen_stop_p",ITc_cion_server_listen_stop_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_connection_result_cb_p",ITc_cion_server_add_remove_connection_result_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_payload_received_cb_p",ITc_cion_server_add_remove_payload_received_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_unset_data_received_cb_p",ITc_cion_server_set_unset_data_received_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_disconnected_cb_p",ITc_cion_server_add_remove_disconnected_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_accept_p",ITc_cion_server_accept_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_display_name_p",ITc_cion_server_set_display_name_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_foreach_connected_peer_info_p",ITc_cion_server_foreach_connected_peer_info_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_on_demand_launch_enabled_p",ITc_cion_server_set_on_demand_launch_enabled_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_reject_p",ITc_cion_server_reject_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_disconnect_p",ITc_cion_server_disconnect_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_send_payload_async_p",ITc_cion_server_send_payload_async_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_CION_NATIVE_H__
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_CION_NATIVE_H__
+#define __TCT_CION_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_cion_client_startup(void);
+extern void ITs_cion_client_cleanup(void);
+extern void ITs_cion_group_startup(void);
+extern void ITs_cion_group_cleanup(void);
+extern void ITs_cion_security_startup(void);
+extern void ITs_cion_security_cleanup(void);
+extern void ITs_cion_payload_startup(void);
+extern void ITs_cion_payload_cleanup(void);
+extern void ITs_cion_payload_async_startup(void);
+extern void ITs_cion_payload_async_cleanup(void);
+extern void ITs_cion_peer_info_startup(void);
+extern void ITs_cion_peer_info_cleanup(void);
+extern void ITs_cion_server_startup(void);
+extern void ITs_cion_server_cleanup(void);
+
+extern int ITc_cion_payload_async_result_clone_destroy_p(void);
+extern int ITc_cion_payload_async_result_get_peer_info_p(void);
+extern int ITc_cion_payload_async_result_get_payload_id_p(void);
+extern int ITc_cion_peer_info_clone_destroy_p(void);
+extern int ITc_cion_peer_info_get_device_id_p(void);
+extern int ITc_cion_peer_info_get_device_name_p(void);
+extern int ITc_cion_peer_info_get_device_platform_p(void);
+extern int ITc_cion_peer_info_get_device_platform_version_p(void);
+extern int ITc_cion_peer_info_get_device_type_p(void);
+extern int ITc_cion_peer_info_get_app_id_p(void);
+extern int ITc_cion_peer_info_get_app_version_p(void);
+extern int ITc_cion_peer_info_get_uuid_p(void);
+extern int ITc_cion_peer_info_get_display_name_p(void);
+extern int ITc_cion_client_create_destroy_p(void);
+extern int ITc_cion_client_send_data_p(void);
+extern int ITc_cion_client_try_stop_discovery_p(void);
+extern int ITc_cion_client_connect_disconnect_p(void);
+extern int ITc_cion_client_send_payload_async_p(void);
+extern int ITc_cion_client_add_remove_connection_result_cb_p(void);
+extern int ITc_cion_client_add_remove_payload_received_cb_p(void);
+extern int ITc_cion_client_add_remove_disconnected_cb_p(void);
+extern int ITc_cion_group_create_destroy_p(void);
+extern int ITc_cion_group_subscribe_unsubscribe_p(void);
+extern int ITc_cion_group_publish_p(void);
+extern int ITc_cion_security_create_destory_p(void);
+extern int ITc_cion_security_set_get_ca_path_p(void);
+extern int ITc_cion_security_set_get_cert_path_p(void);
+extern int ITc_cion_security_set_get_private_key_path_p(void);
+extern int ITc_cion_payload_create_destroy_p(void);
+extern int ITc_cion_payload_get_type_p(void);
+extern int ITc_cion_payload_set_get_data_p(void);
+extern int ITc_cion_payload_set_file_path_p(void);
+extern int ITc_cion_payload_get_payload_id_p(void);
+extern int ITc_cion_payload_save_as_file_p(void);
+extern int ITc_cion_payload_get_received_file_name_p(void);
+extern int ITc_cion_payload_get_received_bytes_p(void);
+extern int ITc_cion_payload_get_total_bytes_p(void);
+extern int ITc_cion_server_create_destroy_p(void);
+extern int ITc_cion_server_listen_stop_p(void);
+extern int ITc_cion_server_add_remove_connection_result_cb_p(void);
+extern int ITc_cion_server_add_remove_payload_received_cb_p(void);
+extern int ITc_cion_server_set_unset_data_received_cb_p(void);
+extern int ITc_cion_server_add_remove_disconnected_cb_p(void);
+extern int ITc_cion_server_accept_p(void);
+extern int ITc_cion_server_set_display_name_p(void);
+extern int ITc_cion_server_foreach_connected_peer_info_p(void);
+extern int ITc_cion_server_set_on_demand_launch_enabled_p(void);
+extern int ITc_cion_server_reject_p(void);
+extern int ITc_cion_server_disconnect_p(void);
+extern int ITc_cion_server_send_payload_async_p(void);
+
+testcase tc_array[] = {
+ {"ITc_cion_payload_async_result_clone_destroy_p", ITc_cion_payload_async_result_clone_destroy_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_payload_async_result_get_peer_info_p", ITc_cion_payload_async_result_get_peer_info_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_payload_async_result_get_payload_id_p", ITc_cion_payload_async_result_get_payload_id_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_peer_info_clone_destroy_p",ITc_cion_peer_info_clone_destroy_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_id_p", ITc_cion_peer_info_get_device_id_p,ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_name_p",ITc_cion_peer_info_get_device_name_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_platform_p",ITc_cion_peer_info_get_device_platform_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_platform_version_p",ITc_cion_peer_info_get_device_platform_version_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_type_p",ITc_cion_peer_info_get_device_type_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_app_id_p",ITc_cion_peer_info_get_app_id_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_app_version_p",ITc_cion_peer_info_get_app_version_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_uuid_p",ITc_cion_peer_info_get_uuid_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_display_name_p",ITc_cion_peer_info_get_display_name_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_client_create_destroy_p", ITc_cion_client_create_destroy_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_send_data_p", ITc_cion_client_send_data_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_try_stop_discovery_p", ITc_cion_client_try_stop_discovery_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_connect_disconnect_p", ITc_cion_client_connect_disconnect_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_send_payload_async_p", ITc_cion_client_send_payload_async_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_connection_result_cb_p", ITc_cion_client_add_remove_connection_result_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_payload_received_cb_p", ITc_cion_client_add_remove_payload_received_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_disconnected_cb_p", ITc_cion_client_add_remove_disconnected_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_group_create_destroy_p", ITc_cion_group_create_destroy_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_group_subscribe_unsubscribe_p", ITc_cion_group_subscribe_unsubscribe_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_group_publish_p", ITc_cion_group_publish_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_security_create_destory_p", ITc_cion_security_create_destory_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_ca_path_p", ITc_cion_security_set_get_ca_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_cert_path_p", ITc_cion_security_set_get_cert_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_private_key_path_p", ITc_cion_security_set_get_private_key_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_payload_create_destroy_p", ITc_cion_payload_create_destroy_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_type_p", ITc_cion_payload_get_type_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_file_path_p", ITc_cion_payload_set_file_path_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_file_path_p", ITc_cion_payload_set_file_path_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_get_data_p",ITc_cion_payload_set_get_data_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_payload_id_p", ITc_cion_payload_get_payload_id_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_save_as_file_p", ITc_cion_payload_save_as_file_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_received_file_name_p", ITc_cion_payload_get_received_file_name_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_received_bytes_p", ITc_cion_payload_get_received_bytes_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_total_bytes_p", ITc_cion_payload_get_total_bytes_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_server_create_destroy_p",ITc_cion_server_create_destroy_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_listen_stop_p",ITc_cion_server_listen_stop_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_connection_result_cb_p",ITc_cion_server_add_remove_connection_result_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_payload_received_cb_p",ITc_cion_server_add_remove_payload_received_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_unset_data_received_cb_p",ITc_cion_server_set_unset_data_received_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_disconnected_cb_p",ITc_cion_server_add_remove_disconnected_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_accept_p",ITc_cion_server_accept_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_display_name_p",ITc_cion_server_set_display_name_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_foreach_connected_peer_info_p",ITc_cion_server_foreach_connected_peer_info_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_on_demand_launch_enabled_p",ITc_cion_server_set_on_demand_launch_enabled_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_reject_p",ITc_cion_server_reject_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_disconnect_p",ITc_cion_server_disconnect_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_send_payload_async_p",ITc_cion_server_send_payload_async_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_CION_NATIVE_H__
--- /dev/null
+//
+// Copyright (c) 2021 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_CION_NATIVE_H__
+#define __TCT_CION_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_cion_client_startup(void);
+extern void ITs_cion_client_cleanup(void);
+extern void ITs_cion_group_startup(void);
+extern void ITs_cion_group_cleanup(void);
+extern void ITs_cion_security_startup(void);
+extern void ITs_cion_security_cleanup(void);
+extern void ITs_cion_payload_startup(void);
+extern void ITs_cion_payload_cleanup(void);
+extern void ITs_cion_payload_async_startup(void);
+extern void ITs_cion_payload_async_cleanup(void);
+extern void ITs_cion_peer_info_startup(void);
+extern void ITs_cion_peer_info_cleanup(void);
+extern void ITs_cion_server_startup(void);
+extern void ITs_cion_server_cleanup(void);
+
+extern int ITc_cion_payload_async_result_clone_destroy_p(void);
+extern int ITc_cion_payload_async_result_get_peer_info_p(void);
+extern int ITc_cion_payload_async_result_get_payload_id_p(void);
+extern int ITc_cion_peer_info_clone_destroy_p(void);
+extern int ITc_cion_peer_info_get_device_id_p(void);
+extern int ITc_cion_peer_info_get_device_name_p(void);
+extern int ITc_cion_peer_info_get_device_platform_p(void);
+extern int ITc_cion_peer_info_get_device_platform_version_p(void);
+extern int ITc_cion_peer_info_get_device_type_p(void);
+extern int ITc_cion_peer_info_get_app_id_p(void);
+extern int ITc_cion_peer_info_get_app_version_p(void);
+extern int ITc_cion_peer_info_get_uuid_p(void);
+extern int ITc_cion_peer_info_get_display_name_p(void);
+extern int ITc_cion_client_create_destroy_p(void);
+extern int ITc_cion_client_send_data_p(void);
+extern int ITc_cion_client_try_stop_discovery_p(void);
+extern int ITc_cion_client_connect_disconnect_p(void);
+extern int ITc_cion_client_send_payload_async_p(void);
+extern int ITc_cion_client_add_remove_connection_result_cb_p(void);
+extern int ITc_cion_client_add_remove_payload_received_cb_p(void);
+extern int ITc_cion_client_add_remove_disconnected_cb_p(void);
+extern int ITc_cion_group_create_destroy_p(void);
+extern int ITc_cion_group_subscribe_unsubscribe_p(void);
+extern int ITc_cion_group_publish_p(void);
+extern int ITc_cion_security_create_destory_p(void);
+extern int ITc_cion_security_set_get_ca_path_p(void);
+extern int ITc_cion_security_set_get_cert_path_p(void);
+extern int ITc_cion_security_set_get_private_key_path_p(void);
+extern int ITc_cion_payload_create_destroy_p(void);
+extern int ITc_cion_payload_get_type_p(void);
+extern int ITc_cion_payload_set_get_data_p(void);
+extern int ITc_cion_payload_set_file_path_p(void);
+extern int ITc_cion_payload_get_payload_id_p(void);
+extern int ITc_cion_payload_save_as_file_p(void);
+extern int ITc_cion_payload_get_received_file_name_p(void);
+extern int ITc_cion_payload_get_received_bytes_p(void);
+extern int ITc_cion_payload_get_total_bytes_p(void);
+extern int ITc_cion_server_create_destroy_p(void);
+extern int ITc_cion_server_listen_stop_p(void);
+extern int ITc_cion_server_add_remove_connection_result_cb_p(void);
+extern int ITc_cion_server_add_remove_payload_received_cb_p(void);
+extern int ITc_cion_server_set_unset_data_received_cb_p(void);
+extern int ITc_cion_server_add_remove_disconnected_cb_p(void);
+extern int ITc_cion_server_accept_p(void);
+extern int ITc_cion_server_set_display_name_p(void);
+extern int ITc_cion_server_foreach_connected_peer_info_p(void);
+extern int ITc_cion_server_set_on_demand_launch_enabled_p(void);
+extern int ITc_cion_server_reject_p(void);
+extern int ITc_cion_server_disconnect_p(void);
+extern int ITc_cion_server_send_payload_async_p(void);
+
+testcase tc_array[] = {
+ {"ITc_cion_payload_async_result_clone_destroy_p", ITc_cion_payload_async_result_clone_destroy_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_payload_async_result_get_peer_info_p", ITc_cion_payload_async_result_get_peer_info_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_payload_async_result_get_payload_id_p", ITc_cion_payload_async_result_get_payload_id_p, ITs_cion_payload_async_startup, ITs_cion_payload_async_cleanup},
+ {"ITc_cion_peer_info_clone_destroy_p",ITc_cion_peer_info_clone_destroy_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_id_p", ITc_cion_peer_info_get_device_id_p,ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_name_p",ITc_cion_peer_info_get_device_name_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_platform_p",ITc_cion_peer_info_get_device_platform_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_platform_version_p",ITc_cion_peer_info_get_device_platform_version_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_device_type_p",ITc_cion_peer_info_get_device_type_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_app_id_p",ITc_cion_peer_info_get_app_id_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_app_version_p",ITc_cion_peer_info_get_app_version_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_uuid_p",ITc_cion_peer_info_get_uuid_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_peer_info_get_display_name_p",ITc_cion_peer_info_get_display_name_p, ITs_cion_peer_info_startup, ITs_cion_peer_info_cleanup},
+ {"ITc_cion_client_create_destroy_p", ITc_cion_client_create_destroy_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_send_data_p", ITc_cion_client_send_data_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_try_stop_discovery_p", ITc_cion_client_try_stop_discovery_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_connect_disconnect_p", ITc_cion_client_connect_disconnect_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_send_payload_async_p", ITc_cion_client_send_payload_async_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_connection_result_cb_p", ITc_cion_client_add_remove_connection_result_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_payload_received_cb_p", ITc_cion_client_add_remove_payload_received_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_client_add_remove_disconnected_cb_p", ITc_cion_client_add_remove_disconnected_cb_p, ITs_cion_client_startup, ITs_cion_client_cleanup},
+ {"ITc_cion_group_create_destroy_p", ITc_cion_group_create_destroy_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_group_subscribe_unsubscribe_p", ITc_cion_group_subscribe_unsubscribe_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_group_publish_p", ITc_cion_group_publish_p, ITs_cion_group_startup, ITs_cion_group_cleanup},
+ {"ITc_cion_security_create_destory_p", ITc_cion_security_create_destory_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_ca_path_p", ITc_cion_security_set_get_ca_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_cert_path_p", ITc_cion_security_set_get_cert_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_security_set_get_private_key_path_p", ITc_cion_security_set_get_private_key_path_p, ITs_cion_security_startup, ITs_cion_security_cleanup},
+ {"ITc_cion_payload_create_destroy_p", ITc_cion_payload_create_destroy_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_type_p", ITc_cion_payload_get_type_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_file_path_p", ITc_cion_payload_set_file_path_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_file_path_p", ITc_cion_payload_set_file_path_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_set_get_data_p",ITc_cion_payload_set_get_data_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_payload_id_p", ITc_cion_payload_get_payload_id_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_save_as_file_p", ITc_cion_payload_save_as_file_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_received_file_name_p", ITc_cion_payload_get_received_file_name_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_received_bytes_p", ITc_cion_payload_get_received_bytes_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_payload_get_total_bytes_p", ITc_cion_payload_get_total_bytes_p, ITs_cion_payload_startup, ITs_cion_payload_cleanup},
+ {"ITc_cion_server_create_destroy_p",ITc_cion_server_create_destroy_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_listen_stop_p",ITc_cion_server_listen_stop_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_connection_result_cb_p",ITc_cion_server_add_remove_connection_result_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_payload_received_cb_p",ITc_cion_server_add_remove_payload_received_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_unset_data_received_cb_p",ITc_cion_server_set_unset_data_received_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_add_remove_disconnected_cb_p",ITc_cion_server_add_remove_disconnected_cb_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_accept_p",ITc_cion_server_accept_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_display_name_p",ITc_cion_server_set_display_name_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_foreach_connected_peer_info_p",ITc_cion_server_foreach_connected_peer_info_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_set_on_demand_launch_enabled_p",ITc_cion_server_set_on_demand_launch_enabled_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_reject_p",ITc_cion_server_reject_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_disconnect_p",ITc_cion_server_disconnect_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {"ITc_cion_server_send_payload_async_p",ITc_cion_server_send_payload_async_p, ITs_cion_server_startup, ITs_cion_server_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_CION_NATIVE_H__