summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2018-11-01 16:08:28 -0400
committerjacobkeeler <jacob.keeler@livioradio.com>2018-11-09 09:22:26 -0500
commit0ffb1871b58c730429e25728cd91cd0196d84ee3 (patch)
tree0a3b90d6e13ce65313f12e8f8bb9c43bf1dbe93f
parentcc47e493293baa7df9a7b79a2d3cc9ba3158250e (diff)
downloadsdl_core-0ffb1871b58c730429e25728cd91cd0196d84ee3.tar.gz
Add cloud app parameters to regular policies
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h23
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h4
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc63
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc4
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h39
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h51
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h10
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h17
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h17
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h51
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h51
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h52
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/enums.h6
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/types.h6
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc75
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc32
-rw-r--r--src/components/policy/policy_regular/src/policy_table/enums.cc35
-rw-r--r--src/components/policy/policy_regular/src/policy_table/types.cc65
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_queries.cc43
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc43
-rw-r--r--src/components/policy/policy_regular/test/sql_pt_representation_test.cc4
21 files changed, 675 insertions, 16 deletions
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h
index c8f3bcf888..3af03bf28b 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h
@@ -398,6 +398,29 @@ class PolicyHandler : public PolicyHandlerInterface,
custom_str::CustomString GetAppName(
const std::string& policy_app_id) OVERRIDE;
+ /**
+ * @brief Checks if a given application is an enabled cloud application
+ * @param policy_app_id Unique application id
+ * @return true, if the application is an enabled cloud application,
+ * otherwise - false
+ */
+ const bool CheckCloudAppEnabled(
+ const std::string& policy_app_id) const OVERRIDE;
+
+ /**plzfix
+ * @brief Checks if certain request type is allowed for application
+ * @param policy_app_id Unique application id
+ * @return true, if allowed, otherwise - false
+ */
+ const bool GetCloudAppParameters(const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const OVERRIDE;
+
+ void OnSetCloudAppProperties(
+ const smart_objects::SmartObject& message) OVERRIDE;
+
virtual void OnUpdateHMIAppType(
std::map<std::string, StringArray> app_hmi_types) OVERRIDE;
diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h
index 9b5f63809a..62192da391 100644
--- a/src/components/application_manager/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/include/application_manager/smart_object_keys.h
@@ -188,6 +188,10 @@ extern const char* green;
extern const char* blue;
extern const char* display_layout;
extern const char* icon_resumed;
+extern const char* enabled;
+extern const char* cloud_app_auth_token;
+extern const char* cloud_transport_type;
+extern const char* hybrid_app_preference;
// PutFile
extern const char* sync_file_name;
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 1b64c5d7b4..c73e35768e 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1845,6 +1845,69 @@ bool PolicyHandler::CheckSystemAction(
return false;
}
+const bool PolicyHandler::GetCloudAppParameters(
+ const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const {
+ POLICY_LIB_CHECK(false);
+ return policy_manager_->GetCloudAppParameters(policy_app_id,
+ endpoint,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
+}
+
+const bool PolicyHandler::CheckCloudAppEnabled(const std::string& policy_app_id) const {
+ POLICY_LIB_CHECK(false);
+ std::string endpoint;
+ std::string auth_token;
+ std::string cloud_transport_type;
+ std::string hybrid_app_preference;
+ return policy_manager_->GetCloudAppParameters(policy_app_id,
+ endpoint,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
+}
+
+void PolicyHandler::OnSetCloudAppProperties(
+ const smart_objects::SmartObject& message) {
+ POLICY_LIB_CHECK_VOID();
+ if (!message.keyExists(strings::msg_params)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Message does not contain mandatory section " << strings::msg_params);
+ return;
+ }
+ const smart_objects::SmartObject& msg_params = message[strings::msg_params];
+ if (!msg_params.keyExists(strings::app_id)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Message does not contain mandatory parameter " << strings::app_id);
+ return;
+ }
+ std::string policy_app_id(msg_params[strings::app_id].asString());
+ if (msg_params.keyExists(strings::enabled)) {
+ policy_manager_->SetCloudAppEnabled(policy_app_id,
+ msg_params[strings::enabled].asBool());
+ }
+ if (msg_params.keyExists(strings::cloud_app_auth_token)) {
+ policy_manager_->SetAppAuthToken(policy_app_id,
+ msg_params[strings::cloud_app_auth_token].asString());
+ }
+ if (msg_params.keyExists(strings::cloud_transport_type)) {
+ policy_manager_->SetAppCloudTransportType(
+ policy_app_id, msg_params[strings::cloud_transport_type].asString());
+ }
+ if (msg_params.keyExists(strings::hybrid_app_preference)) {
+ //const std::string hybrid_app_preference = EnumConversionHelper<HybridAppPreference>::EnumToString(msg_params[strings::hybrid_app_preference]);
+ //policy_manager_->SetHybridAppPreference(
+ // policy_app_id, hybrid_app_preference);
+ }
+}
+
uint32_t PolicyHandler::HeartBeatTimeout(const std::string& app_id) const {
POLICY_LIB_CHECK(0);
return policy_manager_->HeartBeatTimeout(app_id);
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index e006b893f6..3e2951c553 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -155,6 +155,10 @@ const char* green = "green";
const char* blue = "blue";
const char* display_layout = "displayLayout";
const char* icon_resumed = "iconResumed";
+const char* enabled = "enabled";
+const char* cloud_app_auth_token = "cloudAppAuthToken";
+const char* cloud_transport_type = "cloudTransportType";
+const char* hybrid_app_preference = "hybridAppPreference";
// PutFile
const char* sync_file_name = "syncFileName";
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index ee9274ead7..69433e6118 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -437,6 +437,45 @@ class PolicyHandlerInterface {
* @return Structure with vehicle information
*/
virtual const VehicleInfo GetVehicleInfo() const = 0;
+
+ /**
+ * @brief Checks if a given application is an enabled cloud application
+ * @param policy_app_id Unique application id
+ * @return true if the application is an enabled cloud application,
+ * false otherwise
+ */
+ virtual const bool CheckCloudAppEnabled(
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param endpoint Filled the endpoint used to connect to the cloud
+ * application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param cloud_transport_type Filled with the hybrid app preference for the
+ * cloud application set by the user
+ * @return true if the cloud app is enabled, false otherwise
+ */
+ virtual const bool GetCloudAppParameters(
+ const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const = 0;
+
+ /**
+ * @brief Callback for when a SetCloudAppProperties message is received from a
+ * mobile app
+ * @param message The SetCloudAppProperties message
+ */
+ virtual void OnSetCloudAppProperties(
+ const smart_objects::SmartObject& message) = 0;
+
#ifdef EXTERNAL_PROPRIETARY_MODE
/**
* @brief Gets meta information
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index ee0bae7118..9c67e239b7 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -503,6 +503,57 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual const VehicleInfo GetVehicleInfo() const = 0;
/**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param endpoint Filled the endpoint used to connect to the cloud
+ * application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param cloud_transport_type Filled with the hybrid app preference for the
+ * cloud application set by the user
+ * @return true if the cloud app is enabled, false otherwise
+ */
+ virtual const bool GetCloudAppParameters(
+ const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const = 0;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) = 0;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) = 0;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
+
+ /**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
* succesfully registered on mobile device.
* It will send OnAppPermissionSend notification and will try to start PTU. *
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
index cb47147074..bd56d78128 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
@@ -213,6 +213,16 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
GetAppRequestTypes,
const std::vector<std::string>(const std::string& policy_app_id));
MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ MOCK_CONST_METHOD1(CheckCloudAppEnabled,
+ const bool(const std::string& policy_app_id));
+ MOCK_CONST_METHOD5(GetCloudAppParameters,
+ const bool(const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference));
+ MOCK_METHOD1(OnSetCloudAppProperties,
+ void(const smart_objects::SmartObject& message));
#ifdef EXTERNAL_PROPRIETARY_MODE
MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
index 440000dbff..745bcd2db5 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
@@ -63,6 +63,23 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_METHOD0(TimeoutResponse, int());
MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>& seconds));
MOCK_CONST_METHOD0(GetVehicleInfo, const VehicleInfo());
+ MOCK_CONST_METHOD5(GetCloudAppParameters,
+ const bool(const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference));
+ MOCK_METHOD2(SetCloudAppEnabled,
+ void(const std::string& policy_app_id, const bool enabled));
+ MOCK_METHOD2(SetAppAuthToken,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
+ MOCK_METHOD2(SetAppCloudTransportType,
+ void(const std::string& policy_app_id,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
MOCK_METHOD1(SetVINValue, bool(const std::string& value));
MOCK_METHOD2(GetUserFriendlyMsg,
std::vector<UserFriendlyMessage>(
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
index 0e06e9c1a3..8867c3de80 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
@@ -181,6 +181,23 @@ class MockPolicyManager : public PolicyManager {
GetAppRequestTypes,
const std::vector<std::string>(const std::string policy_app_id));
MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ MOCK_CONST_METHOD5(GetCloudAppParameters,
+ const bool(const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference));
+ MOCK_METHOD2(SetCloudAppEnabled,
+ void(const std::string& policy_app_id, const bool enabled));
+ MOCK_METHOD2(SetAppAuthToken,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
+ MOCK_METHOD2(SetAppCloudTransportType,
+ void(const std::string& policy_app_id,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
MOCK_CONST_METHOD0(RetrieveCertificate, std::string());
MOCK_CONST_METHOD0(HasCertificate, bool());
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h
index 48e00f7049..119a0c0519 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -147,6 +147,57 @@ class CacheManager : public CacheManagerInterface {
virtual const VehicleInfo GetVehicleInfo() const;
/**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param endpoint Filled the endpoint used to connect to the cloud
+ * application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param cloud_transport_type Filled with the hybrid app preference for the
+ * cloud application set by the user
+ * @return true if the cloud app is enabled, false otherwise
+ */
+ virtual const bool GetCloudAppParameters(
+ const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled);
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token);
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type);
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference);
+
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
index 10a6ea7f89..9408809f1e 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
@@ -152,6 +152,57 @@ class CacheManagerInterface {
virtual const VehicleInfo GetVehicleInfo() const = 0;
/**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param endpoint Filled the endpoint used to connect to the cloud
+ * application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param cloud_transport_type Filled with the hybrid app preference for the
+ * cloud application set by the user
+ * @return true if the cloud app is enabled, false otherwise
+ */
+ virtual const bool GetCloudAppParameters(
+ const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const = 0;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) = 0;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) = 0;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
+
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
index 51d4ee88aa..e1221b613f 100644
--- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
@@ -565,6 +565,58 @@ class PolicyManagerImpl : public PolicyManager {
const VehicleInfo GetVehicleInfo() const OVERRIDE;
/**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param endpoint Filled the endpoint used to connect to the cloud
+ * application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param cloud_transport_type Filled with the hybrid app preference for the
+ * cloud application set by the user
+ * @return true if the cloud app is enabled, false otherwise
+ */
+ const bool GetCloudAppParameters(
+ const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const OVERRIDE;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) OVERRIDE;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) OVERRIDE;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) OVERRIDE;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) OVERRIDE;
+
+ /**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
* succesfully registered on mobile device.
* It will send OnAppPermissionSend notification and will try to start PTU. *
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/enums.h b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
index f398e16020..fce6b7b865 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table/enums.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
@@ -168,6 +168,12 @@ bool IsValidEnum(ModuleType val);
const char* EnumToJsonString(ModuleType val);
bool EnumFromJsonString(const std::string& literal, ModuleType* result);
+enum HybridAppPreference { HAP_MOBILE, HAP_CLOUD, HAP_BOTH };
+bool IsValidEnum(HybridAppPreference val);
+const char* EnumToJsonString(HybridAppPreference val);
+bool EnumFromJsonString(const std::string& literal,
+ HybridAppPreference* result);
+
/**
* @brief Enumeration FunctionID.
*
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/types.h b/src/components/policy/policy_regular/include/policy/policy_table/types.h
index e201251745..58f07492c4 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table/types.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table/types.h
@@ -144,6 +144,12 @@ struct ApplicationParams : PolicyBase {
Optional<Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms;
Optional<String<0, 255> > certificate;
mutable Optional<ModuleTypes> moduleType;
+ // Cloud application params
+ Optional<Enum<HybridAppPreference> > hybrid_app_preference;
+ Optional<String<0, 255> > endpoint;
+ Optional<Boolean> enabled;
+ Optional<String<0, 65535> > auth_token;
+ Optional<String<0, 255> > cloud_transport_type;
public:
ApplicationParams();
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index bd95fc8e7c..68e70c107d 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -682,6 +682,81 @@ const policy::VehicleInfo CacheManager::GetVehicleInfo() const {
return vehicle_info;
}
+const bool CacheManager::GetCloudAppParameters(
+ const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const {
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ auto app_policy = (*policy_iter).second;
+ endpoint = app_policy.endpoint.is_initialized() ? *app_policy.endpoint
+ : std::string();
+ auth_token = app_policy.auth_token.is_initialized() ? *app_policy.auth_token
+ : std::string();
+ cloud_transport_type = app_policy.cloud_transport_type.is_initialized()
+ ? *app_policy.cloud_transport_type
+ : std::string();
+ hybrid_app_preference =
+ app_policy.hybrid_app_preference.is_initialized()
+ ? EnumToJsonString(*app_policy.hybrid_app_preference)
+ : std::string();
+ return app_policy.enabled.is_initialized() && *app_policy.enabled;
+ }
+ return false;
+}
+
+void CacheManager::SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.enabled = enabled;
+ }
+}
+
+void CacheManager::SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.auth_token = auth_token;
+ }
+}
+
+void CacheManager::SetAppCloudTransportType(
+ const std::string& policy_app_id, const std::string& cloud_transport_type) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.cloud_transport_type = cloud_transport_type;
+ }
+}
+
+void CacheManager::SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) {
+ policy_table::HybridAppPreference value;
+ bool valid = EnumFromJsonString(hybrid_app_preference, &value);
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter && valid) {
+ *(*policy_iter).second.hybrid_app_preference = value;
+ }
+}
+
std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes, const std::string& language) {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index 4985035629..9317708216 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -217,7 +217,7 @@ void FilterInvalidApplicationParameters(
}
app_params.AppHMIType->swap(valid_app_hmi_types);
- // Filter RquestTypes array
+ // Filter RequestTypes array
policy_table::RequestTypes valid_request_types;
const policy_table::RequestTypes& request_types = *(app_params.RequestType);
for (const auto& request_type : request_types) {
@@ -544,6 +544,36 @@ const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const {
return cache_->GetVehicleInfo();
}
+const bool PolicyManagerImpl::GetCloudAppParameters(
+ const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const {
+ return cache_->GetCloudAppParameters(policy_app_id, endpoint, auth_token, cloud_transport_type, hybrid_app_preference);
+}
+
+void PolicyManagerImpl::SetCloudAppEnabled(
+ const std::string& policy_app_id, const bool enabled) {
+ cache_->SetCloudAppEnabled(policy_app_id, enabled);
+}
+
+void PolicyManagerImpl::SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ cache_->SetAppAuthToken(policy_app_id, auth_token);
+}
+
+void PolicyManagerImpl::SetAppCloudTransportType(
+ const std::string& policy_app_id, const std::string& cloud_transport_type) {
+ cache_->SetAppCloudTransportType(policy_app_id, cloud_transport_type);
+}
+
+void PolicyManagerImpl::SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) {
+ cache_->SetHybridAppPreference(policy_app_id, hybrid_app_preference);
+}
+
void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
const PTString& app_id,
const PTString& hmi_level,
diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc
index bec9a2ec2d..2ddf74af7e 100644
--- a/src/components/policy/policy_regular/src/policy_table/enums.cc
+++ b/src/components/policy/policy_regular/src/policy_table/enums.cc
@@ -1,5 +1,5 @@
-// This file is generated, do not edit
#include "policy/policy_table/enums.h"
+#include <cstring>
namespace rpc {
namespace policy_table_interface_base {
@@ -669,6 +669,7 @@ bool IsValidEnum(ModuleType val) {
return false;
}
}
+
const char* EnumToJsonString(ModuleType val) {
switch (val) {
case MT_CLIMATE:
@@ -716,6 +717,38 @@ bool EnumFromJsonString(const std::string& literal, ModuleType* result) {
return false;
}
+bool IsValidEnum(HybridAppPreference val) {
+ return strlen(EnumToJsonString(val)) > 0;
+}
+
+const char* EnumToJsonString(HybridAppPreference val) {
+ switch (val) {
+ case HAP_MOBILE:
+ return "MOBILE";
+ case HAP_CLOUD:
+ return "CLOUD";
+ case HAP_BOTH:
+ return "BOTH";
+ default:
+ return "";
+ }
+}
+
+bool EnumFromJsonString(const std::string& literal,
+ HybridAppPreference* result) {
+ if ("MOBILE" == literal) {
+ *result = HAP_MOBILE;
+ return true;
+ } else if ("CLOUD" == literal) {
+ *result = HAP_CLOUD;
+ return true;
+ } else if ("BOTH" == literal) {
+ *result = HAP_BOTH;
+ return true;
+ }
+ return false;
+}
+
bool IsValidEnum(FunctionID val) {
switch (val) {
case RegisterAppInterfaceID:
diff --git a/src/components/policy/policy_regular/src/policy_table/types.cc b/src/components/policy/policy_regular/src/policy_table/types.cc
index 851ed1bd18..88564df050 100644
--- a/src/components/policy/policy_regular/src/policy_table/types.cc
+++ b/src/components/policy/policy_regular/src/policy_table/types.cc
@@ -168,7 +168,13 @@ ApplicationParams::ApplicationParams(const Json::Value* value__)
, memory_kb(impl::ValueMember(value__, "memory_kb"), 0)
, heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms"))
, certificate(impl::ValueMember(value__, "certificate"), "not_specified")
- , moduleType(impl::ValueMember(value__, "moduleType")) {}
+ , moduleType(impl::ValueMember(value__, "moduleType"))
+ , hybrid_app_preference(impl::ValueMember(value__, "hybrid_app_preference"))
+ , endpoint(impl::ValueMember(value__, "endpoint"))
+ , enabled(impl::ValueMember(value__, "enabled"))
+ , auth_token(impl::ValueMember(value__, "auth_token"))
+ , cloud_transport_type(impl::ValueMember(value__, "cloud_transport_type")) {
+}
Json::Value ApplicationParams::ToJsonValue() const {
Json::Value result__(PolicyBase::ToJsonValue());
@@ -180,7 +186,14 @@ Json::Value ApplicationParams::ToJsonValue() const {
impl::WriteJsonField("memory_kb", memory_kb, &result__);
impl::WriteJsonField(
"heart_beat_timeout_ms", heart_beat_timeout_ms, &result__);
+ impl::WriteJsonField("certificate", certificate, &result__);
impl::WriteJsonField("moduleType", moduleType, &result__);
+ impl::WriteJsonField(
+ "hybrid_app_preference", hybrid_app_preference, &result__);
+ impl::WriteJsonField("endpoint", endpoint, &result__);
+ impl::WriteJsonField("enabled", enabled, &result__);
+ impl::WriteJsonField("auth_token", auth_token, &result__);
+ impl::WriteJsonField("cloud_transport_type", cloud_transport_type, &result__);
return result__;
}
@@ -212,6 +225,21 @@ bool ApplicationParams::is_valid() const {
if (!moduleType.is_valid()) {
return false;
}
+ if (!endpoint.is_valid()) {
+ return false;
+ }
+ if (!enabled.is_valid()) {
+ return false;
+ }
+ if (!auth_token.is_valid()) {
+ return false;
+ }
+ if (!cloud_transport_type.is_valid()) {
+ return false;
+ }
+ if (!hybrid_app_preference.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -250,6 +278,21 @@ bool ApplicationParams::struct_empty() const {
if (moduleType.is_initialized()) {
return false;
}
+ if (endpoint.is_initialized()) {
+ return false;
+ }
+ if (enabled.is_initialized()) {
+ return false;
+ }
+ if (auth_token.is_initialized()) {
+ return false;
+ }
+ if (cloud_transport_type.is_initialized()) {
+ return false;
+ }
+ if (hybrid_app_preference.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -288,6 +331,22 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
if (!moduleType.is_valid()) {
moduleType.ReportErrors(&report__->ReportSubobject("moduleType"));
}
+ if (!endpoint.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("endpoint"));
+ }
+ if (!enabled.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("enabled"));
+ }
+ if (!auth_token.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("auth_token"));
+ }
+ if (!cloud_transport_type.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("cloud_transport_type"));
+ }
+ if (!hybrid_app_preference.is_valid()) {
+ moduleType.ReportErrors(
+ &report__->ReportSubobject("hybrid_app_preference"));
+ }
}
void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
@@ -300,6 +359,10 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
heart_beat_timeout_ms.SetPolicyTableType(pt_type);
certificate.SetPolicyTableType(pt_type);
moduleType.SetPolicyTableType(pt_type);
+ endpoint.SetPolicyTableType(pt_type);
+ enabled.SetPolicyTableType(pt_type);
+ cloud_transport_type.SetPolicyTableType(pt_type);
+ hybrid_app_preference.SetPolicyTableType(pt_type);
}
// RpcParameters methods
diff --git a/src/components/policy/policy_regular/src/sql_pt_queries.cc b/src/components/policy/policy_regular/src/sql_pt_queries.cc
index f5ccffce3b..ef6c7f2a03 100644
--- a/src/components/policy/policy_regular/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc
@@ -84,6 +84,9 @@ const std::string kCreateSchema =
"CREATE TABLE IF NOT EXISTS `hmi_level`( "
" `value` VARCHAR(45) PRIMARY KEY NOT NULL "
"); "
+ "CREATE TABLE IF NOT EXISTS `hybrid_app_preference`( "
+ " `value` VARCHAR(45) PRIMARY KEY NOT NULL "
+ "); "
"CREATE TABLE IF NOT EXISTS `notifications_by_priority`( "
" `priority_value` VARCHAR(45) PRIMARY KEY NOT NULL, "
" `value` INTEGER NOT NULL, "
@@ -133,7 +136,12 @@ const std::string kCreateSchema =
" `is_predata` BOOLEAN, "
" `memory_kb` INTEGER NOT NULL, "
" `heart_beat_timeout_ms` INTEGER NOT NULL, "
- " `certificate` VARCHAR(45), "
+ " `certificate` VARCHAR(65535), "
+ " `hybrid_app_preference_value` VARCHAR(255), "
+ " `endpoint` VARCHAR(255), "
+ " `enabled` BOOLEAN, "
+ " `auth_token` VARCHAR(65535), "
+ " `cloud_transport_type` VARCHAR(255), "
" `remote_control_denied` BOOLEAN NOT NULL DEFAULT 0, "
" CONSTRAINT `fk_application_hmi_level1` "
" FOREIGN KEY(`default_hmi`) "
@@ -141,11 +149,17 @@ const std::string kCreateSchema =
" CONSTRAINT `fk_application_priorities1` "
" FOREIGN KEY(`priority_value`) "
" REFERENCES `priority`(`value`) "
+ " CONSTRAINT `fk_application_hybrid_app_preference1` "
+ " FOREIGN KEY(`hybrid_app_preference_value`) "
+ " REFERENCES `hybrid_app_preference`(`value`) "
"); "
"CREATE INDEX IF NOT EXISTS `application.fk_application_hmi_level1_idx` "
" ON `application`(`default_hmi`); "
"CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` "
" ON `application`(`priority_value`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`application.fk_application_hybrid_app_preference1` "
+ " ON `application`(`hybrid_app_preference_value`); "
"CREATE TABLE IF NOT EXISTS `app_group`( "
" `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
@@ -391,6 +405,9 @@ const std::string kInsertInitData =
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('LIMITED'); "
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND'); "
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('MOBILE'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('CLOUD'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('BOTH'); "
"INSERT OR IGNORE INTO `version` (`number`) VALUES('0'); "
"INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); "
"";
@@ -491,6 +508,7 @@ const std::string kDropSchema =
"`notifications_by_priority.fk_notifications_by_priority_priority1_idx`; "
"DROP TABLE IF EXISTS `notifications_by_priority`; "
"DROP TABLE IF EXISTS `hmi_level`; "
+ "DROP TABLE IF EXISTS `hybrid_app_preference`; "
"DROP TABLE IF EXISTS `priority`; "
"DROP TABLE IF EXISTS `functional_group`; "
"DROP TABLE IF EXISTS `module_config`; "
@@ -578,8 +596,10 @@ 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`) VALUES (?,?,?,?,?,?)";
+ "`is_revoked`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, "
+ "`hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token`, "
+ "`cloud_transport_type`) VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?)";
const std::string kInsertAppGroup =
"INSERT INTO `app_group` (`application_id`, `functional_group_id`)"
@@ -688,7 +708,8 @@ const std::string kSelectUserMsgsVersion =
const std::string kSelectAppPolicies =
"SELECT `id`, `priority_value`, `memory_kb`, "
- " `heart_beat_timeout_ms`, `certificate` FROM `application`";
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `cloud_transport_type` FROM `application`";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -785,15 +806,19 @@ 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`, `certificate`) "
- " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ " `is_predata`, `memory_kb`, `heart_beat_timeout_ms`, "
+ " `certificate`, `hybrid_app_preference_value`, `endpoint`, `enabled`, "
+ " `auth_token`, `cloud_transport_type`) "
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
const std::string kSelectApplicationFull =
"SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, "
" `is_revoked`, `is_default`, `is_predata`, `memory_kb`,"
- " `heart_beat_timeout_ms`, `certificate` FROM `application` WHERE `id` = "
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type` "
+ "FROM `application` "
+ "WHERE `id` = "
"?";
const std::string kSelectDBVersion =
diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc
index 75f8be74eb..9282caf535 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -716,12 +716,24 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
params.priority = priority;
*params.memory_kb = query.GetInteger(2);
-
*params.heart_beat_timeout_ms = query.GetUInteger(3);
- if (!query.IsNull(3)) {
+ if (!query.IsNull(4)) {
*params.certificate = query.GetString(4);
}
+ // Read cloud app properties
+ policy_table::HybridAppPreference hap;
+ bool valid = policy_table::EnumFromJsonString(query.GetString(5), &hap);
+ if (valid) {
+ *params.hybrid_app_preference = hap;
+ }
+ *params.endpoint = query.GetString(6);
+ if (!query.IsNull(7)) {
+ *params.enabled = query.GetBoolean(7);
+ }
+ *params.auth_token = query.GetString(8);
+ *params.cloud_transport_type = query.GetString(9);
+
const auto& gather_app_id = ((*policies).apps[app_id].is_string())
? (*policies).apps[app_id].get_string()
: app_id;
@@ -984,6 +996,22 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
app.second.certificate.is_initialized()
? app_query.Bind(5, *app.second.certificate)
: app_query.Bind(5);
+ app.second.hybrid_app_preference.is_initialized()
+ ? app_query.Bind(6,
+ 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.second.auth_token.is_initialized()
+ ? app_query.Bind(9, *app.second.auth_token)
+ : app_query.Bind(9);
+ app.second.cloud_transport_type.is_initialized()
+ ? app_query.Bind(10, *app.second.cloud_transport_type)
+ : app_query.Bind(10);
+
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
return false;
@@ -2084,6 +2112,17 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
query.Bind(9, source_app.GetInteger(8));
source_app.IsNull(9) ? query.Bind(10)
: query.Bind(10, source_app.GetString(9));
+ source_app.IsNull(10) ? query.Bind(11)
+ : query.Bind(11, source_app.GetString(10));
+ source_app.IsNull(11) ? query.Bind(12)
+ : query.Bind(12, source_app.GetString(11));
+ source_app.IsNull(12) ? query.Bind(13)
+ : query.Bind(13, source_app.GetBoolean(12));
+ source_app.IsNull(13) ? query.Bind(14)
+ : query.Bind(14, source_app.GetString(13));
+ source_app.IsNull(14) ? query.Bind(15)
+ : query.Bind(15, source_app.GetString(14));
+
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Failed inserting into application.");
return false;
diff --git a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
index 7d192515dc..030dc374dd 100644
--- a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
+++ b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
@@ -426,8 +426,8 @@ TEST_F(SQLPTRepresentationTest,
ASSERT_TRUE(reps->RefreshDB());
// Check PT structure destroyed and tables number is 0
- // There are 29 tables in the database, now.
- const int32_t total_tables_number = 29;
+ // There are 30 tables in the database, now.
+ const int32_t total_tables_number = 30;
ASSERT_EQ(total_tables_number, dbms->FetchOneInt(query_select));
const char* query_select_count_of_iap_buffer_full =
"SELECT `count_of_iap_buffer_full` FROM `usage_and_error_count`";