Allow overriding DI injected variables in ClientServerTestRunner

Move OATPP_COMPONENT calls to constructor to allow supplying variables without using DI
This commit is contained in:
Michel Wohlert 2023-11-14 13:37:04 -08:00 committed by GitHub
parent 1e5b0c4917
commit d427e200e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,10 +51,18 @@ public:
private:
std::shared_ptr<oatpp::network::Server> m_server;
std::list<std::shared_ptr<ApiController>> m_controllers;
OATPP_COMPONENT(std::shared_ptr<HttpRouter>, m_router);
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, m_connectionProvider);
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ConnectionHandler>, m_connectionHandler);
std::shared_ptr<HttpRouter> m_router;
std::shared_ptr<oatpp::network::ServerConnectionProvider> m_connectionProvider;
std::shared_ptr<oatpp::network::ConnectionHandler> m_connectionHandler;
public:
ClientServerTestRunner(OATPP_COMPONENT(std::shared_ptr<HttpRouter>, router),
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, connectionProvider),
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ConnectionHandler>, connectionHandler))
: m_router(router)
, m_connectionProvider(connectionProvider)
, m_connectionHandler(connectionHandler)
{}
std::shared_ptr<HttpRouter> getRouter() {
return m_router;