Debian Codegraph @

unittest/gunit/xplugin/xpl/mock/protocol_encoder.h

raw symbols SCIP
1 /*
2 * Copyright (c) 2020, 2026, Oracle and/or its affiliates.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2.0,
6 * as published by the Free Software Foundation.
7 *
8 * This program is designed to work with certain software (including
9 * but not limited to OpenSSL) that is licensed under separate terms,
10 * as designated in a particular file or component or in included license
11 * documentation. The authors of MySQL hereby grant you an additional
12 * permission to link the program and your derivative works with the
13 * separately licensed software that they have either included with
14 * the program or referenced in the documentation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License, version 2.0, for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26 #ifndef UNITTEST_GUNIT_XPLUGIN_XPL_MOCK_PROTOCOL_ENCODER_H_
27 #define UNITTEST_GUNIT_XPLUGIN_XPL_MOCK_PROTOCOL_ENCODER_H_
28
29 #include <gmock/gmock.h>
30 #include <memory>
31 #include <string>
32 #include <vector>
33
34 #include "plugin/x/src/interface/protocol_encoder.h"
35
36 namespace xpl {
37 namespace test {
38 namespace mock {
39
40 class Protocol_encoder : public iface::Protocol_encoder {
41 public:
42 Protocol_encoder();
43 virtual ~Protocol_encoder() override;
44
45 MOCK_METHOD(bool, is_building_row, (), (const, override));
46 MOCK_METHOD(bool, send_result, (const ngs::Error_code &), (override));
47 MOCK_METHOD(bool, send_ok, (), (override));
48 MOCK_METHOD(bool, send_ok, (const std::string &), (override));
49 MOCK_METHOD(bool, send_notice,
50 (const iface::Frame_type, const iface::Frame_scope,
51 const std::string &, const bool),
52 (override));
53 MOCK_METHOD(void, send_auth_ok, (const std::string &));
54 MOCK_METHOD(void, send_auth_continue, (const std::string &), (override));
55 MOCK_METHOD(bool, send_exec_ok, (), (override));
56 MOCK_METHOD(bool, send_result_fetch_done, (), (override));
57 MOCK_METHOD(bool, send_result_fetch_suspended, (), (override));
58 MOCK_METHOD(bool, send_result_fetch_done_more_results, (), (override));
59 MOCK_METHOD(bool, send_result_fetch_done_more_out_params, (), (override));
60
61 MOCK_METHOD(bool, send_column_metadata,
62 (const ngs::Encode_column_info *column_info), (override));
63 MOCK_METHOD(protocol::XRow_encoder *, row_builder, (), (override));
64 MOCK_METHOD(protocol::XMessage_encoder *, raw_encoder, (), (override));
65 MOCK_METHOD(void, start_row, (), (override));
66 MOCK_METHOD(void, abort_row, (), (override));
67 MOCK_METHOD(bool, send_row, (), (override));
68 MOCK_METHOD(bool, send_protobuf_message,
69 (const uint8_t, const ngs::Message &, bool), (override));
70 MOCK_METHOD(void, on_error, (int error), (override));
71 MOCK_METHOD(iface::Protocol_monitor &, get_protocol_monitor, (), (override));
72 MOCK_METHOD(ngs::Metadata_builder *, get_metadata_builder, (), (override));
73
74 MOCK_METHOD(iface::Protocol_flusher *, get_flusher, (), (override));
75
76 MOCK_METHOD(bool, send_error,
77 (const ngs::Error_code &error_code, const bool init_error),
78 (override));
79
80 MOCK_METHOD(void, send_notice_rows_affected, (const uint64_t value),
81 (override));
82 MOCK_METHOD(void, send_notice_client_id, (const uint64_t id), (override));
83 MOCK_METHOD(void, send_notice_last_insert_id, (const uint64_t id),
84 (override));
85 MOCK_METHOD(void, send_notice_account_expired, (), (override));
86 MOCK_METHOD(void, send_notice_generated_document_ids,
87 (const std::vector<std::string> &ids), (override));
88
89 MOCK_METHOD(void, send_notice_txt_message, (const std::string &message),
90 (override));
91 MOCK_METHOD(iface::Protocol_flusher *, set_flusher_raw,
92 (iface::Protocol_flusher * flusher));
93
94 std::unique_ptr<iface::Protocol_flusher> set_flusher(
95 std::unique_ptr<iface::Protocol_flusher> flusher) override {
96 std::unique_ptr<iface::Protocol_flusher> result{
97 set_flusher_raw(flusher.get())};
98 return result;
99 }
100 };
101
102 } // namespace mock
103 } // namespace test
104 } // namespace xpl
105
106 #endif // UNITTEST_GUNIT_XPLUGIN_XPL_MOCK_PROTOCOL_ENCODER_H_