From 4756711f10f0b790edb8c5743f600e73310c2896 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 26 Dec 2012 20:17:44 +0000 Subject: [PATCH] fixed ftcontrollertest. runs correctly now git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6037 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/tests/ft/ftcontrollertest.cc | 19 ++++++++++++++++++- .../src/tests/ft/ftcontrollertest.sh | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 libretroshare/src/tests/ft/ftcontrollertest.sh diff --git a/libretroshare/src/tests/ft/ftcontrollertest.cc b/libretroshare/src/tests/ft/ftcontrollertest.cc index c93e192b3..9568a7ac6 100644 --- a/libretroshare/src/tests/ft/ftcontrollertest.cc +++ b/libretroshare/src/tests/ft/ftcontrollertest.cc @@ -30,6 +30,7 @@ #include "retroshare/rsfiles.h" #include "retroshare/rspeers.h" #include "retroshare/rsiface.h" +#include "rsserver/p3peers.h" #include "ft/ftserver.h" #include "ft/ftextralist.h" @@ -91,6 +92,17 @@ class FakeSSL: public AuthSSLimpl std::string mOwnId ; }; +class FakeRsPeers: public p3Peers +{ + public: + FakeRsPeers(p3LinkMgr *lm, p3PeerMgr *pm, p3NetMgr *nm) : p3Peers(lm,pm,nm) {} + + virtual bool getFriendList(std::list& fl) { fl = mFriends ; return true ;} + + private: + std::list mFriends ; +}; + class TestData { public: @@ -246,10 +258,13 @@ int main(int argc, char **argv) //p3AuthMgr *authMgr = new p3DummyAuthMgr(*it, friendList); p3PeerMgrIMPL *peerMgr = new p3PeerMgrIMPL(ssl_own_id,gpg_own_id,"My GPG name","My SSL location"); + p3NetMgrIMPL *netMgr = new p3NetMgrIMPL ; p3LinkMgrIMPL *linkMgr = new p3LinkMgrIMPL(peerMgr,netMgr); mLinkMgrs[*it] = linkMgr; + rsPeers = new FakeRsPeers(linkMgr,peerMgr,netMgr) ; + for(fit = friendList.begin(); fit != friendList.end(); fit++) { @@ -378,6 +393,8 @@ void *do_server_test_thread(void *data) std::list::iterator eit; for(eit = mFt->extraList.begin(); eit != mFt->extraList.end(); eit++) { + std::cerr << "Treating extra file " << *eit << std::endl; + while(!mFt->loadServer->ExtraFileStatus(*eit, info)) { @@ -396,7 +413,7 @@ void *do_server_test_thread(void *data) REPORT("Successfully Found ExtraFile"); /* now we can try a search (should succeed) */ - FileSearchFlags hintflags; + FileSearchFlags hintflags = RS_FILE_HINTS_EXTRA; if (mFt->loadServer->FileDetails(info.hash, hintflags, info2)) { diff --git a/libretroshare/src/tests/ft/ftcontrollertest.sh b/libretroshare/src/tests/ft/ftcontrollertest.sh new file mode 100755 index 000000000..e4a9d2fa5 --- /dev/null +++ b/libretroshare/src/tests/ft/ftcontrollertest.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +./ftcontrollertest -p 8cb3a1677872c9e8248fd5ddeac84000 -p 8cb3a1677872c9e8248fd5ddeac84001 -p 8cb3a1677872c9e8248fd5ddeac84002 -e ftcontrollertest .