| 1 | /* |
| 2 | * |
| 3 | Copyright (c) 2017, 2026, Oracle and/or its affiliates. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License, version 2.0, |
| 7 | * as published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is designed to work with certain software (including |
| 10 | * but not limited to OpenSSL) that is licensed under separate terms, |
| 11 | * as designated in a particular file or component or in included license |
| 12 | * documentation. The authors of MySQL hereby grant you an additional |
| 13 | * permission to link the program and your derivative works with the |
| 14 | * separately licensed software that they have either included with |
| 15 | * the program or referenced in the documentation. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License, version 2.0, for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 | */ |
| 26 | |
| 27 | #include <gtest/gtest.h> |
| 28 | #include <memory> |
| 29 | |
| 30 | #include "unittest/gunit/xplugin/xcl/session_t.h" |
| 31 | |
| 32 | namespace xcl { |
| 33 | namespace test { |
| 34 | |
| 35 | TEST_F(Xcl_session_impl_tests, xsession_set_capability_successful) { |
| 36 | const bool value_bool = true; |
| 37 | const Argument_uobject value_object; |
| 38 | |
| 39 | ASSERT_FALSE(m_sut->set_capability( |
| 40 | XSession::Capability_can_handle_expired_password, value_bool)); |
| 41 | |
| 42 | ASSERT_FALSE(m_sut->set_capability(XSession::Capability_session_connect_attrs, |
| 43 | value_object)); |
| 44 | } |
| 45 | |
| 46 | TEST_F(Xcl_session_impl_tests, xsession_set_capability_unsuccessful) { |
| 47 | const char *value_pchar = "pchar"; |
| 48 | const std::string value_string = "std::string"; |
| 49 | const int64_t value_int = 10; |
| 50 | const Argument_uobject value_object; |
| 51 | const bool value_bool = true; |
| 52 | |
| 53 | ASSERT_TRUE(m_sut->set_capability( |
| 54 | XSession::Capability_can_handle_expired_password, value_pchar)); |
| 55 | ASSERT_TRUE(m_sut->set_capability( |
| 56 | XSession::Capability_can_handle_expired_password, value_string)); |
| 57 | ASSERT_TRUE(m_sut->set_capability( |
| 58 | XSession::Capability_can_handle_expired_password, value_int)); |
| 59 | ASSERT_TRUE(m_sut->set_capability( |
| 60 | XSession::Capability_can_handle_expired_password, value_object)); |
| 61 | |
| 62 | ASSERT_TRUE(m_sut->set_capability(XSession::Capability_session_connect_attrs, |
| 63 | value_pchar)); |
| 64 | ASSERT_TRUE(m_sut->set_capability(XSession::Capability_session_connect_attrs, |
| 65 | value_string)); |
| 66 | ASSERT_TRUE(m_sut->set_capability(XSession::Capability_session_connect_attrs, |
| 67 | value_int)); |
| 68 | ASSERT_TRUE(m_sut->set_capability(XSession::Capability_session_connect_attrs, |
| 69 | value_bool)); |
| 70 | } |
| 71 | |
| 72 | } // namespace test |
| 73 | } // namespace xcl |