diff options
Diffstat (limited to 'src/components/policy/policy_external')
17 files changed, 216 insertions, 180 deletions
diff --git a/src/components/policy/policy_external/CMakeLists.txt b/src/components/policy/policy_external/CMakeLists.txt index 0e3735093f..8b0572ba72 100644 --- a/src/components/policy/policy_external/CMakeLists.txt +++ b/src/components/policy/policy_external/CMakeLists.txt @@ -76,7 +76,7 @@ set(GENERATED_MOBILE_POLICY_TYPES ${GENERATED_MOBILE_POLICY_TYPES_CPP}) generate_policy_types("${GENERATED_MOBILE_POLICY_TYPES}" - "${COMPONENTS_DIR}/interfaces/MOBILE_API.xml" + "${CMAKE_SOURCE_DIR}/tools/rpc_spec/MOBILE_API.xml" "rpc::policy_table_interface_base" "mobile-policy-types") diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h index 2be8183bfa..7822cc26f6 100644 --- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h @@ -1266,6 +1266,11 @@ class PolicyManagerImpl : public PolicyManager { sync_primitives::Lock apps_registration_lock_; /** + * @brief lock guard for protecting policy table snapshot + */ + sync_primitives::Lock policy_table_lock_; + + /** * @brief lock guard for protecting application permissions access */ sync_primitives::Lock app_permissions_diff_lock_; diff --git a/src/components/policy/policy_external/include/policy/policy_table/types.h b/src/components/policy/policy_external/include/policy/policy_table/types.h index 25439f835b..98f86d6ea1 100644 --- a/src/components/policy/policy_external/include/policy/policy_table/types.h +++ b/src/components/policy/policy_external/include/policy/policy_table/types.h @@ -226,7 +226,6 @@ struct ApplicationParams : PolicyBase { Optional<AppHMITypes> AppHMIType; Optional<RequestTypes> RequestType; Optional<RequestSubTypes> RequestSubType; - Optional<Integer<uint16_t, 0, 65225> > memory_kb; Optional<Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms; mutable Optional<ModuleTypes> moduleType; Optional<String<0, 65535> > certificate; diff --git a/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml index a3b91abbc5..b8ea5cf22f 100644 --- a/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml +++ b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml @@ -101,7 +101,6 @@ <param name="default_hmi" type="HmiLevel" /> <param name="keep_context" type="Boolean" /> <param name="steal_focus" type="Boolean" /> - <param name="memory_kb" type="Integer" minvalue="1" maxvalue="65225" mandatory="false"/> <param name="watchdog_timer_ms" type="Integer" minvalue="1" maxvalue="65225" mandatory="false"/> <param name="certificate" type="String" minlength="0" maxlength="65535" @@ -164,7 +163,6 @@ maxsize="10" minvalue="1" maxvalue="1000" /> <struct name="ModuleConfig"> - <param name="device_certificates" type="String" minlength="1" maxlength="100" mandatory="false" map="true" minsize="1" maxsize="255" /> <param name="preloaded_pt" type="Boolean" mandatory="false" /> <param name="full_app_id_supported" type="Boolean" mandatory="false" /> <param name="exchange_after_x_ignition_cycles" type="Integer" diff --git a/src/components/policy/policy_external/include/policy/sql_pt_queries.h b/src/components/policy/policy_external/include/policy/sql_pt_queries.h index aba08dcca1..18c4468703 100644 --- a/src/components/policy/policy_external/include/policy/sql_pt_queries.h +++ b/src/components/policy/policy_external/include/policy/sql_pt_queries.h @@ -99,6 +99,7 @@ extern const std::string kInsertDeviceData; extern const std::string kInsertAppLevel; extern const std::string kDeleteSecondsBetweenRetries; extern const std::string kDeleteEndpoint; +extern const std::string kDeleteEndpointProperties; extern const std::string kDeleteAppLevel; extern const std::string kDeleteMessageString; extern const std::string kDeleteFunctionalGroup; diff --git a/src/components/policy/policy_external/src/access_remote_impl.cc b/src/components/policy/policy_external/src/access_remote_impl.cc index 037f4551f1..4effb991c8 100644 --- a/src/components/policy/policy_external/src/access_remote_impl.cc +++ b/src/components/policy/policy_external/src/access_remote_impl.cc @@ -98,6 +98,7 @@ bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, return false; } + sync_primitives::AutoLock auto_lock(cache_->cache_lock_); const policy_table::ApplicationParams& app = cache_->pt_->policy_table.app_policies_section.apps[app_id]; if (!app.moduleType.is_initialized()) { @@ -168,6 +169,7 @@ void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who, const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes( const ApplicationOnDevice& who) { SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_->cache_lock_); if (cache_->IsDefaultPolicy(who.app_id)) { return hmi_types_[who]; } else { @@ -240,6 +242,7 @@ void AccessRemoteImpl::GetGroupsIds(const std::string& device_id, bool AccessRemoteImpl::GetModuleTypes(const std::string& application_id, std::vector<std::string>* modules) { DCHECK(modules); + sync_primitives::AutoLock auto_lock(cache_->cache_lock_); policy_table::ApplicationPolicies& apps = cache_->pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::iterator i = apps.find(application_id); diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index 07f2df1991..b6ea6e6e79 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -685,6 +685,7 @@ void CacheManager::ProcessUpdate( const std::string& app_id = initial_policy_iter->first; bool update_request_types = true; + sync_primitives::AutoLock auto_lock(cache_lock_); ApplicationParams& params = pt_->policy_table.app_policies_section.apps[app_id]; if (kPreDataConsentId == app_id) { @@ -1454,15 +1455,19 @@ CacheManager::GetRemovedVehicleDataItems() const { } Json::Value CacheManager::GetPolicyTableData() const { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_lock_); return pt_->policy_table.ToJsonValue(); } void CacheManager::GetEnabledCloudApps( std::vector<std::string>& enabled_apps) const { + SDL_LOG_AUTO_TRACE(); #if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT) enabled_apps.clear(); return; #else + sync_primitives::AutoLock auto_lock(cache_lock_); const policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; for (policy_table::ApplicationPolicies::const_iterator it = policies.begin(); @@ -1478,6 +1483,8 @@ void CacheManager::GetEnabledCloudApps( bool CacheManager::GetAppProperties(const std::string& policy_app_id, AppProperties& out_app_properties) const { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_lock_); const policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -1509,10 +1516,12 @@ bool CacheManager::GetAppProperties(const std::string& policy_app_id, } std::vector<std::string> CacheManager::GetEnabledLocalApps() const { + SDL_LOG_AUTO_TRACE(); #if !defined(WEBSOCKET_SERVER_TRANSPORT_SUPPORT) return std::vector<std::string>(); #else std::vector<std::string> enabled_apps; + sync_primitives::AutoLock auto_lock(cache_lock_); const policy_table::ApplicationPolicies& app_policies = pt_->policy_table.app_policies_section.apps; for (const auto& app_policies_item : app_policies) { @@ -1551,6 +1560,8 @@ void CacheManager::InitCloudApp(const std::string& policy_app_id) { void CacheManager::SetCloudAppEnabled(const std::string& policy_app_id, const bool enabled) { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::iterator policy_iter = @@ -1562,6 +1573,8 @@ void CacheManager::SetCloudAppEnabled(const std::string& policy_app_id, void CacheManager::SetAppAuthToken(const std::string& policy_app_id, const std::string& auth_token) { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::iterator policy_iter = @@ -1573,6 +1586,8 @@ void CacheManager::SetAppAuthToken(const std::string& policy_app_id, void CacheManager::SetAppCloudTransportType( const std::string& policy_app_id, const std::string& cloud_transport_type) { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::iterator policy_iter = @@ -1584,6 +1599,8 @@ void CacheManager::SetAppCloudTransportType( void CacheManager::SetAppEndpoint(const std::string& policy_app_id, const std::string& endpoint) { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::iterator policy_iter = @@ -1595,6 +1612,8 @@ void CacheManager::SetAppEndpoint(const std::string& policy_app_id, void CacheManager::SetAppNicknames(const std::string& policy_app_id, const StringArray& nicknames) { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::iterator policy_iter = @@ -1607,6 +1626,8 @@ void CacheManager::SetAppNicknames(const std::string& policy_app_id, void CacheManager::SetHybridAppPreference( const std::string& policy_app_id, const std::string& hybrid_app_preference) { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::HybridAppPreference value; bool valid = EnumFromJsonString(hybrid_app_preference, &value); policy_table::ApplicationPolicies& policies = @@ -1622,6 +1643,7 @@ void CacheManager::GetAppServiceParameters( const std::string& policy_app_id, policy_table::AppServiceParameters* app_service_parameters) const { SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_lock_); const policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -1636,6 +1658,8 @@ void CacheManager::GetAppServiceParameters( bool CacheManager::UnknownRPCPassthroughAllowed( const std::string& policy_app_id) const { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_lock_); const policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -1695,8 +1719,13 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( std::vector<std::string>::const_iterator it_end = msg_codes.end(); sync_primitives::AutoLock auto_lock(cache_lock_); for (; it != it_end; ++it) { - policy_table::MessageLanguages msg_languages = - (*pt_->policy_table.consumer_friendly_messages->messages)[*it]; + auto messages = pt_->policy_table.consumer_friendly_messages->messages; + auto messages_it = messages->find(*it); + if (messages->end() == messages_it) { + SDL_LOG_ERROR("No entry found for message code: " << *it); + continue; + } + policy_table::MessageLanguages msg_languages = messages_it->second; // If message has no records with required language, fallback language // should be used instead. @@ -1742,6 +1771,7 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( void CacheManager::GetUpdateUrls(const uint32_t service_type, EndpointUrls& out_end_points) const { + SDL_LOG_AUTO_TRACE(); auto find_hexademical = [service_type](policy_table::ServiceEndpoints::value_type end_point) { uint32_t decimal; @@ -1749,6 +1779,7 @@ void CacheManager::GetUpdateUrls(const uint32_t service_type, return end_point.first.compare(0, 2, "0x") == 0 && decimal == service_type; }; + sync_primitives::AutoLock auto_lock(cache_lock_); auto& end_points = pt_->policy_table.module_config.endpoints; const auto end_point = std::find_if(end_points.begin(), end_points.end(), find_hexademical); @@ -1786,8 +1817,10 @@ void CacheManager::GetUpdateUrls(const std::string& service_type, } std::string CacheManager::GetIconUrl(const std::string& policy_app_id) const { + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(std::string()); std::string url; + sync_primitives::AutoLock auto_lock(cache_lock_); const policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -2125,7 +2158,6 @@ std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { snapshot_ = std::make_shared<policy_table::Table>(); sync_primitives::AutoLock auto_lock(cache_lock_); snapshot_->policy_table = pt_->policy_table; - if (pt_->policy_table.vehicle_data.is_initialized()) { snapshot_->policy_table.vehicle_data = rpc::Optional<policy_table::VehicleData>(); @@ -2133,7 +2165,6 @@ std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { snapshot_->policy_table.vehicle_data->schema_version = pt_->policy_table.vehicle_data->schema_version; } - snapshot_->SetPolicyTableType(policy_table::PT_SNAPSHOT); CheckSnapshotInitialization(); @@ -2279,6 +2310,7 @@ int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id, void CacheManager::SetPreloadedPtFlag(const bool is_preloaded) { SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock auto_lock(cache_lock_); *pt_->policy_table.module_config.preloaded_pt = is_preloaded; Backup(); } @@ -2675,7 +2707,7 @@ bool CacheManager::Init(const std::string& file_name, result &= snapshot->is_valid(); SDL_LOG_DEBUG("Check if snapshot valid: " << std::boolalpha << result); - + sync_primitives::AutoLock auto_lock(cache_lock_); if (!UnwrapAppPolicies(pt_->policy_table.app_policies_section.apps)) { SDL_LOG_ERROR("Cannot unwrap application policies"); } diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index 75920be58c..60ab5a389e 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -215,6 +215,8 @@ PolicyManagerImpl::PolicyManagerImpl() , applications_pending_ptu_count_(0) , ignition_check(true) , retry_sequence_url_(0, 0, "") + , send_on_update_sent_out_(false) + , trigger_ptu_(false) , ptu_requested_(false) , is_ptu_in_progress_(false) {} @@ -484,7 +486,9 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( } cache_->SaveUpdateRequired(false); + sync_primitives::AutoLock lock(apps_registration_lock_); + sync_primitives::AutoLock policy_lock(policy_table_lock_); // Get current DB data, since it could be updated during awaiting of PTU auto policy_table_snapshot = cache_->GenerateSnapshot(); @@ -702,6 +706,7 @@ void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type, void PolicyManagerImpl::RequestPTUpdate() { SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock policy_lock(policy_table_lock_); std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { @@ -1770,6 +1775,7 @@ void PolicyManagerImpl::SendPermissionsToApp( Permissions notification_data; // Need to get rid of this call + sync_primitives::AutoLock policy_lock(policy_table_lock_); std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc index 9e056752a8..c382016169 100644 --- a/src/components/policy/policy_external/src/policy_table/types.cc +++ b/src/components/policy/policy_external/src/policy_table/types.cc @@ -2,7 +2,6 @@ #include <algorithm> #include <regex> - #include "rpc_base/rpc_base_json_inl.h" namespace rpc { @@ -347,7 +346,6 @@ ApplicationParams::ApplicationParams(const Json::Value* value__) , AppHMIType(impl::ValueMember(value__, "AppHMIType")) , RequestType(impl::ValueMember(value__, "RequestType")) , RequestSubType(impl::ValueMember(value__, "RequestSubType")) - , memory_kb(impl::ValueMember(value__, "memory_kb"), 0) , heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms")) , moduleType(impl::ValueMember(value__, "moduleType")) , certificate(impl::ValueMember(value__, "certificate")) @@ -368,7 +366,6 @@ Json::Value ApplicationParams::ToJsonValue() const { impl::WriteJsonField("AppHMIType", AppHMIType, &result__); impl::WriteJsonField("RequestType", RequestType, &result__); impl::WriteJsonField("RequestSubType", RequestSubType, &result__); - impl::WriteJsonField("memory_kb", memory_kb, &result__); impl::WriteJsonField( "heart_beat_timeout_ms", heart_beat_timeout_ms, &result__); impl::WriteJsonField("moduleType", moduleType, &result__); @@ -400,9 +397,6 @@ bool ApplicationParams::is_valid() const { if (!AppHMIType.is_valid()) { return false; } - if (!memory_kb.is_valid()) { - return false; - } if (!heart_beat_timeout_ms.is_valid()) { return false; } @@ -462,9 +456,6 @@ bool ApplicationParams::struct_empty() const { if (RequestSubType.is_initialized()) { return false; } - if (memory_kb.is_initialized()) { - return false; - } if (heart_beat_timeout_ms.is_initialized()) { return false; } @@ -539,9 +530,6 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const { if (!steal_focus.is_valid()) { steal_focus.ReportErrors(&report__->ReportSubobject("steal_focus")); } - if (!memory_kb.is_valid()) { - memory_kb.ReportErrors(&report__->ReportSubobject("memory_kb")); - } if (!heart_beat_timeout_ms.is_valid()) { heart_beat_timeout_ms.ReportErrors( &report__->ReportSubobject("heart_beat_timeout_ms")); @@ -590,7 +578,6 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) { AppHMIType.SetPolicyTableType(pt_type); RequestType.SetPolicyTableType(pt_type); RequestSubType.SetPolicyTableType(pt_type); - memory_kb.SetPolicyTableType(pt_type); heart_beat_timeout_ms.SetPolicyTableType(pt_type); moduleType.SetPolicyTableType(pt_type); certificate.SetPolicyTableType(pt_type); diff --git a/src/components/policy/policy_external/src/sql_pt_ext_queries.cc b/src/components/policy/policy_external/src/sql_pt_ext_queries.cc index 26d2124d07..1e7e169fe7 100644 --- a/src/components/policy/policy_external/src/sql_pt_ext_queries.cc +++ b/src/components/policy/policy_external/src/sql_pt_ext_queries.cc @@ -213,13 +213,13 @@ const std::string kUpdateGroupPermissions = const std::string kInsertApplication = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, `steal_focus`, " - " `default_hmi`, `priority_value`, `is_revoked`, `memory_kb`, " + " `default_hmi`, `priority_value`, `is_revoked`, " " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, " " `endpoint`, `enabled`, `auth_token`, " " `cloud_transport_type`, `icon_url`, `allow_unknown_rpc_passthrough`, " "`encryption_required`) " "VALUES " - "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; const std::string kCollectFriendlyMsg = "SELECT * FROM `message`"; @@ -246,7 +246,7 @@ const std::string kSelectPreconsentedGroupsId = const std::string kSelectAppPolicies = "SELECT `id`, `priority_value`, `default_hmi`, `keep_context`, " - " `steal_focus`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, " + " `steal_focus`, `heart_beat_timeout_ms`, `certificate`, " " `hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token`, " " `cloud_transport_type`, `icon_url`, `allow_unknown_rpc_passthrough`, " "`encryption_required`" diff --git a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc index fc35551808..b98f14f1c8 100644 --- a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc @@ -774,36 +774,34 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy( app_query.Bind( 4, std::string(policy_table::EnumToJsonString(app.second.priority))); app_query.Bind(5, app.second.is_null()); - app_query.Bind(6, *app.second.memory_kb); - app_query.Bind(7, static_cast<int64_t>(*app.second.heart_beat_timeout_ms)); + app_query.Bind(6, static_cast<int64_t>(*app.second.heart_beat_timeout_ms)); app.second.certificate.is_initialized() - ? app_query.Bind(8, *app.second.certificate) - : app_query.Bind(8); + ? app_query.Bind(7, *app.second.certificate) + : app_query.Bind(7); app.second.hybrid_app_preference.is_initialized() - ? app_query.Bind(9, + ? app_query.Bind(8, std::string(policy_table::EnumToJsonString( *app.second.hybrid_app_preference))) - : app_query.Bind(9); - app.second.endpoint.is_initialized() - ? app_query.Bind(10, *app.second.endpoint) - : app_query.Bind(10); - app.second.enabled.is_initialized() ? app_query.Bind(11, *app.second.enabled) - : app_query.Bind(11); + : app_query.Bind(8); + app.second.endpoint.is_initialized() ? app_query.Bind(9, *app.second.endpoint) + : app_query.Bind(9); + app.second.enabled.is_initialized() ? app_query.Bind(10, *app.second.enabled) + : app_query.Bind(10); app.second.auth_token.is_initialized() - ? app_query.Bind(12, *app.second.auth_token) - : app_query.Bind(12); + ? app_query.Bind(11, *app.second.auth_token) + : app_query.Bind(11); app.second.cloud_transport_type.is_initialized() - ? app_query.Bind(13, *app.second.cloud_transport_type) - : app_query.Bind(13); + ? app_query.Bind(12, *app.second.cloud_transport_type) + : app_query.Bind(12); app.second.icon_url.is_initialized() - ? app_query.Bind(14, *app.second.icon_url) - : app_query.Bind(14); + ? app_query.Bind(13, *app.second.icon_url) + : app_query.Bind(13); app.second.allow_unknown_rpc_passthrough.is_initialized() - ? app_query.Bind(15, *app.second.allow_unknown_rpc_passthrough) - : app_query.Bind(15); + ? app_query.Bind(14, *app.second.allow_unknown_rpc_passthrough) + : app_query.Bind(14); app.second.encryption_required.is_initialized() - ? app_query.Bind(16, *app.second.encryption_required) - : app_query.Bind(16); + ? app_query.Bind(15, *app.second.encryption_required) + : app_query.Bind(15); if (!app_query.Exec() || !app_query.Reset()) { SDL_LOG_WARN("Incorrect insert into application."); @@ -927,28 +925,27 @@ bool SQLPTExtRepresentation::GatherApplicationPoliciesSection( params.default_hmi = hmi; params.keep_context = query.GetBoolean(3); params.steal_focus = query.GetBoolean(4); - *params.memory_kb = query.GetInteger(5); - *params.heart_beat_timeout_ms = query.GetUInteger(6); - if (!query.IsNull(7)) { - *params.certificate = query.GetString(7); + *params.heart_beat_timeout_ms = query.GetUInteger(5); + if (!query.IsNull(6)) { + *params.certificate = query.GetString(6); } // Read cloud app properties policy_table::HybridAppPreference hap; - bool valid = policy_table::EnumFromJsonString(query.GetString(8), &hap); + bool valid = policy_table::EnumFromJsonString(query.GetString(7), &hap); if (valid) { *params.hybrid_app_preference = hap; } - *params.endpoint = query.GetString(9); - if (!query.IsNull(10)) { - *params.enabled = query.GetBoolean(10); + *params.endpoint = query.GetString(8); + if (!query.IsNull(9)) { + *params.enabled = query.GetBoolean(9); } - *params.auth_token = query.GetString(11); - *params.cloud_transport_type = query.GetString(12); - *params.icon_url = query.GetString(13); - *params.allow_unknown_rpc_passthrough = query.GetBoolean(14); - if (!query.IsNull(15)) { - *params.encryption_required = query.GetBoolean(15); + *params.auth_token = query.GetString(10); + *params.cloud_transport_type = query.GetString(11); + *params.icon_url = query.GetString(12); + *params.allow_unknown_rpc_passthrough = query.GetBoolean(13); + if (!query.IsNull(14)) { + *params.encryption_required = query.GetBoolean(14); } const auto& gather_app_id = ((*policies).apps[app_id].is_string()) ? (*policies).apps[app_id].get_string() diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc index c5fc3a9e92..8414c2feda 100644 --- a/src/components/policy/policy_external/src/sql_pt_queries.cc +++ b/src/components/policy/policy_external/src/sql_pt_queries.cc @@ -162,7 +162,6 @@ const std::string kCreateSchema = " `is_revoked` BOOLEAN, " " `is_default` BOOLEAN, " " `is_predata` BOOLEAN, " - " `memory_kb` INTEGER NOT NULL, " " `heart_beat_timeout_ms` INTEGER NOT NULL, " " `certificate` VARCHAR(65535), " " `hybrid_app_preference_value` VARCHAR(255), " @@ -821,12 +820,12 @@ const std::string kInsertRpcWithParameter = const std::string kInsertApplication = "INSERT OR IGNORE INTO `application` (`id`, `priority_value`, " - "`is_revoked`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, " + "`is_revoked`, `heart_beat_timeout_ms`, `certificate`, " "`hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token`, " "`cloud_transport_type`, `icon_url`, `allow_unknown_rpc_passthrough`, " "`encryption_required`) " "VALUES " - "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + "(?,?,?,?,?,?,?,?,?,?,?,?,?)"; const std::string kInsertAppGroup = "INSERT INTO `app_group` (`application_id`, `functional_group_id`)" @@ -919,6 +918,9 @@ const std::string kDeleteSecondsBetweenRetries = const std::string kDeleteEndpoint = "DELETE FROM `endpoint`"; +const std::string kDeleteEndpointProperties = + "DELETE FROM `endpoint_properties`"; + const std::string kDeleteAppLevel = "DELETE FROM `app_level`"; const std::string kDeleteMessageString = "DELETE FROM `message`"; @@ -972,7 +974,7 @@ const std::string kSelectUserMsgsVersion = "SELECT DISTINCT `number` FROM `version`"; const std::string kSelectAppPolicies = - "SELECT `id`, `priority_value`, `memory_kb`, " + "SELECT `id`, `priority_value`, " " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, " " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, `icon_url`, " " `allow_unknown_rpc_passthrough`, `encryption_required` " @@ -1103,15 +1105,15 @@ const std::string kDeleteAppGroupByApplicationId = const std::string kInsertApplicationFull = "INSERT OR IGNORE INTO `application` (`id`, `keep_context`, `steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - " `is_predata`, `memory_kb`, `heart_beat_timeout_ms`, " + " `is_predata`, `heart_beat_timeout_ms`, " " `certificate`, `hybrid_app_preference_value`, `endpoint`, `enabled`, " " `auth_token`, `cloud_transport_type`, `icon_url`, " "`allow_unknown_rpc_passthrough`, `encryption_required`) " - " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; const std::string kSelectApplicationFull = "SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, " - " `is_revoked`, `is_default`, `is_predata`, `memory_kb`," + " `is_revoked`, `is_default`, `is_predata`, " " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, " " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, " "`icon_url`, " diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index 3309893db0..0436e82bbb 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -766,33 +766,32 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection( policy_table::EnumFromJsonString(query.GetString(1), &priority); params.priority = priority; - *params.memory_kb = query.GetInteger(2); - *params.heart_beat_timeout_ms = query.GetUInteger(3); + *params.heart_beat_timeout_ms = query.GetUInteger(2); - if (!query.IsNull(4)) { - *params.certificate = query.GetString(4); + if (!query.IsNull(3)) { + *params.certificate = query.GetString(3); } // Read cloud app properties policy_table::HybridAppPreference hap; - bool valid = policy_table::EnumFromJsonString(query.GetString(5), &hap); + bool valid = policy_table::EnumFromJsonString(query.GetString(4), &hap); if (valid) { *params.hybrid_app_preference = hap; } - *params.endpoint = query.GetString(6); - if (!query.IsNull(7)) { - *params.enabled = query.GetBoolean(7); + *params.endpoint = query.GetString(5); + if (!query.IsNull(6)) { + *params.enabled = query.GetBoolean(6); } - *params.auth_token = query.GetString(8); - *params.cloud_transport_type = query.GetString(9); - *params.icon_url = query.GetString(10); - *params.allow_unknown_rpc_passthrough = query.GetBoolean(11); + *params.auth_token = query.GetString(7); + *params.cloud_transport_type = query.GetString(8); + *params.icon_url = query.GetString(9); + *params.allow_unknown_rpc_passthrough = query.GetBoolean(10); const auto& gather_app_id = ((*policies).apps[app_id].is_string()) ? (*policies).apps[app_id].get_string() : app_id; - if (!query.IsNull(12)) { - *params.encryption_required = query.GetBoolean(12); + if (!query.IsNull(11)) { + *params.encryption_required = query.GetBoolean(11); } // Data should be gathered from db by "default" key if application has // default policies @@ -1122,36 +1121,35 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( app_query.Bind( 1, std::string(policy_table::EnumToJsonString(app.second.priority))); app_query.Bind(2, app.second.is_null()); - app_query.Bind(3, *app.second.memory_kb); - app_query.Bind(4, static_cast<int64_t>(*app.second.heart_beat_timeout_ms)); + app_query.Bind(3, static_cast<int64_t>(*app.second.heart_beat_timeout_ms)); app.second.certificate.is_initialized() - ? app_query.Bind(5, *app.second.certificate) - : app_query.Bind(5); + ? app_query.Bind(4, *app.second.certificate) + : app_query.Bind(4); app.second.hybrid_app_preference.is_initialized() - ? app_query.Bind(6, + ? app_query.Bind(5, std::string(policy_table::EnumToJsonString( *app.second.hybrid_app_preference))) - : app_query.Bind(6); - app.second.endpoint.is_initialized() ? app_query.Bind(7, *app.second.endpoint) - : app_query.Bind(7); - app.second.enabled.is_initialized() ? app_query.Bind(8, *app.second.enabled) - : app_query.Bind(8); + : app_query.Bind(5); + app.second.endpoint.is_initialized() ? app_query.Bind(6, *app.second.endpoint) + : app_query.Bind(6); + app.second.enabled.is_initialized() ? app_query.Bind(7, *app.second.enabled) + : app_query.Bind(7); app.second.auth_token.is_initialized() - ? app_query.Bind(9, *app.second.auth_token) - : app_query.Bind(9); + ? app_query.Bind(8, *app.second.auth_token) + : app_query.Bind(8); app.second.cloud_transport_type.is_initialized() - ? app_query.Bind(10, *app.second.cloud_transport_type) - : app_query.Bind(10); + ? app_query.Bind(9, *app.second.cloud_transport_type) + : app_query.Bind(9); app.second.icon_url.is_initialized() - ? app_query.Bind(11, *app.second.icon_url) - : app_query.Bind(11); + ? app_query.Bind(10, *app.second.icon_url) + : app_query.Bind(10); app.second.allow_unknown_rpc_passthrough.is_initialized() - ? app_query.Bind(12, *app.second.allow_unknown_rpc_passthrough) - : app_query.Bind(12); + ? app_query.Bind(11, *app.second.allow_unknown_rpc_passthrough) + : app_query.Bind(11); app.second.encryption_required.is_initialized() - ? app_query.Bind(13, *app.second.encryption_required) - : app_query.Bind(13); + ? app_query.Bind(12, *app.second.encryption_required) + : app_query.Bind(12); if (!app_query.Exec() || !app_query.Reset()) { SDL_LOG_WARN("Incorrect insert into application."); @@ -1577,6 +1575,18 @@ bool SQLPTRepresentation::SaveServiceEndpoints( bool SQLPTRepresentation::SaveServiceEndpointProperties( const policy_table::ServiceEndpointProperties& endpoint_properties) { utils::dbms::SQLQuery query(db()); + + if (endpoint_properties.is_initialized() && endpoint_properties.empty()) { + bool delete_query_exec_result = + query.Exec(sql_pt::kDeleteEndpointProperties); + + if (!delete_query_exec_result) { + SDL_LOG_WARN("Failed to delete endpoint properties from DB."); + return false; + } + return true; + } + if (!query.Prepare(sql_pt::kInsertEndpointVersion)) { SDL_LOG_WARN( "Incorrect insert of endpoint property to endpoint_properties."); @@ -1613,9 +1623,7 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( utils::dbms::SQLQuery query(db()); bool delete_query_exec_result = true; - if (!messages.messages->empty()) { - delete_query_exec_result = query.Exec(sql_pt::kDeleteMessageString); - } + delete_query_exec_result = query.Exec(sql_pt::kDeleteMessageString); if (!delete_query_exec_result) { SDL_LOG_WARN("Failed to delete messages from DB."); diff --git a/src/components/policy/policy_external/test/sql_pt_ext_representation_storage_test.cc b/src/components/policy/policy_external/test/sql_pt_ext_representation_storage_test.cc index 09df17beb2..3bbdc05378 100644 --- a/src/components/policy/policy_external/test/sql_pt_ext_representation_storage_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_ext_representation_storage_test.cc @@ -98,9 +98,9 @@ TEST_F( // Act const std::string value_12345 = "12345"; const std::string query_insert_12345 = - "INSERT INTO `application` (`id`, `memory_kb`," + "INSERT INTO `application` (`id`, " " `heart_beat_timeout_ms`, `keep_context`) VALUES ('" + - value_12345 + "', 5, 10, 1)"; + value_12345 + "', 10, 1)"; // Assert ASSERT_TRUE(query_wrapper_->Exec(query_insert_12345)); @@ -110,9 +110,9 @@ TEST_F( // Act const std::string value_123 = "123"; const std::string query_insert_123 = - "INSERT INTO `application` (`id`, `memory_kb`," + "INSERT INTO `application` (`id`, " " `heart_beat_timeout_ms`, `keep_context`) VALUES ('" + - value_123 + "', 10, 7, 0)"; + value_123 + "', 7, 0)"; // Assert ASSERT_TRUE(query_wrapper_->Exec(query_insert_123)); diff --git a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc index 58f526d7d3..c677392ef9 100644 --- a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc @@ -456,8 +456,8 @@ TEST_F( ASSERT_TRUE(query_wrapper_->Exec(query_delete)); // Act const std::string query_insert_12345 = - "INSERT INTO `application` (`id`, `memory_kb`," - " `heart_beat_timeout_ms`, `keep_context`) VALUES ('12345', 5, 10, 1)"; + "INSERT INTO `application` (`id`, " + " `heart_beat_timeout_ms`, `keep_context`) VALUES ('12345', 10, 1)"; // Assert ASSERT_TRUE(query_wrapper_->Exec(query_insert_12345)); @@ -465,8 +465,8 @@ TEST_F( EXPECT_TRUE(reps_->CanAppKeepContext("12345")); // Act const std::string query_insert_123 = - "INSERT INTO `application` (`id`, `memory_kb`," - " `heart_beat_timeout_ms`, `keep_context`) VALUES ('123', 10, 7, 0)"; + "INSERT INTO `application` (`id`, " + " `heart_beat_timeout_ms`, `keep_context`) VALUES ('123', 7, 0)"; // Assert ASSERT_TRUE(query_wrapper_->Exec(query_insert_123)); @@ -481,8 +481,8 @@ TEST_F(SQLPTExtRepresentationTest, ASSERT_TRUE(query_wrapper_->Exec(query_delete)); // Act const std::string query_insert_12345 = - "INSERT INTO `application` (`id`, `memory_kb`," - " `heart_beat_timeout_ms`, `steal_focus`) VALUES ('12345', 5, 10, 1)"; + "INSERT INTO `application` (`id`, " + " `heart_beat_timeout_ms`, `steal_focus`) VALUES ('12345', 10, 1)"; // Assert ASSERT_TRUE(query_wrapper_->Exec(query_insert_12345)); @@ -490,8 +490,8 @@ TEST_F(SQLPTExtRepresentationTest, EXPECT_FALSE(reps_->CanAppStealFocus("0")); // Act const std::string query_insert_123 = - "INSERT INTO `application` (`id`, `memory_kb`," - " `heart_beat_timeout_ms`, `steal_focus`) VALUES ('123', 10, 7, 0)"; + "INSERT INTO `application` (`id`, " + " `heart_beat_timeout_ms`, `steal_focus`) VALUES ('123', 7, 0)"; // Assert ASSERT_TRUE(query_wrapper_->Exec(query_insert_123)); @@ -506,8 +506,8 @@ TEST_F(SQLPTExtRepresentationTest, ASSERT_TRUE(query_wrapper_->Exec(query_delete)); // Act const std::string query_insert_12345 = - "INSERT INTO `application` (`id`, `memory_kb`," - " `heart_beat_timeout_ms`, `default_hmi`) VALUES ('12345', 5, 10, " + "INSERT INTO `application` (`id`, " + " `heart_beat_timeout_ms`, `default_hmi`) VALUES ('12345', 10, " "'NONE')"; std::string result; // Assert @@ -515,8 +515,8 @@ TEST_F(SQLPTExtRepresentationTest, EXPECT_TRUE(reps_->GetDefaultHMI("12345", &result)); EXPECT_EQ("NONE", result); const std::string query_insert_123 = - "INSERT INTO `application` (`id`, `memory_kb`," - " `heart_beat_timeout_ms`, `default_hmi`) VALUES ('123', 5, 10, " + "INSERT INTO `application` (`id`, " + " `heart_beat_timeout_ms`, `default_hmi`) VALUES ('123', 10, " "'LIMITED')"; // Assert @@ -898,9 +898,9 @@ TEST_F( ASSERT_TRUE(query_wrapper_->Exec(query_insert_functional_group)); const std::string query_insert_application = - "INSERT INTO `application` (`id`, `memory_kb`," + "INSERT INTO `application` (`id`, " " `heart_beat_timeout_ms`, `is_predata`, `keep_context`) VALUES ('1234', " - "5, 10, 1, 0)"; + "10, 1, 0)"; // Assert ASSERT_TRUE(query_wrapper_->Exec(query_insert_application)); @@ -967,9 +967,9 @@ TEST_F( ASSERT_TRUE(query_wrapper_->Exec(query_insert_preconsented_group)); const std::string query_insert_application = - "INSERT INTO `application` (`id`, `memory_kb`," + "INSERT INTO `application` (`id`, " " `heart_beat_timeout_ms`, `is_predata`, `keep_context`) VALUES ('1234', " - "5, 10, 0, 0)"; + "10, 0, 0)"; // Assert ASSERT_TRUE(query_wrapper_->Exec(query_insert_application)); FunctionalIdType group_types; @@ -1417,9 +1417,9 @@ TEST_F( "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'NONE', 0, 0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app)); GroupsAliasNameCollection allowed_groups; @@ -1447,9 +1447,9 @@ TEST_F(SQLPTExtRepresentationTest, "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'NONE', 0, 0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app)); GroupsAliasNameCollection allowed_groups; @@ -1479,9 +1479,9 @@ TEST_F( "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'NONE', 0, 0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app)); GroupsAliasNameCollection allowed_groups; @@ -1506,9 +1506,9 @@ TEST_F(SQLPTExtRepresentationTest, "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'NONE', 0, 0, " - "1, 64, 10) "; + "1, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app)); // Check EXPECT_TRUE(reps_->IsPredataPolicy("12345")); diff --git a/src/components/policy/policy_external/test/sql_pt_representation_storage_test.cc b/src/components/policy/policy_external/test/sql_pt_representation_storage_test.cc index 7214ecba81..f9d36eb013 100644 --- a/src/components/policy/policy_external/test/sql_pt_representation_storage_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_representation_storage_test.cc @@ -90,10 +90,10 @@ TEST_F( const std::string gps = "gps"; const std::string speed = "speed"; const std::string query = - "INSERT OR REPLACE INTO `application` (`id`, `memory_kb`," + "INSERT OR REPLACE INTO `application` (`id`," " `heart_beat_timeout_ms`) VALUES ('" + value_12345 + - "', 5, 10); " + "', 10); " "INSERT OR REPLACE INTO functional_group (`id`, `name`)" " VALUES (1, 'Base-4'); " "INSERT OR REPLACE INTO `app_group` (`application_id`," diff --git a/src/components/policy/policy_external/test/sql_pt_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_representation_test.cc index 548b6f3666..9047949860 100644 --- a/src/components/policy/policy_external/test/sql_pt_representation_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_representation_test.cc @@ -149,7 +149,6 @@ class SQLPTRepresentationTest : public SQLPTRepresentation, uint16_t apps_size, policy_table::Priority prio, const std::string& section, - uint16_t memory_kb, uint32_t heart_beat_timeout_ms, policy_table::Strings& groups) const { if (section != "device") { @@ -163,7 +162,6 @@ class SQLPTRepresentationTest : public SQLPTRepresentation, EXPECT_EQ(0u, (*(apps_iter->second.nicknames)).size()); EXPECT_EQ(prio, (apps_iter->second).priority); EXPECT_EQ(0u, (*(apps_iter->second.AppHMIType)).size()); - EXPECT_EQ(memory_kb, (*(apps_iter->second.memory_kb))); EXPECT_EQ(heart_beat_timeout_ms, (*(apps_iter->second.heart_beat_timeout_ms))); } else { @@ -461,8 +459,8 @@ TEST_F( CheckPermissionsAllowed_SetValuesInAppGroupRpcFunctionalGroup_GetEqualParamsInCheckPermissionResult) { // Arrange const std::string query = - "INSERT OR REPLACE INTO `application` (`id`, `memory_kb`," - " `heart_beat_timeout_ms`) VALUES ('12345', 5, 10); " + "INSERT OR REPLACE INTO `application` (`id`, " + " `heart_beat_timeout_ms`) VALUES ('12345', 10); " "INSERT OR REPLACE INTO functional_group (`id`, `name`)" " VALUES (1, 'Base-4'); " "INSERT OR REPLACE INTO `app_group` (`application_id`," @@ -493,8 +491,8 @@ TEST_F( CheckPermissionsAllowedWithoutParameters_SetLimitedPermissions_ExpectEmptyListOfAllowedParams) { // Arrange const std::string query = - "INSERT OR REPLACE INTO `application` (`id`, `memory_kb`," - " `heart_beat_timeout_ms`) VALUES ('12345', 5, 10); " + "INSERT OR REPLACE INTO `application` (`id`, " + " `heart_beat_timeout_ms`) VALUES ('12345', 10); " "INSERT OR REPLACE INTO functional_group (`id`, `name`)" " VALUES (1, 'Base-4'); " "INSERT OR REPLACE INTO `app_group` (`application_id`," @@ -961,40 +959,40 @@ TEST_F(SQLPTRepresentationTest, "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( 'default', 0, 0, 'NONE', 'NONE', 0, " "0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_default)); const std::string query_insert_app_pre_DataConsent = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( 'pre_DataConsent', 0, 0, 'NONE', " "'NONE', 0, 0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_pre_DataConsent)); const std::string query_insert_app_device = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( 'device', 0, 0, 'NONE', " "'COMMUNICATION', 0, 0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_device)); const std::string query_insert_app_12345 = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'EMERGENCY', " "0, 0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_12345)); std::string priority; @@ -1051,40 +1049,40 @@ TEST_F(SQLPTRepresentationTest, "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( 'default', 0, 0, 'NONE', 'NONE', 0, " "0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_default)); const std::string query_insert_app_pre_DataConsent = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( 'pre_DataConsent', 0, 0, 'NONE', " "'NONE', 0, 0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_pre_DataConsent)); const std::string query_insert_app_device = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( 'device', 0, 0, 'NONE', " "'COMMUNICATION', 0, 0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_device)); const std::string query_insert_app_12345 = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'EMERGENCY', " "0, 0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_12345)); const std::string query_insert = @@ -1241,29 +1239,29 @@ TEST_F(SQLPTRepresentationTest, "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( 'default', 0, 0, 'NONE', 'NONE', 0, " "0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_default)); const std::string query_insert_app_device = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( 'device', 0, 0, 'NONE', " - "'COMMUNICATION', 0, 0, 0, 64, 10) "; + "'COMMUNICATION', 0, 0, 0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_device)); const std::string query_insert_app_12345 = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'EMERGENCY', " "0, 0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_12345)); // Checks EXPECT_TRUE(reps->IsApplicationRepresented("default")); @@ -1279,20 +1277,20 @@ TEST_F(SQLPTRepresentationTest, "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( '7777', 0, 0, 'NONE', 'NONE', 1, " "0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_7777)); const std::string query_insert_app_12345 = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'EMERGENCY', " "0, 0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_12345)); // Checks EXPECT_TRUE(reps->IsApplicationRevoked("7777")); @@ -1306,19 +1304,19 @@ TEST_F(SQLPTRepresentationTest, "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( 'default', 0, 0, 'NONE', 'NONE', 0, " "1, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_default)); const std::string query_insert_app_123 = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( '123', 1, 0, 'FULL', " - "'COMMUNICATION', 1, 1, 0, 64, 10) "; + "'COMMUNICATION', 1, 1, 0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_123)); EXPECT_FALSE(reps->IsApplicationRepresented("7777")); EXPECT_FALSE(reps->IsApplicationRepresented("9999")); @@ -1348,10 +1346,10 @@ TEST_F(SQLPTRepresentationTest, "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'NONE', 0, " "0, " - "1, 64, 10) "; + "1, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app)); // Check EXPECT_FALSE(reps->IsDefaultPolicy("12345")); @@ -1363,8 +1361,8 @@ TEST_F(SQLPTRepresentationTest, const std::string query_insert_app = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, `default_hmi`, `priority_value`, `is_revoked`, " - "`is_default`, `is_predata`, `memory_kb`, `heart_beat_timeout_ms`) " - "VALUES( '1234567', 0, 0, 'NONE', 'NONE', 0, 1, 0, 64, 10) "; + "`is_default`, `is_predata`, `heart_beat_timeout_ms`) " + "VALUES( '1234567', 0, 0, 'NONE', 'NONE', 0, 1, 0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app)); // Check @@ -1404,17 +1402,17 @@ TEST_F(SQLPTRepresentationTest, "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, " " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, `memory_kb`, " + "`is_predata`, " " `heart_beat_timeout_ms`) VALUES( 'default', 0, 0, 'NONE', 'NONE', 0, " "0, " - "0, 64, 10) "; + "0, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_default)); const std::string query_insert_app_1234567 = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, `default_hmi`, `priority_value`, `is_revoked`, " - "`is_default`, `is_predata`, `memory_kb`, `heart_beat_timeout_ms`) " - "VALUES( '1234567', 0, 0, 'NONE', 'NONE', 0, 0, 1, 64, 10) "; + "`is_default`, `is_predata`, `heart_beat_timeout_ms`) " + "VALUES( '1234567', 0, 0, 'NONE', 'NONE', 0, 0, 1, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app_1234567)); EXPECT_FALSE(reps->IsDefaultPolicy("1234567")); // Act @@ -1448,8 +1446,8 @@ TEST_F(SQLPTRepresentationTest, const std::string query_insert_app = "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, " "`steal_focus`, `default_hmi`, `priority_value`, `is_revoked`, " - "`is_default`, `is_predata`, `memory_kb`, `heart_beat_timeout_ms`) " - "VALUES( '1234567', 0, 0, 'NONE', 'NONE', 0, 0, 1, 64, 10) "; + "`is_default`, `is_predata`, `heart_beat_timeout_ms`) " + "VALUES( '1234567', 0, 0, 'NONE', 'NONE', 0, 0, 1, 10) "; ASSERT_TRUE(query_wrapper_->Exec(query_insert_app)); const std::string query_select = "SELECT `is_default` FROM `application`WHERE`id`= '1234567' "; |