static rpc_port_proxy_h g_hproxyhandle;
static rpc_port_h g_hreceivedport;
+static rpc_port_parcel_h g_hParcel;
static const char g_szParcelServiceAppID[] = "org.example.stubsample";
static const char g_szParcelPortName[] = "Message";
const char g_szCreateTest[] = "create_from_port";
const char g_szSendTest[] = "send";
+const char g_szSetGetSeqNumTest[] = "set_get_seq_num";
+const char g_szSetGetTagTest[] = "set_get_tag";
+static const char g_szPorttest[] = "porttest";
+static const char g_szPort_Name[] = "Message";
bool g_callbackOnMsgReceived;
/**
}
if (data == g_szCreateTest)
{
+ FPRINTF("[Line : %d][%s] g_szCreateTest \\n", __LINE__, API_NAMESPACE);
rpc_port_parcel_h hParcel = NULL;
nRet = rpc_port_parcel_create(&hParcel);
FPRINTF("[Line : %d][%s] rpc_port_parcel_create error \\n", __LINE__, API_NAMESPACE);
return;
}
+ if (hParcel == NULL) {
+ FPRINTF("[Line : %d][%s] hParcel is NULL \\n", __LINE__, API_NAMESPACE);
+ normal_exit(1);
+ return;
+ }
rpc_port_parcel_write_int32(hParcel, Message_METHOD_Send);
rpc_port_parcel_write_string(hParcel, "receive");
}
else if (data == g_szSendTest)
{
- rpc_port_parcel_h hRpcPortParcel;
- nRet = rpc_port_parcel_create(&hRpcPortParcel);
+ FPRINTF("[Line : %d][%s] g_szSendTest \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_header_h hRpcPortParcel;
+ nRet = rpc_port_parcel_create(&g_hParcel);
if (nRet != RPC_PORT_ERROR_NONE) {
FPRINTF("[Line : %d][%s] rpc_port_parcel_create error \\n", __LINE__, API_NAMESPACE);
normal_exit(1);
return;
}
-
- nRet = rpc_port_parcel_write_string(hRpcPortParcel, "test");
- if (nRet != RPC_PORT_ERROR_NONE)
- rpc_port_parcel_destroy(hRpcPortParcel);
-
- nRet = rpc_port_parcel_send(hRpcPortParcel, port);
+ if (g_hParcel == NULL) {
+ FPRINTF("[Line : %d][%s] g_hParcel is NULL \\n", __LINE__, API_NAMESPACE);
+ normal_exit(1);
+ return;
+ }
+ nRet = rpc_port_parcel_get_header(g_hParcel, &hRpcPortParcel);
if (nRet != RPC_PORT_ERROR_NONE) {
- FPRINTF("[Line : %d][%s] rpc_port_parcel_send error \\n", __LINE__, API_NAMESPACE);
- rpc_port_parcel_destroy(hRpcPortParcel);
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_get_header error \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_destroy(g_hParcel);
normal_exit(1);
return;
}
-
- nRet = rpc_port_parcel_destroy(hRpcPortParcel);
+ if (hRpcPortParcel == NULL) {
+ FPRINTF("[Line : %d][%s] hRpcPortParcel is NULL \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_destroy(g_hParcel);
+ normal_exit(1);
+ return;
+ }
+ nRet = rpc_port_parcel_header_set_tag(hRpcPortParcel, "1.5.0");
if (nRet != RPC_PORT_ERROR_NONE) {
- FPRINTF("[Line : %d][%s] rpc_port_parcel_destroy error \\n", __LINE__, API_NAMESPACE);
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_header_set_tag error \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_destroy(g_hParcel);
+ normal_exit(1);
+ return;
+ }
+ nRet = rpc_port_parcel_header_set_seq_num(hRpcPortParcel, 100);
+ if (nRet != RPC_PORT_ERROR_NONE) {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_header_set_seq_num error \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_destroy(g_hParcel);
normal_exit(1);
return;
}
+ rpc_port_parcel_write_int32(g_hParcel, Message_METHOD_Send);
+
+ rpc_port_parcel_write_string(g_hParcel, "receive");
+
+ rpc_port_parcel_send(g_hParcel, port);
}
FPRINTF("[Line : %d][%s] Leaving Callback RpcMessage_Onconnected_cb \\n", __LINE__, API_NAMESPACE);
- // if (g_pMainLoop )
- // {
- // g_main_loop_quit(g_pMainLoop);
- // g_pMainLoop = NULL;
- // }
- normal_exit(0);
return;
}
return;
}
}
- if (g_pMainLoop )
- {
- g_main_loop_quit(g_pMainLoop);
- g_pMainLoop = NULL;
- }
- normal_exit(0);
FPRINTF("[Line : %d][%s] Leaving Callback RpcMessage_Onconnected_cb2 \\n", __LINE__, API_NAMESPACE);
return;
}
g_callbackOnMsgReceived = true;
rpc_port_h hreceivedport= NULL;
+ rpc_port_parcel_header_h hReceivedHeader;
+
+ rpc_port_parcel_h hPortParcel = NULL;
+ rpc_port_parcel_header_h hPortParcelHeader = NULL;
+
int nRet = rpc_port_proxy_get_port(g_hproxyhandle, RPC_PORT_PORT_CALLBACK, &hreceivedport);
if ( nRet != RPC_PORT_ERROR_NONE )
{
normal_exit(1);
return;
}
+ if (data == g_szSetGetTagTest) {
+ FPRINTF("[Line : %d][%s] g_szSetGetTagTest \\n", __LINE__, API_NAMESPACE);
+ char *hTag;
+ char *hReceivedTag;
+ nRet = rpc_port_parcel_create_from_port(&hParcelReceive, hreceivedport);
+ if ( nRet != RPC_PORT_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_create_from_port error \\n", __LINE__, API_NAMESPACE);
+ if(hParcelReceive)
+ {
+ rpc_port_parcel_destroy(hParcelReceive);
+ }
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+ if (hParcelReceive == NULL) {
+ FPRINTF("[Line : %d][%s] hParcelReceive is NULL \\n", __LINE__, API_NAMESPACE);
+ normal_exit(1);
+ return;
+ }
+
+ nRet = rpc_port_parcel_get_header(g_hParcel, &hPortParcelHeader);
+ if ( nRet != RPC_PORT_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_get_header error \\n", __LINE__, API_NAMESPACE);
+ if(hParcelReceive)
+ {
+ rpc_port_parcel_destroy(hParcelReceive);
+ }
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+ if (hPortParcelHeader == NULL) {
+ FPRINTF("[Line : %d][%s] hPortParcelHeader is NULL \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_destroy(hParcelReceive);
+ normal_exit(1);
+ return;
+ }
+
+ nRet = rpc_port_parcel_header_get_tag(hPortParcelHeader, &hTag);
+ if ( nRet != RPC_PORT_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_header_get_tag error \\n", __LINE__, API_NAMESPACE);
+ if(hParcelReceive)
+ {
+ rpc_port_parcel_destroy(hParcelReceive);
+ }
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+ if (hTag == NULL) {
+ FPRINTF("[Line : %d][%s] hTag is NULL \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_destroy(hParcelReceive);
+ normal_exit(1);
+ return;
+ }
+
+ nRet = rpc_port_parcel_get_header(hParcelReceive, &hReceivedHeader);
+ if ( nRet != RPC_PORT_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_get_header error \\n", __LINE__, API_NAMESPACE);
+ if(hParcelReceive)
+ {
+ rpc_port_parcel_destroy(hParcelReceive);
+ }
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+ if (hReceivedHeader == NULL) {
+ FPRINTF("[Line : %d][%s] hReceivedHeader is NULL \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_destroy(hParcelReceive);
+ normal_exit(1);
+ return;
+ }
+
+ nRet = rpc_port_parcel_header_get_tag(hPortParcelHeader, &hReceivedTag);
+ if ( nRet != RPC_PORT_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_header_get_tag error \\n", __LINE__, API_NAMESPACE);
+ if(hParcelReceive)
+ {
+ rpc_port_parcel_destroy(hParcelReceive);
+ }
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+ if (hReceivedTag == NULL) {
+ FPRINTF("[Line : %d][%s] hReceivedTag is NULL \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_destroy(hParcelReceive);
+ normal_exit(1);
+ return;
+ }
+
+ if (strcmp(hReceivedTag, hTag) != 0)
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_destroy error %s %s \\n", __LINE__, API_NAMESPACE,hReceivedTag,hTag);
+ rpc_port_parcel_destroy(hParcelReceive);
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+ nRet = rpc_port_parcel_destroy(hParcelReceive);
+ if (nRet != RPC_PORT_ERROR_NONE) {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_destroy error \\n", __LINE__, API_NAMESPACE);
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+ if (g_pMainLoop )
+ {
+ g_main_loop_quit(g_pMainLoop);
+ }
+ normal_exit(0);
+ return;
+ }
+ else if (data == g_szSetGetSeqNumTest)
+ {
+ FPRINTF("[Line : %d][%s] g_szSetGetSeqNumTest \\n", __LINE__, API_NAMESPACE);
+ int seq_num;
+ int received_seq_num;
+ nRet = rpc_port_parcel_create_from_port(&hParcelReceive, hreceivedport);
+ if ( nRet != RPC_PORT_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_create_from_port error \\n", __LINE__, API_NAMESPACE);
+ if(hParcelReceive)
+ {
+ rpc_port_parcel_destroy(hParcelReceive);
+ }
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+
+ nRet = rpc_port_parcel_get_header(g_hParcel, &hPortParcelHeader);
+ if ( nRet != RPC_PORT_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_get_header error \\n", __LINE__, API_NAMESPACE);
+ if(hParcelReceive)
+ {
+ rpc_port_parcel_destroy(hParcelReceive);
+ }
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+ if (hPortParcelHeader == NULL) {
+ FPRINTF("[Line : %d][%s] hPortParcelHeader is NULL \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_destroy(hParcelReceive);
+ normal_exit(1);
+ return;
+ }
+
+ nRet = rpc_port_parcel_header_get_seq_num(hPortParcelHeader, &seq_num);
+ if ( nRet != RPC_PORT_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_header_get_seq_num error \\n", __LINE__, API_NAMESPACE);
+ if(hParcelReceive)
+ {
+ rpc_port_parcel_destroy(hParcelReceive);
+ }
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+
+ nRet = rpc_port_parcel_get_header(hParcelReceive, &hReceivedHeader);
+ if ( nRet != RPC_PORT_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_get_header error \\n", __LINE__, API_NAMESPACE);
+ if(hParcelReceive)
+ {
+ rpc_port_parcel_destroy(hParcelReceive);
+ }
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+ if (hReceivedHeader == NULL) {
+ FPRINTF("[Line : %d][%s] hReceivedHeader is NULL \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_destroy(hParcelReceive);
+ normal_exit(1);
+ return;
+ }
+
+ nRet = rpc_port_parcel_header_get_seq_num(hReceivedHeader, &received_seq_num);
+ if ( nRet != RPC_PORT_ERROR_NONE )
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_header_get_seq_num error \\n", __LINE__, API_NAMESPACE);
+ if(hParcelReceive)
+ {
+ rpc_port_parcel_destroy(hParcelReceive);
+ }
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+
+ if (seq_num != received_seq_num)
+ {
+ FPRINTF("[Line : %d][%s] mismatch error %d %d \\n", __LINE__, API_NAMESPACE,seq_num,received_seq_num);
+ normal_exit(1);
+ return;
+ }
+
+ nRet = rpc_port_parcel_destroy(hParcelReceive);
+ if (nRet != RPC_PORT_ERROR_NONE) {
+ FPRINTF("[Line : %d][%s] rpc_port_parcel_destroy error \\n", __LINE__, API_NAMESPACE);
+ rpc_port_parcel_destroy(hParcelReceive);
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(1);
+ return;
+ }
+ g_main_loop_quit(g_pMainLoop);
+ normal_exit(0);
+ return;
+ }
nRet = rpc_port_parcel_create_from_port(&hParcelReceive, hreceivedport);
if ( nRet != RPC_PORT_ERROR_NONE )
#if DEBUG
FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_rpc-port_p\\n", __LINE__, API_NAMESPACE);
#endif
+ g_hParcel = NULL;
int nRet = rpc_port_proxy_create(&g_hproxyhandle);
if ( nRet != RPC_PORT_ERROR_NONE )
{
{
rpc_port_proxy_destroy(g_hproxyhandle);
}
+ if (g_hParcel)
+ {
+ rpc_port_parcel_destroy(g_hParcel);
+ }
}
/**
return 0;
}
+/**
+* @testcase ITc_rpc_port_parcel_get_header_p
+* @since_tizen 6.5
+* @author SRID(manu.tiwari)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the header handle from the rpc port parcel handle
+* @scenario Gets the header handle from the rpc port parcel handle
+* @apicovered rpc_port_parcel_get_header
+* @passcase When rpc_port_parcel_get_header is successful.
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+int ITc_rpc_port_parcel_get_header_p(void)
+{
+ START_TEST;
+ rpc_port_parcel_h hPortParcel = NULL;
+ rpc_port_parcel_header_h hPortParcelHeader = NULL;
+
+ int nRetVal = rpc_port_parcel_create(&hPortParcel);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_parcel_create", RpcPortGetError(nRetVal));
+ CHECK_HANDLE(hPortParcel, "rpc_port_parcel_create");
+
+ // Target API
+ nRetVal = rpc_port_parcel_get_header(hPortParcel, &hPortParcelHeader);
+ PRINT_RESULT_CLEANUP(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_parcel_get_header", RpcPortGetError(nRetVal),rpc_port_parcel_destroy(hPortParcel));
+
+ nRetVal = rpc_port_parcel_destroy(hPortParcel);
+ PRINT_RESULT_NORETURN(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_parcel_destroy", RpcPortGetError(nRetVal));
+
+ return 0;
+}
+/**
+* @testcase ITc_rpc_port_parcel_header_set_get_seq_num_p
+* @since_tizen 6.5
+* @author SRID(manu.tiwari)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets and gets the sequence number
+* @scenario Sets and gets the sequence number
+* @apicovered rpc_port_parcel_get_header
+* @passcase When rpc_port_parcel_get_header is successful.
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+int ITc_rpc_port_parcel_header_set_get_seq_num_p(void)
+{
+ START_TEST;
+
+ g_bCallbackCalled = false;
+ g_callbackOnMsgReceived = false;
+ int nTimeoutId = -1;
+
+ int nRetVal = rpc_port_proxy_add_connected_event_cb(g_hproxyhandle,RpcMessage_Onconnected_cb, g_szSendTest);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_add_connected_event_cb", RpcPortGetError(nRetVal));
+
+ nRetVal = rpc_port_proxy_add_received_event_cb(g_hproxyhandle,RpcMessage_Onreceived_cb, g_szSetGetSeqNumTest);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_add_received_event_cb", RpcPortGetError(nRetVal));
+
+ nRetVal = rpc_port_proxy_connect(g_hproxyhandle,g_szParcelServiceAppID, g_szPort_Name);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_connect_sync", RpcPortGetError(nRetVal));
+
+ RUN_POLLING_LOOP;
+ if(g_bCallbackCalled != true)
+ {
+ FPRINTF("[Line : %d][%s] Callback RpcMessage_Onconnected_cb not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_connected_event_cb");
+ return 1;
+ }
+ if(g_callbackOnMsgReceived != true)
+ {
+
+ FPRINTF("[Line : %d][%s] Callback RpcMessage_Onreceived_cb not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_received_event_cb");
+ return 1;
+ }
+
+ return 0;
+}
+
+/**
+* @testcase ITc_rpc_port_parcel_header_get_timestamp_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the timestamp from the header handle of the rpc port parcel.
+* @scenario Gets the timestamp from the header handle of the rpc port parcel.
+* @apicovered rpc_port_parcel_get_header
+* @passcase When rpc_port_parcel_get_header is successful.
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+int ITc_rpc_port_parcel_header_get_timestamp_p(void)
+{
+ START_TEST;
+
+ rpc_port_parcel_h hPortParcel = NULL;
+ rpc_port_parcel_header_h hPortParcelHeader = NULL;
+ struct timespec getTimeStamp = { 0, };
+
+ int nRetVal = rpc_port_parcel_create(&hPortParcel);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_parcel_create", RpcPortGetError(nRetVal));
+
+ nRetVal = rpc_port_parcel_get_header(hPortParcel, &hPortParcelHeader);
+ PRINT_RESULT_CLEANUP(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_parcel_get_header", RpcPortGetError(nRetVal),rpc_port_parcel_destroy(hPortParcel));
+
+ nRetVal = rpc_port_parcel_header_get_timestamp(hPortParcelHeader, &getTimeStamp);
+ PRINT_RESULT_CLEANUP(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_parcel_header_get_timestamp", RpcPortGetError(nRetVal),rpc_port_parcel_destroy(hPortParcel));
+
+ nRetVal = rpc_port_parcel_destroy(hPortParcel);
+ PRINT_RESULT_NORETURN(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_parcel_destroy", RpcPortGetError(nRetVal));
+
+ return 0;
+}
+
+/**
+* @testcase ITc_rpc_port_parcel_header_set_get_tag_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets and gets the tag.
+* @scenario Sets and gets the tag.
+* @apicovered rpc_port_parcel_header_set_tag,rpc_port_parcel_header_get_tag
+* @passcase When rpc_port_parcel_header_set_tag and rpc_port_parcel_header_get_tag is successful.
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+int ITc_rpc_port_parcel_header_set_get_tag_p(void)
+{
+ START_TEST;
+
+ g_bCallbackCalled = false;
+ g_callbackOnMsgReceived = false;
+ int nTimeoutId = -1;
+
+ int nRetVal = rpc_port_proxy_add_connected_event_cb(g_hproxyhandle,RpcMessage_Onconnected_cb, g_szSendTest);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_add_connected_event_cb", RpcPortGetError(nRetVal));
+
+ nRetVal = rpc_port_proxy_add_received_event_cb(g_hproxyhandle,RpcMessage_Onreceived_cb, g_szSetGetTagTest);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_add_received_event_cb", RpcPortGetError(nRetVal));
+
+ nRetVal = rpc_port_proxy_connect(g_hproxyhandle,g_szParcelServiceAppID, g_szPort_Name);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_connect", RpcPortGetError(nRetVal));
+
+ RUN_POLLING_LOOP;
+ if(g_bCallbackCalled != true)
+ {
+ FPRINTF("[Line : %d][%s] Callback RpcMessage_Onconnected_cb not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_connected_event_cb");
+ return 1;
+ }
+ if(g_callbackOnMsgReceived != true)
+ {
+
+ FPRINTF("[Line : %d][%s] Callback RpcMessage_Onreceived_cb not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_received_event_cb");
+ return 1;
+ }
+
+ return 0;
+}
/** @} */
/** @} */
\ No newline at end of file
static const char g_szReceivetest[] = "receivetest";
const char g_szPort_Name_Stubtest[] = "Message2";
static char g_szStubgetporttest[] = "stubgetporttest";
+static char g_szStubgetdisconnectport[] = "disconnectporttest";
/**
* @function Rpc_Message_On_Connected_stub_cb
FPRINTF("[Line : %d][%s] rpc_port_stub_get_port called \\n", __LINE__, API_NAMESPACE);
rpc_port_h hPort = NULL;
int nRetVal = rpc_port_stub_get_port(g_hstubhandle, RPC_PORT_PORT_CALLBACK,instance,&hPort);
- if (nRetVal != RPC_PORT_ERROR_NONE)
+ if (nRetVal != RPC_PORT_ERROR_NONE)
{
FPRINTF("[Line : %d][%s] rpc_port_stub_get_port error \\n", __LINE__, API_NAMESPACE);
normal_exit(1);
return;
}
- else
+ else
+ {
+ normal_exit(0);
+ return;
+ }
+ }
+ else if (data == g_szStubgetdisconnectport)
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_stub_get_port called \\n", __LINE__, API_NAMESPACE);
+ rpc_port_h hPort = NULL;
+ int nRetVal = rpc_port_stub_get_port(g_hstubhandle, RPC_PORT_PORT_CALLBACK,instance,&hPort);
+ if (nRetVal != RPC_PORT_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_stub_get_port error \\n", __LINE__, API_NAMESPACE);
+ normal_exit(1);
+ return;
+ }
+ nRetVal = rpc_port_disconnect(hPort);
+ if (nRetVal != RPC_PORT_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] rpc_port_disconnect error \\n", __LINE__, API_NAMESPACE);
+ normal_exit(1);
+ return;
+ }
+ else
{
normal_exit(0);
return;
g_main_loop_quit(g_pMainLoop);
normal_exit(1);
}
- if (data == g_szStubgetporttest)
+ if (data == g_szStubgetporttest)
{
FPRINTF("[Line : %d][%s] rpc_port_stub_get_port called \\n", __LINE__, API_NAMESPACE);
rpc_port_h hPort = NULL;
normal_exit(1);
return;
}
- else
+ else
{
normal_exit(0);
return;
PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_stub_add_disconnected_event_cb", RpcPortGetError(nRetVal));
+ nRetVal = rpc_port_stub_listen(g_hstubhandle);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_stub_listen", RpcPortGetError(nRetVal));
+
+ RunProxyApp();
+ RUN_POLLING_LOOP;
+
+ if(g_bCallbackCalled != true)
+ {
+ FPRINTF("[Line : %d][%s] Callback Rpc_Message_On_Connected_stub_cb not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_stub_add_connected_event_cb");
+ return 1;
+ }
+
+ if(g_callbackMsgreceived != true)
+ {
+ FPRINTF("[Line : %d][%s] Callback Rpc_Message_On_Received_stub_cb not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_stub_add_received_event_cb");
+ return 1;
+ }
+
+ if(g_bcallBackDisConnect != true)
+ {
+ FPRINTF("[Line : %d][%s] Callback Rpc_Message_On_DisConnected_stub_cb not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_stub_add_disconnected_event_cb");
+ return 1;
+ }
+ return 0;
+}
+
+/**
+* @testcase ITc_rpc_port_disconnect_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Disconnects the port.
+* @scenario Disconnects the port.
+* @apicovered rpc_port_disconnect
+* @passcase When rpc_port_disconnect is successful.
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+int ITc_rpc_port_disconnect_p(void)
+{
+ START_TEST;
+
+ rpc_port_proxy_h hPortProxy = NULL;
+ g_bCallbackCalled = false;
+ g_callbackMsgreceived = false;
+ g_bcallBackDisConnect = false;
+ int nTimeoutId = -1;
+
+ int nRetVal = rpc_port_stub_add_connected_event_cb(g_hstubhandle,Rpc_Message_On_Connected_stub_cb, g_szStubgetdisconnectport);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_stub_add_connected_event_cb", RpcPortGetError(nRetVal));
+
+ nRetVal = rpc_port_stub_add_received_event_cb(g_hstubhandle,Rpc_Message_On_Received_stub_cb, NULL);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_stub_add_received_event_cb", RpcPortGetError(nRetVal));
+
+ // Target API
+ nRetVal = rpc_port_stub_add_disconnected_event_cb(g_hstubhandle,Rpc_Message_On_DisConnected_stub_cb, NULL);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_stub_add_disconnected_event_cb", RpcPortGetError(nRetVal));
+
+
nRetVal = rpc_port_stub_listen(g_hstubhandle);
PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_stub_listen", RpcPortGetError(nRetVal));