blob: 936e3bb3c330846d9f94de125cc1efe9ee8ebd86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#include "config.h"
#include "phosphor-rsyslog-config/server-conf.hpp"
#include <experimental/filesystem>
#include <sdbusplus/bus.hpp>
#include "gmock/gmock.h"
#include <gtest/gtest.h>
namespace phosphor
{
namespace logging
{
namespace test
{
namespace fs = std::experimental::filesystem;
char tmplt[] = "/tmp/logging_test.XXXXXX";
auto bus = sdbusplus::bus::new_default();
fs::path dir(fs::path(mkdtemp(tmplt)));
class MockServer : public phosphor::rsyslog_config::Server
{
public:
MockServer(sdbusplus::bus::bus& bus, const std::string& path,
const char* filePath) :
phosphor::rsyslog_config::Server(bus, path, filePath)
{
}
MOCK_METHOD0(restart, void());
};
class TestRemoteLogging : public testing::Test
{
public:
TestRemoteLogging()
{
configFilePath = std::string(dir.c_str()) + "/server.conf";
config = new MockServer(bus, BUSPATH_REMOTE_LOGGING_CONFIG,
configFilePath.c_str());
}
~TestRemoteLogging()
{
delete config;
}
static void TearDownTestCase()
{
fs::remove_all(dir);
}
MockServer* config;
std::string configFilePath;
};
} // namespace test
} // namespace logging
} // namespace phosphor
|