| 1 | /* Copyright (c) 2015, 2026, Oracle and/or its affiliates. |
| 2 | |
| 3 | This program is free software; you can redistribute it and/or modify |
| 4 | it under the terms of the GNU General Public License, version 2.0, |
| 5 | as published by the Free Software Foundation. |
| 6 | |
| 7 | This program is designed to work with certain software (including |
| 8 | but not limited to OpenSSL) that is licensed under separate terms, |
| 9 | as designated in a particular file or component or in included license |
| 10 | documentation. The authors of MySQL hereby grant you an additional |
| 11 | permission to link the program and your derivative works with the |
| 12 | separately licensed software that they have either included with |
| 13 | the program or referenced in the documentation. |
| 14 | |
| 15 | This program is distributed in the hope that it will be useful, |
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | GNU General Public License, version 2.0, for more details. |
| 19 | |
| 20 | You should have received a copy of the GNU General Public License |
| 21 | along with this program; if not, write to the Free Software |
| 22 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
| 23 | |
| 24 | #include <assert.h> |
| 25 | // NOLINT(build/include_subdir) |
| 26 | |
| 27 | #include "mysql/service_srv_session.h" |
| 28 | #include "unittest/gunit/xplugin/xpl/mock/srv_session_services.h" |
| 29 | |
| 30 | namespace mock = xpl::test::mock; |
| 31 | |
| 32 | // Srv_session service |
| 33 | // |
| 34 | |
| 35 | int srv_session_init_thread(const void *plugin) { |
| 36 | if (mock::Srv_session::m_srv_session) |
| 37 | return mock::Srv_session::m_srv_session->init_session_thread(plugin); |
| 38 | |
| 39 | assert(0); |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | void srv_session_deinit_thread() { |
| 44 | if (mock::Srv_session::m_srv_session) { |
| 45 | mock::Srv_session::m_srv_session->deinit_session_thread(); |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | assert(0); |
| 50 | } |
| 51 | |
| 52 | MYSQL_SESSION srv_session_open(srv_session_error_cb error_cb, void *ctxt) { |
| 53 | if (mock::Srv_session::m_srv_session) |
| 54 | return mock::Srv_session::m_srv_session->open_session(error_cb, ctxt); |
| 55 | |
| 56 | assert(0); |
| 57 | return nullptr; |
| 58 | } |
| 59 | |
| 60 | int srv_session_close(MYSQL_SESSION session) { |
| 61 | if (mock::Srv_session::m_srv_session) |
| 62 | return mock::Srv_session::m_srv_session->close_session(session); |
| 63 | |
| 64 | assert(0); |
| 65 | return 0; |
| 66 | } |
| 67 | |
| 68 | int srv_session_detach(MYSQL_SESSION session) { |
| 69 | if (mock::Srv_session::m_srv_session) |
| 70 | return mock::Srv_session::m_srv_session->detach_session(session); |
| 71 | |
| 72 | assert(0); |
| 73 | return 0; |
| 74 | } |
| 75 | |
| 76 | int srv_session_attach(MYSQL_SESSION session, MYSQL_THD *old_thd) { |
| 77 | if (mock::Srv_session::m_srv_session) |
| 78 | return mock::Srv_session::m_srv_session->attach_session(session, old_thd); |
| 79 | |
| 80 | assert(0); |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | int srv_session_server_is_available() { |
| 85 | if (mock::Srv_session::m_srv_session) |
| 86 | return mock::Srv_session::m_srv_session->server_is_available(); |
| 87 | |
| 88 | assert(0); |
| 89 | return 0; |
| 90 | } |
| 91 | |
| 92 | // Srv_session info service |
| 93 | // |
| 94 | |
| 95 | MYSQL_THD srv_session_info_get_thd(MYSQL_SESSION) { |
| 96 | assert(0); |
| 97 | return nullptr; |
| 98 | } |
| 99 | |
| 100 | my_thread_id srv_session_info_get_session_id(MYSQL_SESSION session) { |
| 101 | if (mock::Srv_session_info::m_srv_session_info) |
| 102 | return mock::Srv_session_info::m_srv_session_info->get_session_id(session); |
| 103 | |
| 104 | assert(0); |
| 105 | return 0; |
| 106 | } |
| 107 | |
| 108 | int srv_session_info_set_client_port(Srv_session *, uint16_t) { |
| 109 | assert(0); |
| 110 | return 0; |
| 111 | } |
| 112 | |
| 113 | int srv_session_info_set_connection_type(Srv_session *, enum_vio_type) { |
| 114 | assert(0); |
| 115 | return 0; |
| 116 | } |
| 117 | |
| 118 | int srv_session_info_killed(MYSQL_SESSION) { |
| 119 | assert(0); |
| 120 | return 0; |
| 121 | } |