fixed ftcontrollertest. runs correctly now

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6037 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-12-26 20:17:44 +00:00
parent 4e586c84ba
commit 4756711f10
2 changed files with 21 additions and 1 deletions

View File

@ -30,6 +30,7 @@
#include "retroshare/rsfiles.h" #include "retroshare/rsfiles.h"
#include "retroshare/rspeers.h" #include "retroshare/rspeers.h"
#include "retroshare/rsiface.h" #include "retroshare/rsiface.h"
#include "rsserver/p3peers.h"
#include "ft/ftserver.h" #include "ft/ftserver.h"
#include "ft/ftextralist.h" #include "ft/ftextralist.h"
@ -91,6 +92,17 @@ class FakeSSL: public AuthSSLimpl
std::string mOwnId ; std::string mOwnId ;
}; };
class FakeRsPeers: public p3Peers
{
public:
FakeRsPeers(p3LinkMgr *lm, p3PeerMgr *pm, p3NetMgr *nm) : p3Peers(lm,pm,nm) {}
virtual bool getFriendList(std::list<std::string>& fl) { fl = mFriends ; return true ;}
private:
std::list<std::string> mFriends ;
};
class TestData class TestData
{ {
public: public:
@ -246,10 +258,13 @@ int main(int argc, char **argv)
//p3AuthMgr *authMgr = new p3DummyAuthMgr(*it, friendList); //p3AuthMgr *authMgr = new p3DummyAuthMgr(*it, friendList);
p3PeerMgrIMPL *peerMgr = new p3PeerMgrIMPL(ssl_own_id,gpg_own_id,"My GPG name","My SSL location"); p3PeerMgrIMPL *peerMgr = new p3PeerMgrIMPL(ssl_own_id,gpg_own_id,"My GPG name","My SSL location");
p3NetMgrIMPL *netMgr = new p3NetMgrIMPL ; p3NetMgrIMPL *netMgr = new p3NetMgrIMPL ;
p3LinkMgrIMPL *linkMgr = new p3LinkMgrIMPL(peerMgr,netMgr); p3LinkMgrIMPL *linkMgr = new p3LinkMgrIMPL(peerMgr,netMgr);
mLinkMgrs[*it] = linkMgr; mLinkMgrs[*it] = linkMgr;
rsPeers = new FakeRsPeers(linkMgr,peerMgr,netMgr) ;
for(fit = friendList.begin(); fit != friendList.end(); fit++) for(fit = friendList.begin(); fit != friendList.end(); fit++)
{ {
@ -378,6 +393,8 @@ void *do_server_test_thread(void *data)
std::list<std::string>::iterator eit; std::list<std::string>::iterator eit;
for(eit = mFt->extraList.begin(); eit != mFt->extraList.end(); 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)) while(!mFt->loadServer->ExtraFileStatus(*eit, info))
{ {
@ -396,7 +413,7 @@ void *do_server_test_thread(void *data)
REPORT("Successfully Found ExtraFile"); REPORT("Successfully Found ExtraFile");
/* now we can try a search (should succeed) */ /* now we can try a search (should succeed) */
FileSearchFlags hintflags; FileSearchFlags hintflags = RS_FILE_HINTS_EXTRA;
if (mFt->loadServer->FileDetails(info.hash, hintflags, info2)) if (mFt->loadServer->FileDetails(info.hash, hintflags, info2))
{ {

View File

@ -0,0 +1,3 @@
#!/bin/sh
./ftcontrollertest -p 8cb3a1677872c9e8248fd5ddeac84000 -p 8cb3a1677872c9e8248fd5ddeac84001 -p 8cb3a1677872c9e8248fd5ddeac84002 -e ftcontrollertest .