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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#define BOOST_TEST_MODULE SI
#include <boost/test/unit_test.hpp>
#include <boost/filesystem/operations.hpp>
#include <testOptionsSource.h>
#include <Ice/ObjectAdapter.h>
#include <Ice/Service.h>
#include <maintenance.h>
#include <mockTuner.h>
#include <si.h>
#include <linux/dvb/frontend.h>
#include <definedDirs.h>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/lexical_cast.hpp>
class Core {
public:
Core()
{
int paramCount = 0;
ic = Ice::initialize(paramCount, NULL);
auto adapter = ic->createObjectAdapterWithEndpoints("Adp", "tcp -p 12002");
TestOptionsSource::LoadTestOptions({
{ "common.datasourceRoot", (RootDir / "datasources").string() },
});
adapter->add(new SI(), ic->stringToIdentity("SI"));
adapter->activate();
si = P2PVR::SIPrx::checkedCast(ic->stringToProxy("SI"));
BOOST_REQUIRE(si);
si->ice_ping();
}
~Core()
{
ic->destroy();
}
P2PVR::SIPrx si;
private:
Ice::CommunicatorPtr ic;
};
BOOST_FIXTURE_TEST_SUITE( SiCore, Core )
BOOST_AUTO_TEST_CASE ( si_getEvents )
{
// Get an event known to exist so we can use its uid
auto event = si->GetEvent(23968, 4378);
BOOST_REQUIRE(event);
auto events = si->GetEvents({ event->EventUid });
BOOST_REQUIRE_EQUAL(events.size(), 1);
BOOST_REQUIRE_EQUAL(events.front()->ServiceId, 23968);
BOOST_REQUIRE_EQUAL(events.front()->EventId, 4378);
}
BOOST_AUTO_TEST_CASE ( si_getEvents_missing )
{
BOOST_REQUIRE_THROW(si->GetEvents({ 0 }), P2PVR::NotFound);
}
BOOST_AUTO_TEST_CASE( si_getEvent )
{
auto event = si->GetEvent(23968, 4378);
BOOST_REQUIRE(event);
BOOST_REQUIRE_EQUAL(event->Title, "Timothy Goes to School");
BOOST_REQUIRE_EQUAL(event->Current, true);
}
BOOST_AUTO_TEST_CASE( si_getEventsOnNow )
{
si->EventsOnNow();
}
BOOST_AUTO_TEST_CASE( si_getEventsInSched )
{
si->EventsInSchedule(0);
}
BOOST_AUTO_TEST_CASE( si_getEventsInScheds )
{
si->EventsInSchedules();
}
BOOST_AUTO_TEST_CASE( si_getEventsInRange )
{
si->EventsInRange(Common::DateTime {2014, 12, 19, 3, 0}, Common::DateTime {2014, 12, 20, 3, 0});
}
BOOST_AUTO_TEST_CASE( si_getEventSearch )
{
si->EventSearch("Top Gear", IceUtil::Optional< ::Ice::Int >(),
IceUtil::Optional<Common::DateTime>(), IceUtil::Optional<Common::DateTime>());
si->EventSearch("Top Gear", 22272,
IceUtil::Optional<Common::DateTime>(), IceUtil::Optional<Common::DateTime>());
si->EventSearch("Top Gear", 22272,
Common::DateTime {2014, 12, 19, 3, 0}, IceUtil::Optional<Common::DateTime>());
si->EventSearch("Top Gear", 22272,
Common::DateTime {2014, 12, 19, 3, 0}, Common::DateTime {2014, 12, 20, 3, 0});
}
BOOST_AUTO_TEST_SUITE_END()
|