Andrew Geissler | b04f033 | 2019-02-08 14:07:56 -0600 | [diff] [blame] | 1 | #include "src/associations.hpp" |
| 2 | |
| 3 | #include <sdbusplus/asio/connection.hpp> |
| 4 | #include <sdbusplus/asio/object_server.hpp> |
| 5 | |
| 6 | #include <gtest/gtest.h> |
| 7 | /** @class AsioServerClassTest |
| 8 | * |
| 9 | * @brief Provide wrapper for creating asio::object_server for test suite |
| 10 | */ |
| 11 | class AsioServerClassTest : public testing::Test |
| 12 | { |
| 13 | protected: |
| 14 | // Make this global to the whole test suite since we want to share |
| 15 | // the asio::object_server accross the test cases |
| 16 | // NOTE - latest googltest changed to SetUpTestSuite() |
| 17 | static void SetUpTestCase() |
| 18 | { |
| 19 | boost::asio::io_context io; |
| 20 | auto conn = std::make_shared<sdbusplus::asio::connection>(io); |
| 21 | |
| 22 | conn->request_name("xyz.openbmc_project.ObjMgr.Test"); |
| 23 | server = new sdbusplus::asio::object_server(conn); |
| 24 | } |
| 25 | |
| 26 | // NOTE - latest googltest changed to TearDownTestSuite() |
| 27 | static void TearDownTestCase() |
| 28 | { |
| 29 | delete server; |
| 30 | server = nullptr; |
| 31 | } |
| 32 | |
| 33 | static sdbusplus::asio::object_server* server; |
| 34 | }; |