blob: 34b209575bf3aa261dd7b727362115b25855690e [file] [log] [blame]
Andrew Geisslerb04f0332019-02-08 14:07:56 -06001#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 */
11class 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};