userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
standalone_client.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <string>
7
#include <vector>
8
9
#include <
userver/dynamic_config/test_helpers.hpp
>
10
#include <
userver/engine/io/sockaddr.hpp
>
11
#include <
userver/testsuite/grpc_control.hpp
>
12
#include <
userver/utils/resource_scopes.hpp
>
13
#include <
userver/utils/statistics/metrics_storage.hpp
>
14
#include <
userver/utils/statistics/storage.hpp
>
15
16
#include <
userver/ugrpc/client/client_factory.hpp
>
17
#include <userver/ugrpc/client/impl/completion_queue_pool.hpp>
18
#include <userver/ugrpc/impl/statistics_storage.hpp>
19
#include <
userver/ugrpc/tests/simple_client_middleware_pipeline.hpp
>
20
21
USERVER_NAMESPACE_BEGIN
22
23
namespace
ugrpc::tests
{
24
30
class
StandaloneClientFactory
final {
31
public
:
34
explicit
StandaloneClientFactory
(
client::ClientFactorySettings
&& client_factory_settings = {});
35
39
template
<
typename
Client>
40
Client
MakeClient
(
const
std::string& endpoint) {
41
return
client_factory_.MakeClient<Client>(
"test"
, endpoint);
42
}
43
45
client::ClientFactory
&
GetClientFactory
() {
return
client_factory_; }
46
47
private
:
48
utils::statistics::Storage
statistics_storage_;
49
utils::statistics::MetricsStoragePtr metrics_storage_;
50
utils::WithResourceScopes<ugrpc::impl::StatisticsStorage>
51
client_statistics_storage_{std::in_place, statistics_storage_, ugrpc::impl::StatisticsDomain::kClient};
52
dynamic_config::StorageMock
config_storage_{
dynamic_config::MakeDefaultStorage
({})};
53
client::impl::CompletionQueuePool completion_queues_{1};
54
testsuite::GrpcControl testsuite_control_{{},
false
};
55
SimpleClientMiddlewarePipeline
simple_client_middleware_pipeline_;
56
client::ClientFactory client_factory_;
57
};
58
60
std::string
MakeIpv6Endpoint
(std::uint16_t port);
61
62
}
// namespace ugrpc::tests
63
64
USERVER_NAMESPACE_END
userver
ugrpc
tests
standalone_client.hpp
Generated on
for userver by
Doxygen
1.17.0