#include #include #include #include #include #include #include #include class TestUtils { public: // Creates a random file of the given size at the given place. Useful for file transfer tests. // static bool createRandomFile(const std::string& filename,const uint64_t size) { FILE *f = fopen(filename.c_str(),"wb") ; if(f == NULL) return 0 ; uint32_t S = 5000 ; uint32_t *data = new uint32_t[S] ; for(uint64_t i=0;i::random().toStdString(false); } static std::string createRandomSSLId() { return t_RsGenericIdType<16>::random().toStdString(false); } static std::string createRandomPGPId() { return t_RsGenericIdType<8>::random().toStdString(true); } class DummyAuthGPG: public AuthGPG { public: DummyAuthGPG(const std::string& ownId) :AuthGPG("pgp_pubring.pgp","pgp_secring.pgp","pgp_trustdb.pgp","lock"), mOwnId(ownId) { } virtual std::string getGPGOwnId() { return mOwnId ; } virtual bool isGPGAccepted(const std::string& pgp_id) { return true ; } private: std::string mOwnId ; }; class DummyAuthSSL: public AuthSSLimpl { public: DummyAuthSSL(const std::string& ownId) : mOwnId(ownId) { } virtual std::string OwnId() { return mOwnId ; } private: std::string mOwnId ; }; class DummyRsPeers: public p3Peers { public: DummyRsPeers(p3LinkMgr *lm, p3PeerMgr *pm, p3NetMgr *nm) : p3Peers(lm,pm,nm) {} //virtual bool getFriendList(std::list& fl) { ; return true ;} private: std::list mFriends ; }; };