Skip to content
Snippets Groups Projects
Commit 84c3ce5b authored by George Sedov's avatar George Sedov
Browse files

Add unittests for kafka notifications

parent 6968ea2e
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ namespace {
TEST(RequestDispatcher, Constructor) {
auto stat = std::unique_ptr<ReceiverStatistics> {new ReceiverStatistics};
RequestsDispatcher dispatcher{0, "some_address", stat.get(), nullptr};
RequestsDispatcher dispatcher{0, "some_address", stat.get(), nullptr, nullptr};
ASSERT_THAT(dynamic_cast<const asapo::ReceiverStatistics*>(dispatcher.statistics__), Ne(nullptr));
ASSERT_THAT(dynamic_cast<asapo::IO*>(dispatcher.io__.get()), Ne(nullptr));
ASSERT_THAT(dynamic_cast<asapo::RequestFactory*>(dispatcher.request_factory__.get()), Ne(nullptr));
......@@ -40,7 +40,7 @@ class MockRequest: public Request {
class MockRequestFactory: public asapo::RequestFactory {
public:
MockRequestFactory(): RequestFactory(nullptr) {};
MockRequestFactory(): RequestFactory(nullptr, nullptr) {};
std::unique_ptr<Request> GenerateRequest(const GenericRequestHeader& request_header,
SocketDescriptor socket_fd, std::string origin_uri,
Error* err) const noexcept override {
......@@ -80,7 +80,7 @@ class RequestsDispatcherTests : public Test {
void SetUp() override {
test_config.authorization_interval_ms = 0;
SetReceiverConfig(test_config, "none");
dispatcher = std::unique_ptr<RequestsDispatcher> {new RequestsDispatcher{0, connected_uri, &mock_statictics, nullptr}};
dispatcher = std::unique_ptr<RequestsDispatcher> {new RequestsDispatcher{0, connected_uri, &mock_statictics, nullptr, nullptr}};
dispatcher->io__ = std::unique_ptr<asapo::IO> {&mock_io};
dispatcher->statistics__ = &mock_statictics;
dispatcher->request_factory__ = std::unique_ptr<asapo::RequestFactory> {&mock_factory};
......
......@@ -14,7 +14,7 @@ using namespace asapo;
namespace {
TEST(Connection, Constructor) {
Connection connection{0, "some_address", nullptr, "some_tag"};
Connection connection{0, "some_address", nullptr, nullptr, "some_tag"};
ASSERT_THAT(dynamic_cast<asapo::Statistics*>(connection.statistics__.get()), Ne(nullptr));
ASSERT_THAT(dynamic_cast<asapo::IO*>(connection.io__.get()), Ne(nullptr));
ASSERT_THAT(dynamic_cast<const asapo::AbstractLogger*>(connection.log__), Ne(nullptr));
......@@ -24,7 +24,7 @@ TEST(Connection, Constructor) {
class MockDispatcher: public asapo::RequestsDispatcher {
public:
MockDispatcher(): asapo::RequestsDispatcher(0, "", nullptr, nullptr) {};
MockDispatcher(): asapo::RequestsDispatcher(0, "", nullptr, nullptr, nullptr) {};
Error ProcessRequest(const std::unique_ptr<Request>& request) const noexcept override {
return Error{ProcessRequest_t(request.get())};
}
......@@ -52,7 +52,7 @@ class ConnectionTests : public Test {
std::unique_ptr<Connection> connection;
void SetUp() override {
connection = std::unique_ptr<Connection> {new Connection{0, connected_uri, nullptr, "some_tag"}};
connection = std::unique_ptr<Connection> {new Connection{0, connected_uri, nullptr, nullptr, "some_tag"}};
connection->io__ = std::unique_ptr<asapo::IO> {&mock_io};
connection->statistics__ = std::unique_ptr<asapo::ReceiverStatistics> {&mock_statictics};
connection->log__ = &mock_logger;
......
......@@ -12,7 +12,7 @@ using namespace asapo;
namespace {
TEST(Receiver, Constructor) {
asapo::Receiver receiver(nullptr);
asapo::Receiver receiver(nullptr, nullptr);
ASSERT_THAT(dynamic_cast<const asapo::AbstractLogger*>(receiver.log__), Ne(nullptr));
ASSERT_THAT(dynamic_cast<asapo::IO*>(receiver.io__.get()), Ne(nullptr));
}
......@@ -31,7 +31,7 @@ class StartListenerFixture : public testing::Test {
Error err;
::testing::NiceMock<asapo::MockLogger> mock_logger;
::testing::NiceMock<asapo::MockIO> mock_io;
asapo::Receiver receiver{nullptr};
asapo::Receiver receiver{nullptr, nullptr};
void SetUp() override {
err = nullptr;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment