Skip to content

Commit bb6e941

Browse files
Remove deprecated NetworkSettings functions (#1556)
Deprecated ones were used only in tests Relates-To: OCMAM-212 Signed-off-by: Andrey Kashcheev <ext-andrey.kashcheev@here.com>
1 parent 8e6a6c9 commit bb6e941

3 files changed

Lines changed: 1 addition & 117 deletions

File tree

olp-cpp-sdk-core/include/olp/core/http/NetworkSettings.h

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,6 @@ namespace http {
3737
*/
3838
class CORE_API NetworkSettings final {
3939
public:
40-
/**
41-
* @brief Gets the maximum number of retries for the HTTP request.
42-
*
43-
* @return The maximum number of retries for the HTTP request.
44-
*/
45-
OLP_SDK_DEPRECATED("Will be removed by 04.2024")
46-
std::size_t GetRetries() const;
47-
48-
/**
49-
* @brief Sets the maximum number of retries for the HTTP request.
50-
*
51-
* @param[in] retries The maximum number of retries for HTTP request.
52-
*
53-
* @return A reference to *this.
54-
*/
55-
OLP_SDK_DEPRECATED("Will be removed by 04.2024")
56-
NetworkSettings& WithRetries(std::size_t retries);
57-
58-
/**
59-
* @brief Gets the connection timeout in seconds.
60-
*
61-
* @return The connection timeout in seconds.
62-
*/
63-
OLP_SDK_DEPRECATED(
64-
"Will be removed by 04.2024, use GetConnectionTimeoutDuration() instead")
65-
int GetConnectionTimeout() const;
66-
6740
/**
6841
* @brief Gets the connection timeout.
6942
*
@@ -80,18 +53,6 @@ class CORE_API NetworkSettings final {
8053
std::chrono::milliseconds GetBackgroundConnectionTimeoutDuration() const;
8154
#endif // OLP_SDK_NETWORK_IOS_BACKGROUND_DOWNLOAD
8255

83-
/**
84-
* @brief Sets the connection timeout in seconds.
85-
*
86-
* @param[in] timeout The connection timeout in seconds.
87-
*
88-
* @return A reference to *this.
89-
*/
90-
OLP_SDK_DEPRECATED(
91-
"Will be removed by 04.2024, use "
92-
"WithConnectionTimeout(std::chrono::milliseconds) instead")
93-
NetworkSettings& WithConnectionTimeout(int timeout);
94-
9556
/**
9657
* @brief Sets the connection timeout.
9758
*
@@ -113,34 +74,13 @@ class CORE_API NetworkSettings final {
11374
std::chrono::milliseconds timeout);
11475
#endif // OLP_SDK_NETWORK_IOS_BACKGROUND_DOWNLOAD
11576

116-
/**
117-
* @brief Gets the transfer timeout in seconds.
118-
*
119-
* @return The transfer timeout in seconds.
120-
*/
121-
OLP_SDK_DEPRECATED(
122-
"Will be removed by 04.2024, use GetTransferTimeoutDuration() instead")
123-
int GetTransferTimeout() const;
124-
12577
/**
12678
* @brief Gets the transfer timeout.
12779
*
12880
* @return The transfer timeout.
12981
*/
13082
std::chrono::milliseconds GetTransferTimeoutDuration() const;
13183

132-
/**
133-
* @brief Sets the transfer timeout in seconds.
134-
*
135-
* @param[in] timeout The transfer timeout in seconds.
136-
*
137-
* @return A reference to *this.
138-
*/
139-
OLP_SDK_DEPRECATED(
140-
"Will be removed by 04.2024, use "
141-
"WithTransferTimeout(std::chrono::milliseconds) instead")
142-
NetworkSettings& WithTransferTimeout(int timeout);
143-
14484
/**
14585
* @brief Gets max lifetime (since creation) allowed for reusing a connection.
14686
*
@@ -203,8 +143,6 @@ class CORE_API NetworkSettings final {
203143
NetworkSettings& WithDNSServers(std::vector<std::string> dns_servers);
204144

205145
private:
206-
/// The maximum number of retries for the HTTP request.
207-
std::size_t retries_{3};
208146
/// The connection timeout.
209147
std::chrono::milliseconds connection_timeout_ = std::chrono::seconds(60);
210148
#ifdef OLP_SDK_NETWORK_IOS_BACKGROUND_DOWNLOAD

olp-cpp-sdk-core/src/http/NetworkSettings.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@
2222
namespace olp {
2323
namespace http {
2424

25-
std::size_t NetworkSettings::GetRetries() const { return retries_; }
26-
27-
int NetworkSettings::GetConnectionTimeout() const {
28-
return static_cast<int>(std::chrono::duration_cast<std::chrono::seconds>(
29-
GetConnectionTimeoutDuration())
30-
.count());
31-
}
32-
3325
std::chrono::milliseconds NetworkSettings::GetConnectionTimeoutDuration()
3426
const {
3527
return connection_timeout_;
@@ -42,12 +34,6 @@ NetworkSettings::GetBackgroundConnectionTimeoutDuration() const {
4234
}
4335
#endif // OLP_SDK_NETWORK_IOS_BACKGROUND_DOWNLOAD
4436

45-
int NetworkSettings::GetTransferTimeout() const {
46-
return static_cast<int>(std::chrono::duration_cast<std::chrono::seconds>(
47-
GetTransferTimeoutDuration())
48-
.count());
49-
}
50-
5137
std::chrono::milliseconds NetworkSettings::GetTransferTimeoutDuration() const {
5238
return transfer_timeout_;
5339
}
@@ -64,15 +50,6 @@ const std::vector<std::string>& NetworkSettings::GetDNSServers() const {
6450
return dns_servers_;
6551
}
6652

67-
NetworkSettings& NetworkSettings::WithRetries(std::size_t retries) {
68-
retries_ = retries;
69-
return *this;
70-
}
71-
72-
NetworkSettings& NetworkSettings::WithConnectionTimeout(int timeout) {
73-
return WithConnectionTimeout(std::chrono::seconds(timeout));
74-
}
75-
7653
NetworkSettings& NetworkSettings::WithConnectionTimeout(
7754
std::chrono::milliseconds timeout) {
7855
connection_timeout_ = timeout;
@@ -87,10 +64,6 @@ NetworkSettings& NetworkSettings::WithBackgroundConnectionTimeout(
8764
}
8865
#endif // OLP_SDK_NETWORK_IOS_BACKGROUND_DOWNLOAD
8966

90-
NetworkSettings& NetworkSettings::WithTransferTimeout(int timeout) {
91-
return WithTransferTimeout(std::chrono::seconds(timeout));
92-
}
93-
9467
NetworkSettings& NetworkSettings::WithTransferTimeout(
9568
std::chrono::milliseconds timeout) {
9669
transfer_timeout_ = timeout;
Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2023 HERE Europe B.V.
2+
* Copyright (C) 2023-2024 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,52 +20,27 @@
2020
#include <gtest/gtest.h>
2121

2222
#include <olp/core/http/NetworkSettings.h>
23-
#include <olp/core/porting/warning_disable.h>
24-
25-
PORTING_PUSH_WARNINGS()
26-
PORTING_CLANG_GCC_DISABLE_WARNING("-Wdeprecated-declarations")
2723

2824
namespace {
2925

3026
TEST(NetworkSettingsTest, TimeoutDefaults) {
3127
const auto settings = olp::http::NetworkSettings();
32-
EXPECT_EQ(settings.GetConnectionTimeout(), 60);
3328
EXPECT_EQ(settings.GetConnectionTimeoutDuration(), std::chrono::seconds(60));
34-
EXPECT_EQ(settings.GetTransferTimeout(), 30);
3529
EXPECT_EQ(settings.GetTransferTimeoutDuration(), std::chrono::seconds(30));
3630
}
3731

38-
TEST(NetworkSettingsTest, WithConnectionTimeoutDeprecated) {
39-
const auto settings = olp::http::NetworkSettings().WithConnectionTimeout(15);
40-
EXPECT_EQ(settings.GetConnectionTimeout(), 15);
41-
EXPECT_EQ(settings.GetConnectionTimeoutDuration(), std::chrono::seconds(15));
42-
}
43-
4432
TEST(NetworkSettingsTest, WithConnectionTimeout) {
4533
const auto settings = olp::http::NetworkSettings().WithConnectionTimeout(
4634
std::chrono::seconds(15));
47-
EXPECT_EQ(settings.GetConnectionTimeout(), 15);
4835
EXPECT_EQ(settings.GetConnectionTimeoutDuration(), std::chrono::seconds(15));
4936
}
5037

51-
TEST(NetworkSettingsTest, WithTransferTimeoutDeprecated) {
52-
const auto settings = olp::http::NetworkSettings().WithTransferTimeout(15);
53-
EXPECT_EQ(settings.GetTransferTimeout(), 15);
54-
EXPECT_EQ(settings.GetTransferTimeoutDuration(), std::chrono::seconds(15));
55-
}
56-
5738
TEST(NetworkSettingsTest, WithTransferTimeout) {
5839
const auto settings = olp::http::NetworkSettings().WithTransferTimeout(
5940
std::chrono::seconds(15));
60-
EXPECT_EQ(settings.GetTransferTimeout(), 15);
6141
EXPECT_EQ(settings.GetTransferTimeoutDuration(), std::chrono::seconds(15));
6242
}
6343

64-
TEST(NetworkSettingsTest, WithRetriesDeprecated) {
65-
const auto settings = olp::http::NetworkSettings().WithRetries(5);
66-
EXPECT_EQ(settings.GetRetries(), 5);
67-
}
68-
6944
TEST(NetworkSettingsTest, WithMaxConnectionLifetimeDefault) {
7045
const auto settings = olp::http::NetworkSettings();
7146
EXPECT_EQ(settings.GetMaxConnectionLifetime(), std::chrono::seconds(0));
@@ -84,5 +59,3 @@ TEST(NetworkSettingsTest, WithDNSServers) {
8459
}
8560

8661
} // namespace
87-
88-
PORTING_POP_WARNINGS()

0 commit comments

Comments
 (0)