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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/*
* Test suite for VppRenderer
*
* Copyright (c) 2018 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
#include <boost/test/unit_test.hpp>
#include <opflexagent/test/ModbFixture.h>
#include <vom/stat_reader.hpp>
#include "VppRenderer.hpp"
BOOST_AUTO_TEST_SUITE(VppRenderer_test)
class MockCmdQ : public VOM::HW::cmd_q
{
public:
MockCmdQ() = default;
~MockCmdQ() = default;
};
class MockStatReader : public VOM::stat_reader
{
public:
MockStatReader() = default;
~MockStatReader() = default;
};
class MockVppManager : public VPP::VppManager
{
public:
MockVppManager(Agent &agent,
IdGenerator &idGen,
VOM::HW::cmd_q *q,
VOM::stat_reader *sr)
: VppManager(agent, idGen, q, sr)
{
}
~MockVppManager()
{
}
void
start()
{
std::cout << " starting Mock vpp manager" << std::endl;
}
void
registerModbListeners()
{
std::cout << " registering Mock ModbListeners" << std::endl;
}
void
stop()
{
std::cout << " stopping Mock vpp manager" << std::endl;
}
};
BOOST_FIXTURE_TEST_CASE(vpp, opflexagent::ModbFixture)
{
IdGenerator *idGen = new IdGenerator();
VOM::HW::cmd_q *vppQ = new MockCmdQ();
VOM::stat_reader *vppSR = new MockStatReader();
VPP::VppManager *vppManager =
new MockVppManager(agent, *idGen, vppQ, vppSR);
VPP::VppRenderer vpp(agent, *idGen, vppManager);
vpp.start();
vpp.stop();
}
BOOST_AUTO_TEST_SUITE_END()
|