#define BOOST_TEST_MODULE Recording #include #include #include #include #include #include #include #include "mockDevices.h" #include "mockScheduler.h" #include #include #include #include #include "mockDefs.h" #include #include "chronoHelpers.h" #include "serviceStreamer.h" #include "temporaryIceAdapterObject.h" #include using namespace P2PVR; using namespace P2PVR::Testing; namespace P2PVR { namespace Testing { class TestService : public StandardMockDatabase { public: TestService() { replace("Devices", std::make_shared(ic)); replace("Schedules", std::make_shared()); } }; 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(); TemporaryIceAdapterObject targetPrx(getAdapter(), target); BOOST_TEST_CHECKPOINT("Create service streamer"); auto ss = std::make_shared(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();