summaryrefslogtreecommitdiff
path: root/src/components/include
diff options
context:
space:
mode:
authorokozlovlux <okozlov@luxoft.com>2017-05-05 14:47:02 +0300
committerokozlovlux <okozlov@luxoft.com>2017-05-17 20:19:20 +0300
commit6442b8adb6b4557d0df437b7517fb2bd4433eb80 (patch)
tree06cbe4561178f78b09a726cf848017540e82685e /src/components/include
parentb4c332fa89762544de9ed80d4fd21766981f7739 (diff)
downloadsdl_core-6442b8adb6b4557d0df437b7517fb2bd4433eb80.tar.gz
Add missing functionality fo policies
Fix failed UTs
Diffstat (limited to 'src/components/include')
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h3
-rw-r--r--src/components/include/application_manager/policies/policy_handler_observer.h4
-rw-r--r--src/components/include/policy/policy_external/policy/policy_listener.h14
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h20
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h18
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h1
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_observer.h1
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_listener.h1
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h4
9 files changed, 44 insertions, 22 deletions
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 5d7c71b5b7..c5af16863a 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -305,6 +305,9 @@ class PolicyHandlerInterface {
std::map<std::string, StringArray> app_hmi_types) = 0;
virtual void OnCertificateUpdated(const std::string& certificate_data) = 0;
+
+ virtual void OnPTUFinished(const bool ptu_result) = 0;
+
#ifdef EXTERNAL_PROPRIETARY_MODE
virtual void OnCertificateDecrypted(bool is_succeeded) = 0;
#endif // EXTERNAL_PROPRIETARY_MODE
diff --git a/src/components/include/application_manager/policies/policy_handler_observer.h b/src/components/include/application_manager/policies/policy_handler_observer.h
index 6c0ff758bb..1c32102184 100644
--- a/src/components/include/application_manager/policies/policy_handler_observer.h
+++ b/src/components/include/application_manager/policies/policy_handler_observer.h
@@ -43,9 +43,13 @@ class PolicyHandlerObserver {
public:
virtual void OnUpdateHMIAppType(
std::map<std::string, std::vector<std::string> > app_hmi_types) {}
+
virtual bool OnCertificateUpdated(const std::string& certificate_data) {
return false;
}
+
+ virtual void OnPTUFinished(const bool ptu_result) {}
+
virtual ~PolicyHandlerObserver() {}
};
} // namespace policy
diff --git a/src/components/include/policy/policy_external/policy/policy_listener.h b/src/components/include/policy/policy_external/policy/policy_listener.h
index 82dd26a6f7..f3388beb95 100644
--- a/src/components/include/policy/policy_external/policy/policy_listener.h
+++ b/src/components/include/policy/policy_external/policy/policy_listener.h
@@ -52,6 +52,12 @@ class PolicyListener {
const Permissions& permissions) = 0;
virtual void OnPendingPermissionChange(const std::string& policy_app_id) = 0;
virtual void OnUpdateStatusChanged(const std::string&) = 0;
+ /**
+ * Gets device ID
+ * @param policy_app_id
+ * @return device ID
+ * @deprecated see std::vector<std::string> GetDevicesIds(const std::string&)
+ */
virtual std::string OnCurrentDeviceIdUpdateRequired(
const std::string& policy_app_id) = 0;
virtual void OnSystemInfoUpdateRequired() = 0;
@@ -115,6 +121,14 @@ class PolicyListener {
virtual void OnCertificateUpdated(const std::string& certificate_data) = 0;
/**
+ * @brief OnPTUFinishedd the callback which signals PTU has finished
+ *
+ * @param ptu_result the result from the PTU - true if successful,
+ * otherwise false.
+ */
+ virtual void OnPTUFinished(const bool ptu_result) = 0;
+
+ /**
* @brief Collects currently registered applications ids linked to their
* device id
* @return Collection of device_id-to-app_id links
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
index 83a802a713..9201956e2a 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -540,26 +540,6 @@ class PolicyManager : public usage_statistics::StatisticsManager {
*/
virtual ExternalConsentStatus GetExternalConsentStatus() = 0;
- /**
- * @brief Finds the next URL that must be sent on OnSystemRequest retry
- * @param urls vector of vectors that contain urls for each application
- * @return Pair of policy application id and application url id from the
- * urls vector
- */
- virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0;
-
- /**
- * @brief Checks if there is existing URL in the EndpointUrls vector with
- * index saved in the policy manager and if not, it moves to the next
- * application index
- * @param rs contains the application index and url index from the
- * urls vector that are to be sent on the next OnSystemRequest
- * @param urls vector of vectors that contain urls for each application
- * @return Pair of application index and url index
- */
- virtual AppIdURL RetrySequenceUrl(const struct RetrySequenceURL& rs,
- const EndpointUrls& urls) const = 0;
-
protected:
/**
* Checks is PT exceeded IgnitionCycles
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 1ff8193cb0..c8074b3528 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -38,6 +38,7 @@
#include "utils/callable.h"
#include "policy/policy_types.h"
+#include "policy/policy_table/types.h"
#include "policy/policy_listener.h"
#include "policy/usage_statistics/statistics_manager.h"
@@ -117,6 +118,10 @@ class PolicyManager : public usage_statistics::StatisticsManager {
const RPCParams& rpc_params,
CheckPermissionResult& result) = 0;
+ virtual void CheckPendingPermissionsChanges(
+ const std::string& policy_app_id,
+ const std::vector<FunctionalGroupPermission>& current_permissions) = 0;
+
/**
* @brief Clear all record of user consents. Used during Factory Reset.
* @return bool Success of operation
@@ -357,8 +362,9 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @param Application id assigned by Ford to the application
* @return function that will notify update manager about new application
*/
- virtual StatusNotifier AddApplication(const std::string& application_id) = 0;
-
+ virtual StatusNotifier AddApplication(
+ const std::string& application_id,
+ const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) = 0;
/**
* @brief Removes unpaired device records and related records from DB
* @param device_ids List of device_id, which should be removed
@@ -456,6 +462,14 @@ class PolicyManager : public usage_statistics::StatisticsManager {
*/
virtual std::string RetrieveCertificate() const = 0;
+ /**
+ * @brief HasCertificate check whether policy table has certificate
+ * int module_config section.
+ *
+ * @return true in case certificate exists, false otherwise
+ */
+ virtual bool HasCertificate() const = 0;
+
virtual const PolicySettings& get_settings() const = 0;
/**
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 51b00c7127..8f6972fd52 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
@@ -172,6 +172,7 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_METHOD1(OnUpdateHMIAppType,
void(std::map<std::string, policy::StringArray> app_hmi_types));
MOCK_METHOD1(OnCertificateUpdated, void(const std::string& certificate_data));
+ MOCK_METHOD1(OnPTUFinished, void(const bool ptu_result));
MOCK_METHOD1(OnCertificateDecrypted, void(bool is_succeeded));
MOCK_METHOD0(CanUpdate, bool());
MOCK_METHOD2(OnDeviceConsentChanged,
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h b/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
index cc0f73126b..e8ed0e90e2 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
@@ -49,6 +49,7 @@ class MockPolicyHandlerObserver : public ::policy::PolicyHandlerObserver {
MOCK_METHOD1(OnUpdateHMIAppType,
void(std::map<std::string, std::vector<std::string> >));
MOCK_METHOD1(OnCertificateUpdated, bool(const std::string&));
+ MOCK_METHOD1(OnPTUFinished, void(const bool ptu_result));
};
} // namespace application_manager_test
} // namespace components
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
index 74f333ba11..893d5a334f 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
@@ -81,6 +81,7 @@ class MockPolicyListener : public ::policy::PolicyListener {
uint32_t timeout_exceed));
MOCK_METHOD0(CanUpdate, bool());
MOCK_METHOD1(OnCertificateUpdated, void(const std::string&));
+ MOCK_METHOD1(OnPTUFinished, void(const bool ptu_result));
MOCK_CONST_METHOD2(SendOnAppPermissionsChanged,
void(const policy::AppPermissions&, const std::string&));
MOCK_METHOD1(GetDevicesIds,
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 7b474642bf..1ccca81d79 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
@@ -200,6 +200,10 @@ class MockPolicyManager : public PolicyManager {
const PTString& rpc,
const RPCParams& rpc_params,
CheckPermissionResult& result));
+ MOCK_METHOD2(
+ CheckPendingPermissionsChanges,
+ void(const std::string& policy_app_id,
+ const std::vector<FunctionalGroupPermission>& current_permissions));
};
} // namespace policy_manager_test