Loading ccsrc/Protocols/Json/json_codec.cc +19 −3 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy loggers::get_instance().log("json_codec::decode: decoding_buffer='%c' / '%s'", str[0], str.c_str()); TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); if (it->second.find("\"UserList\"") != std::string::npos) { // Be careful to the order if (it->second.find("\"userList\"") != std::string::npos) { // Be careful to the order // TODO To be refined, find("\"userList\"") is not optimal int idx_begin = it->second.find(":"); int idx_end = it->second.rfind("}") - 1; // Remove the last '}' Loading @@ -120,14 +120,30 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy access_point_list.decode(LocationAPI__TypesAndValues::AccessPointList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.accessPointList() = access_point_list; } else if (it->second.find("\"userTrackingSubscription\"") != std::string::npos) { int idx_begin = it->second.find(":"); int idx_end = it->second.rfind("}") - 1; // Remove the last '}' str = it->second.substr(idx_begin + 1, idx_end - idx_begin); TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); LocationAPI__TypesAndValues::UserTrackingSubscription user_tracking_subscription; user_tracking_subscription.decode(LocationAPI__TypesAndValues::UserTrackingSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.userTrackingSubscription() = user_tracking_subscription; } else if (it->second.find("\"userInfo\"") != std::string::npos) { } else if (it->second.find("\"periodicTrackingSubscription\"") != std::string::npos) { int idx_begin = it->second.find(":"); int idx_end = it->second.rfind("}") - 1; // Remove the last '}' str = it->second.substr(idx_begin + 1, idx_end - idx_begin); TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); LocationAPI__TypesAndValues::PeriodicTrackingSubscription periodic_tracking_subscription; periodic_tracking_subscription.decode(LocationAPI__TypesAndValues::PeriodicTrackingSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.periodicTrackingSubscription() = periodic_tracking_subscription; } else if (it->second.find("\"accessPointId\"") != std::string::npos) { LocationAPI__TypesAndValues::UserInfo user_info; user_info.decode(LocationAPI__TypesAndValues::UserInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.userInfo() = user_info; } else if (it->second.find("\"terminalDistance\"") != std::string::npos) { int idx_begin = it->second.find(":"); int idx_end = it->second.rfind("}") - 1; // Remove the last '}' str = it->second.substr(idx_begin + 1, idx_end - idx_begin); TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); LocationAPI__TypesAndValues::TerminalDistance terminal_distance; terminal_distance.decode(LocationAPI__TypesAndValues::TerminalDistance_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.terminalDistance() = terminal_distance; Loading ttcn/AtsMec/AtsMec_LocationAPI_TestCases.ttcn +12 −13 Original line number Diff line number Diff line Loading @@ -73,13 +73,12 @@ module AtsMec_LocationAPI_TestCases { mw_http_response( mw_http_response_ok( mw_http_message_body_json( mw_body_json_user_list( mw_user_list( { *, mw_user_info(PX_USER, PX_ACCESS_POINT_ID, PX_ZONE_ID, PX_RESOURCE_URL), * } mw_body_json_user_info( mw_user_info( PX_USER, PX_ACCESS_POINT_ID, PX_ZONE_ID, PX_RESOURCE_URL )))))) { tc_ac.stop; Loading Loading @@ -493,8 +492,8 @@ module AtsMec_LocationAPI_TestCases { mw_http_response( mw_http_response_201_created( mw_http_message_body_json( mw_body_json_user_tracking_subscription( mw_user_tracking_subscription( mw_body_json_periodic_tracking_subscription( mw_periodic_tracking_subscription( PX_CLIENT_ID, PX_CALLBACK_REF_URL, PX_USER Loading Loading @@ -952,7 +951,7 @@ module AtsMec_LocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( "/" & PICS_ROOT_API & "invilad/" & PX_ME_APP_Q_USERS_INF_SUB_URI, "/" & PICS_ROOT_API & "/invilad/" & PX_ME_APP_Q_USERS_INF_SUB_URI, v_headers, m_http_message_body_json( m_body_json_zonal_traffic_subscription( Loading ttcn/AtsMec/AtsMec_RadioNodeLocationAPI_TestCases.ttcn +6 −6 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( PX_ME_APP_Q_ZONE_ID_URI & "/" & oct2char(unichar2oct(PX_ZONE_ID, "UTF-8")) & "/accessPoints", "/" & PICS_ROOT_API & PX_ME_APP_Q_ZONE_ID_URI & "/" & oct2char(unichar2oct(PX_ZONE_ID, "UTF-8")) & "/accessPoints", v_headers ) ) Loading Loading @@ -562,7 +562,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_DIST_SUB_URI, "UTF-8")), "/" & PICS_ROOT_API & PX_ME_APP_Q_DIST_URI, v_headers, m_http_message_body_json( m_body_json_distance_notification_subscription( Loading Loading @@ -646,7 +646,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_DIST_SUB_URI, "UTF-8")), "/" & PICS_ROOT_API & PX_ME_APP_Q_DIST_URI, v_headers, m_http_message_body_json( m_body_json_distance_notification_subscription( Loading Loading @@ -712,7 +712,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_delete( "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_DIST_SUB_URI, "UTF-8")) & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")), "/" & PICS_ROOT_API & PX_ME_APP_Q_DIST_URI & "/" & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")), v_headers ) ) Loading Loading @@ -766,7 +766,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_delete( "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_DIST_SUB_URI, "UTF-8")) & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")), "/" & PICS_ROOT_API & PX_ME_APP_Q_DIST_URI & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")), v_headers ) ) Loading Loading @@ -827,7 +827,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_LOC_USERS_URI)) & "?address=" & oct2char(unichar2oct(PX_ACR_SOME_IP, "UTF-8")), "/" & PICS_ROOT_API & PX_ME_APP_Q_USERS_LIST_URI, v_headers ) ) Loading ttcn/LibMec/LocationAPI/ttcn/LocationAPI_Pixits.ttcn +3 −3 Original line number Diff line number Diff line Loading @@ -37,13 +37,13 @@ module LocationAPI_Pixits { modulepar CallbackReference PX_CALLBACK_REF_URL := { "http://clientApp.example.com/location_notifications/123456" }; modulepar CallbackReference PX_UE_PERIODIC_SUB_CALLBACK_URI := { "" }; modulepar CallbackReference PX_UE_PERIODIC_SUB_CALLBACK_URI := { "http://clientApp.example.com/location_notifications/123456" }; modulepar Address PX_IP_ADDRESS := "acr:10.0.0.3"; modulepar CallbackReference PX_AREA_SUB_CALLBACK_URI := { "" }; modulepar CallbackReference PX_AREA_SUB_CALLBACK_URI := { "http://clientApp.example.com/location_notifications/123456" }; modulepar CallbackReference PX_UE_DIST_SUB_CALLBACK_URI := { "" }; modulepar CallbackReference PX_UE_DIST_SUB_CALLBACK_URI := { "http://clientApp.example.com/location_notifications/123456" }; modulepar Address PX_UE_MONITORED_IP_ADDRESS := "acr:10.0.0.1"; Loading ttcn/LibMec/LocationAPI/ttcn/LocationAPI_Templates.ttcn +30 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,36 @@ module LocationAPI_Templates { resourceURL := p_resourceURL } // End of template mw_user_tracking_subscription template (value) PeriodicTrackingSubscription m_periodic_tracking_subscription( in ClientCorrelator p_clientCorrelator, in CallbackReference p_callbackReference, in Address p_address := PX_USER, in JSON.Number p_frequency := 10.0, in JSON.Number p_requestedAccuracy := 10.0 ) := { clientCorrelator := p_clientCorrelator, callbackReference := p_callbackReference, address_ := p_address, frequency := p_frequency, requestedAccuracy := p_requestedAccuracy, resourceURL := omit } // End of template m_periodic_tracking_subscription template (present) PeriodicTrackingSubscription mw_periodic_tracking_subscription( template (present) ClientCorrelator p_clientCorrelator := ?, template (present) CallbackReference p_callbackReference := ?, template (present) Address p_address := PX_USER, template (present) JSON.Number p_frequency := ?, template (present) JSON.Number p_requestedAccuracy := ? ) := { clientCorrelator := p_clientCorrelator, callbackReference := p_callbackReference, address_ := p_address, frequency := p_frequency, requestedAccuracy := p_requestedAccuracy, resourceURL := * } // End of template mw_periodic_tracking_subscription template (value) ZonalTrafficSubscription m_zonal_traffic_subscription( in ClientCorrelator p_client_correlator, in CallbackReference p_callback_reference, Loading Loading
ccsrc/Protocols/Json/json_codec.cc +19 −3 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy loggers::get_instance().log("json_codec::decode: decoding_buffer='%c' / '%s'", str[0], str.c_str()); TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); if (it->second.find("\"UserList\"") != std::string::npos) { // Be careful to the order if (it->second.find("\"userList\"") != std::string::npos) { // Be careful to the order // TODO To be refined, find("\"userList\"") is not optimal int idx_begin = it->second.find(":"); int idx_end = it->second.rfind("}") - 1; // Remove the last '}' Loading @@ -120,14 +120,30 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy access_point_list.decode(LocationAPI__TypesAndValues::AccessPointList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.accessPointList() = access_point_list; } else if (it->second.find("\"userTrackingSubscription\"") != std::string::npos) { int idx_begin = it->second.find(":"); int idx_end = it->second.rfind("}") - 1; // Remove the last '}' str = it->second.substr(idx_begin + 1, idx_end - idx_begin); TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); LocationAPI__TypesAndValues::UserTrackingSubscription user_tracking_subscription; user_tracking_subscription.decode(LocationAPI__TypesAndValues::UserTrackingSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.userTrackingSubscription() = user_tracking_subscription; } else if (it->second.find("\"userInfo\"") != std::string::npos) { } else if (it->second.find("\"periodicTrackingSubscription\"") != std::string::npos) { int idx_begin = it->second.find(":"); int idx_end = it->second.rfind("}") - 1; // Remove the last '}' str = it->second.substr(idx_begin + 1, idx_end - idx_begin); TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); LocationAPI__TypesAndValues::PeriodicTrackingSubscription periodic_tracking_subscription; periodic_tracking_subscription.decode(LocationAPI__TypesAndValues::PeriodicTrackingSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.periodicTrackingSubscription() = periodic_tracking_subscription; } else if (it->second.find("\"accessPointId\"") != std::string::npos) { LocationAPI__TypesAndValues::UserInfo user_info; user_info.decode(LocationAPI__TypesAndValues::UserInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.userInfo() = user_info; } else if (it->second.find("\"terminalDistance\"") != std::string::npos) { int idx_begin = it->second.find(":"); int idx_end = it->second.rfind("}") - 1; // Remove the last '}' str = it->second.substr(idx_begin + 1, idx_end - idx_begin); TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); LocationAPI__TypesAndValues::TerminalDistance terminal_distance; terminal_distance.decode(LocationAPI__TypesAndValues::TerminalDistance_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.terminalDistance() = terminal_distance; Loading
ttcn/AtsMec/AtsMec_LocationAPI_TestCases.ttcn +12 −13 Original line number Diff line number Diff line Loading @@ -73,13 +73,12 @@ module AtsMec_LocationAPI_TestCases { mw_http_response( mw_http_response_ok( mw_http_message_body_json( mw_body_json_user_list( mw_user_list( { *, mw_user_info(PX_USER, PX_ACCESS_POINT_ID, PX_ZONE_ID, PX_RESOURCE_URL), * } mw_body_json_user_info( mw_user_info( PX_USER, PX_ACCESS_POINT_ID, PX_ZONE_ID, PX_RESOURCE_URL )))))) { tc_ac.stop; Loading Loading @@ -493,8 +492,8 @@ module AtsMec_LocationAPI_TestCases { mw_http_response( mw_http_response_201_created( mw_http_message_body_json( mw_body_json_user_tracking_subscription( mw_user_tracking_subscription( mw_body_json_periodic_tracking_subscription( mw_periodic_tracking_subscription( PX_CLIENT_ID, PX_CALLBACK_REF_URL, PX_USER Loading Loading @@ -952,7 +951,7 @@ module AtsMec_LocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( "/" & PICS_ROOT_API & "invilad/" & PX_ME_APP_Q_USERS_INF_SUB_URI, "/" & PICS_ROOT_API & "/invilad/" & PX_ME_APP_Q_USERS_INF_SUB_URI, v_headers, m_http_message_body_json( m_body_json_zonal_traffic_subscription( Loading
ttcn/AtsMec/AtsMec_RadioNodeLocationAPI_TestCases.ttcn +6 −6 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( PX_ME_APP_Q_ZONE_ID_URI & "/" & oct2char(unichar2oct(PX_ZONE_ID, "UTF-8")) & "/accessPoints", "/" & PICS_ROOT_API & PX_ME_APP_Q_ZONE_ID_URI & "/" & oct2char(unichar2oct(PX_ZONE_ID, "UTF-8")) & "/accessPoints", v_headers ) ) Loading Loading @@ -562,7 +562,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_DIST_SUB_URI, "UTF-8")), "/" & PICS_ROOT_API & PX_ME_APP_Q_DIST_URI, v_headers, m_http_message_body_json( m_body_json_distance_notification_subscription( Loading Loading @@ -646,7 +646,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_DIST_SUB_URI, "UTF-8")), "/" & PICS_ROOT_API & PX_ME_APP_Q_DIST_URI, v_headers, m_http_message_body_json( m_body_json_distance_notification_subscription( Loading Loading @@ -712,7 +712,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_delete( "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_DIST_SUB_URI, "UTF-8")) & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")), "/" & PICS_ROOT_API & PX_ME_APP_Q_DIST_URI & "/" & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")), v_headers ) ) Loading Loading @@ -766,7 +766,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_delete( "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_DIST_SUB_URI, "UTF-8")) & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")), "/" & PICS_ROOT_API & PX_ME_APP_Q_DIST_URI & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")), v_headers ) ) Loading Loading @@ -827,7 +827,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_LOC_USERS_URI)) & "?address=" & oct2char(unichar2oct(PX_ACR_SOME_IP, "UTF-8")), "/" & PICS_ROOT_API & PX_ME_APP_Q_USERS_LIST_URI, v_headers ) ) Loading
ttcn/LibMec/LocationAPI/ttcn/LocationAPI_Pixits.ttcn +3 −3 Original line number Diff line number Diff line Loading @@ -37,13 +37,13 @@ module LocationAPI_Pixits { modulepar CallbackReference PX_CALLBACK_REF_URL := { "http://clientApp.example.com/location_notifications/123456" }; modulepar CallbackReference PX_UE_PERIODIC_SUB_CALLBACK_URI := { "" }; modulepar CallbackReference PX_UE_PERIODIC_SUB_CALLBACK_URI := { "http://clientApp.example.com/location_notifications/123456" }; modulepar Address PX_IP_ADDRESS := "acr:10.0.0.3"; modulepar CallbackReference PX_AREA_SUB_CALLBACK_URI := { "" }; modulepar CallbackReference PX_AREA_SUB_CALLBACK_URI := { "http://clientApp.example.com/location_notifications/123456" }; modulepar CallbackReference PX_UE_DIST_SUB_CALLBACK_URI := { "" }; modulepar CallbackReference PX_UE_DIST_SUB_CALLBACK_URI := { "http://clientApp.example.com/location_notifications/123456" }; modulepar Address PX_UE_MONITORED_IP_ADDRESS := "acr:10.0.0.1"; Loading
ttcn/LibMec/LocationAPI/ttcn/LocationAPI_Templates.ttcn +30 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,36 @@ module LocationAPI_Templates { resourceURL := p_resourceURL } // End of template mw_user_tracking_subscription template (value) PeriodicTrackingSubscription m_periodic_tracking_subscription( in ClientCorrelator p_clientCorrelator, in CallbackReference p_callbackReference, in Address p_address := PX_USER, in JSON.Number p_frequency := 10.0, in JSON.Number p_requestedAccuracy := 10.0 ) := { clientCorrelator := p_clientCorrelator, callbackReference := p_callbackReference, address_ := p_address, frequency := p_frequency, requestedAccuracy := p_requestedAccuracy, resourceURL := omit } // End of template m_periodic_tracking_subscription template (present) PeriodicTrackingSubscription mw_periodic_tracking_subscription( template (present) ClientCorrelator p_clientCorrelator := ?, template (present) CallbackReference p_callbackReference := ?, template (present) Address p_address := PX_USER, template (present) JSON.Number p_frequency := ?, template (present) JSON.Number p_requestedAccuracy := ? ) := { clientCorrelator := p_clientCorrelator, callbackReference := p_callbackReference, address_ := p_address, frequency := p_frequency, requestedAccuracy := p_requestedAccuracy, resourceURL := * } // End of template mw_periodic_tracking_subscription template (value) ZonalTrafficSubscription m_zonal_traffic_subscription( in ClientCorrelator p_client_correlator, in CallbackReference p_callback_reference, Loading