|
37 | 37 | #include <hazelcast/client/connection/ClientConnectionManagerImpl.h>
|
38 | 38 | #include <hazelcast/client/connection/Connection.h>
|
39 | 39 | #include <hazelcast/client/connection/AddressProvider.h>
|
| 40 | +#include <hazelcast/client/spi/impl/discovery/remote_address_provider.h> |
40 | 41 | #include <hazelcast/client/entry_event.h>
|
41 | 42 | #include <hazelcast/client/exception/protocol_exceptions.h>
|
42 | 43 | #include <hazelcast/client/hazelcast_client.h>
|
@@ -2316,6 +2317,29 @@ TEST_F(connection_manager_translate, default_config_uses_private_addresses)
|
2316 | 2317 | {
|
2317 | 2318 | ASSERT_FALSE(client_config().get_network_config().use_public_address());
|
2318 | 2319 | }
|
| 2320 | + |
| 2321 | +TEST_F( |
| 2322 | + connection_manager_translate, |
| 2323 | + if_remote_adress_provider_cannot_translate_adress_translate_should_throw_an_exception) |
| 2324 | +{ |
| 2325 | + auto client = new_client().get(); |
| 2326 | + spi::ClientContext ctx(client); |
| 2327 | + connection::ClientConnectionManagerImpl connection_manager( |
| 2328 | + ctx, |
| 2329 | + std::unique_ptr<connection::AddressProvider>( |
| 2330 | + new spi::impl::discovery::remote_address_provider{ |
| 2331 | + []() { return std::unordered_map<address, address>{}; }, true })); |
| 2332 | + |
| 2333 | + std::random_device rand{}; |
| 2334 | + member dummy_member( |
| 2335 | + address{ "255.255.255.255", 40000 }, |
| 2336 | + boost::uuids::basic_random_generator<std::random_device>{ rand }(), |
| 2337 | + false, |
| 2338 | + std::unordered_map<std::string, std::string>{}, |
| 2339 | + std::unordered_map<endpoint_qualifier, address>{}); |
| 2340 | + EXPECT_THROW(connection_manager.get_or_connect(dummy_member), |
| 2341 | + exception::hazelcast_); |
| 2342 | +} |
2319 | 2343 | } // namespace test
|
2320 | 2344 | } // namespace client
|
2321 | 2345 | } // namespace hazelcast
|
|
0 commit comments