blob: 63a54ad148af39fe042612c1a9f4ad28ab26e340 (
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#define BOOST_TEST_MODULE Recording
#include <boost/test/unit_test.hpp>
#include <filesystem>
#include <options.h>
#include <Ice/ObjectAdapter.h>
#include <Ice/Service.h>
#include <maintenance.h>
#include <mockTuner.h>
#include "mockDevices.h"
#include "mockScheduler.h"
#include <si.h>
#include <recordings.h>
#include <linux/dvb/frontend.h>
#include <definedDirs.h>
#include "mockDefs.h"
#include <slicer/db/sqlSelectDeserializer.h>
#include "chronoHelpers.h"
#include "serviceStreamer.h"
#include "temporaryIceAdapterObject.h"
#include <slicer/slicer.h>
using namespace P2PVR;
using namespace P2PVR::Testing;
namespace P2PVR {
namespace Testing {
class TestService : public StandardMockDatabase {
public:
TestService()
{
replace("Devices", std::make_shared<MockDevices>(ic));
replace("Schedules", std::make_shared<MockScheduler>());
}
};
class MockTarget : public RawDataClient {
public:
MockTarget() : bytesReceived(0) { }
bool NewData(const Data data, const Ice::Current &) override
{
bytesReceived += data.size();
return false;
}
unsigned int bytesReceived;
};
}
}
BOOST_GLOBAL_FIXTURE( TestService );
BOOST_FIXTURE_TEST_SUITE( RecordingCore, TestClient );
BOOST_AUTO_TEST_CASE( streamServiceToTarget )
{
BOOST_TEST_CHECKPOINT("Create mock target");
auto target = std::make_shared<MockTarget>();
TemporaryIceAdapterObject<RawDataClient> targetPrx(getAdapter(), target);
BOOST_TEST_CHECKPOINT("Create service streamer");
auto ss = std::make_shared<ServiceStreamer>(4170, targetPrx, devices, si, getAdapter());
BOOST_TEST_CHECKPOINT("Start");
ss->Start();
sleep(8);
BOOST_TEST_CHECKPOINT("Stop");
ss->Stop();
BOOST_REQUIRE_EQUAL(target->bytesReceived, 3111117);
}
BOOST_AUTO_TEST_SUITE_END();
|