diff options
author | Teodora Kireva <tkireva@luxoft.com> | 2017-02-03 18:44:02 +0200 |
---|---|---|
committer | Ira Lytvynenko <ILytvynenko@luxoft.com> | 2017-04-10 18:20:04 +0300 |
commit | 69a14b99f68a03bb71857d0e619b547d3bc653c0 (patch) | |
tree | 51dddef248d4f297f36c35fe1717710625931419 /src/components/include | |
parent | 9e7a39af22c3587580cb2dcff44e6a9b6956d02c (diff) | |
download | sdl_core-69a14b99f68a03bb71857d0e619b547d3bc653c0.tar.gz |
Fix OnSystemRequest cycling urls refactoring
Required refactoring of the functionality that is responsible
for sending different application URL on each OnSystemRequest.
The logic was placed in OnSnapshotCreated method. Now it is
separated on two methods - GetNextUpdateUrl - returns pair of
policy application id and url from the Endpoints vector that
potentially will be sent, IsUrlAppIdValid - checks if given
policy application id is assigned to a registered application
or it is the default id.
Diffstat (limited to 'src/components/include')
4 files changed, 21 insertions, 0 deletions
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 7d5bbb5e52..181e4c364e 100644 --- a/src/components/include/policy/policy_external/policy/policy_manager.h +++ b/src/components/include/policy/policy_external/policy/policy_manager.h @@ -481,6 +481,12 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual const PolicySettings& get_settings() const = 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 + */ + virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0; protected: /** * Checks is PT exceeded IgnitionCycles diff --git a/src/components/include/policy/policy_regular/policy/policy_types.h b/src/components/include/policy/policy_regular/policy/policy_types.h index b3843f8889..70930f7048 100644 --- a/src/components/include/policy/policy_regular/policy/policy_types.h +++ b/src/components/include/policy/policy_regular/policy/policy_types.h @@ -313,6 +313,19 @@ struct MetaInfo { std::string language; }; +struct RetrySequenceURL { + int app; + int url; + RetrySequenceURL(int app_idx, int url_idx) { + app = app_idx; + url = url_idx; + } +}; + +typedef struct RetrySequenceURL RetrySequenceURL; + +typedef std::pair<std::string, std::string> AppIdURL; + } // namespace policy #endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_TYPES_H_ diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h index 0140efddf5..8c5a51a55d 100644 --- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h +++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h @@ -182,6 +182,7 @@ class MockPolicyManager : public PolicyManager { int32_t timespan_seconds)); MOCK_CONST_METHOD0(get_settings, const PolicySettings&()); MOCK_METHOD1(set_settings, void(const PolicySettings* get_settings)); + MOCK_METHOD1(GetNextUpdateUrl, AppIdURL(const EndpointUrls& urls)); }; } // namespace policy_manager_test } // namespace components 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 638f33399c..c6c02fac55 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 @@ -184,6 +184,7 @@ class MockPolicyManager : public PolicyManager { MOCK_CONST_METHOD0(get_settings, const PolicySettings&()); MOCK_METHOD1(set_settings, void(const PolicySettings* get_settings)); MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string()); + MOCK_METHOD1(GetNextUpdateUrl, AppIdURL(const EndpointUrls& urls)); }; } // namespace policy_manager_test |