16 #include <gtest/gtest.h> 22 using ::testing::Matcher;
23 using ::testing::DoAll;
24 using ::testing::SetArgReferee;
25 using ::testing::Return;
31 std::shared_ptr<ParameterReaderMock> param_reader_ =
32 std::make_shared<ParameterReaderMock>();
33 std::shared_ptr<ClientConfigurationProvider> test_subject_ =
34 std::make_shared<ClientConfigurationProvider>(param_reader_);
39 const char* expected_str =
"N2IxYjk2ZDhkYTNmZWQ2ZjkwMDlhNWRl";
40 const int kExpectedInt = 64654;
41 const bool kExpectedBool =
true;
43 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<std::vector<std::string> &>(_)))
45 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<double &>(_)))
47 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<std::string &>(_)))
49 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<Aws::String &>(_)))
51 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<int &>(_)))
53 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<bool &>(_)))
56 ClientConfiguration config = test_subject_->GetClientConfiguration();
58 EXPECT_EQ(expected_str, config.region);
59 EXPECT_EQ(kExpectedInt, config.maxConnections);
60 EXPECT_EQ(kExpectedBool, config.useDualStack);
65 ClientConfiguration default_config;
66 const char* unexpected_str = (default_config.region + Aws::String(
"YjJiOWZmZDQ3Yjg1MTU0MmE3MjFmOTk2")).c_str();
67 const int unkExpectedInt = default_config.maxConnections + 45231;
68 const bool unkExpectedBool = !default_config.useDualStack;
70 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<Aws::String &>(_)))
72 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<int &>(_)))
74 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<bool &>(_)))
77 ClientConfiguration config = test_subject_->GetClientConfiguration();
79 EXPECT_EQ(unexpected_str, config.region);
80 EXPECT_NE(unkExpectedInt, config.maxConnections);
81 EXPECT_EQ(unkExpectedBool, config.useDualStack);
82 EXPECT_EQ(default_config.maxConnections, config.maxConnections);
83 EXPECT_NE(default_config.useDualStack, config.useDualStack);
87 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<Aws::String &>(_)))
89 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<int &>(_)))
91 EXPECT_CALL(*param_reader_, ReadParam(_, Matcher<bool &>(_)))
94 ClientConfiguration config1 = test_subject_->GetClientConfiguration();
95 ClientConfiguration config2 = test_subject_->GetClientConfiguration(
"another_version");
96 EXPECT_NE(config1, config2);
97 config1.userAgent = config2.userAgent;
98 EXPECT_EQ(config1, config2);
103 public ::testing::TestWithParam<client_conf_mutator> { };
107 ClientConfiguration config1, config2;
109 EXPECT_EQ(config1, config2);
112 EXPECT_NE(config1, config2);
117 [](ClientConfiguration & config)->
void { config.region =
"OTg5ZWRiMWVhYjEyZDRkMWFhOTRlZGU0"; },
118 [](ClientConfiguration & config)->
void { config.userAgent =
"YmVkYjJjYTA0NTg0ZGJjZDdjOWY2OWYz"; },
119 [](ClientConfiguration & config)->
void { config.endpointOverride =
"MzllMmUxZWUzMmE3OWQ1MzZhZGQ0ZWM2"; },
120 [](ClientConfiguration & config)->
void { config.proxyHost =
"NzgzNzY5NDM5NTNjYmEzNGU0YmY3YjQ4"; },
121 [](ClientConfiguration & config)->
void { config.proxyUserName =
"NmU2MWE2NjhlMGEwYTc1NjU1ZDU0OGQw"; },
122 [](ClientConfiguration & config)->
void { config.proxyPassword =
"ZThkYmM1NmQwMWU1MTU1MDQ4YTA5NDFk"; },
123 [](ClientConfiguration & config)->
void { config.caPath =
"ZWM4Mzk1MTFiM2MyOTE2NzA0MThjMTYw"; },
124 [](ClientConfiguration & config)->
void { config.caFile =
"YzU5OGQzNmYzNWIzMjIzNDFlZDM3NGNh"; },
125 [](ClientConfiguration & config)->
void { config.requestTimeoutMs = config.requestTimeoutMs + 12; },
126 [](ClientConfiguration & config)->
void { config.connectTimeoutMs = config.connectTimeoutMs - 42; },
127 [](ClientConfiguration & config)->
void { config.maxConnections = config.maxConnections + 1981; },
128 [](ClientConfiguration & config)->
void { config.proxyPort = config.proxyPort + 2; },
129 [](ClientConfiguration & config)->
void { config.useDualStack = ! config.useDualStack; },
130 [](ClientConfiguration & config)->
void { config.enableClockSkewAdjustment = ! config.enableClockSkewAdjustment; },
131 [](ClientConfiguration & config)->
void { config.followRedirects = !config.followRedirects; },
132 [](ClientConfiguration & config)->
void { config.verifySSL = !config.verifySSL; }
135 TestClientConfigurationOperators,
140 int main(
int argc,
char ** argv)
142 testing::InitGoogleTest(&argc, argv);
143 return RUN_ALL_TESTS();
std::function< void(ClientConfiguration &)> client_conf_mutator
TEST_P(ClientConfigurationOperatorsFixture, TestClientConfigurationEqNeqOperators)
int main(int argc, char **argv)
AwsError
Defines error return codes for functions This enum defines standard error codes that will be returned...
TEST_F(ClientConfigurationProviderFixture, TestReaderRespected)
INSTANTIATE_TEST_CASE_P(TestClientConfigurationOperators, ClientConfigurationOperatorsFixture,::testing::ValuesIn(g_client_conf_mutators))
client_conf_mutator g_client_conf_mutators[]