#include <userver/ugrpc/tests/service.hpp>
Sets up a mini gRPC server using the provided service implementations.
Definition at line 29 of file service.hpp.
Public Member Functions | |
ServiceBase (server::ServerConfig &&server_config) | |
ServiceBase (ServiceBase &&)=delete | |
ServiceBase & | operator= (ServiceBase &&)=delete |
void | RegisterService (server::ServiceBase &service) |
void | RegisterService (server::GenericServiceBase &service) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | StartServer (client::ClientFactorySettings &&settings={}) |
void | StopServer () noexcept |
template<typename Client > | |
Client | MakeClient () |
server::Server & | GetServer () noexcept |
void | SetServerMiddlewares (server::Middlewares middlewares) |
Server middlewares can be modified before the first RegisterService call. | |
void | SetClientMiddlewareFactories (client::MiddlewareFactories middleware_factories) |
Client middlewares can be modified before the first RegisterService call. | |
void | ExtendDynamicConfig (const std::vector< dynamic_config::KeyValue > &) |
dynamic_config::Source | GetConfigSource () const |
utils::statistics::Storage & | GetStatisticsStorage () |
void ugrpc::tests::ServiceBase::ExtendDynamicConfig | ( | const std::vector< dynamic_config::KeyValue > & | ) |
Modifies the internal dynamic configs storage. It is used by the server and clients, and is accessible through GetConfigSource. Initially, the configs are filled with compile-time defaults.
dynamic_config::Source ugrpc::tests::ServiceBase::GetConfigSource | ( | ) | const |
|
noexcept |
utils::statistics::Storage & ugrpc::tests::ServiceBase::GetStatisticsStorage | ( | ) |
|
inline |
Definition at line 56 of file service.hpp.
void ugrpc::tests::ServiceBase::RegisterService | ( | server::ServiceBase & | service | ) |
Register a gRPC service implementation. The caller owns the service and should ensure that the services live at least until StopServer is called.
void ugrpc::tests::ServiceBase::StartServer | ( | client::ClientFactorySettings && | settings = {} | ) |
Starts the server and connects a grpc channel to it. Should be called after the services are registered.
|
noexcept |
Should be called before the registered services are destroyed. Should typically be called in the destructor of your gtest fixture.