diff --git a/libretroshare/src/tests/ft/Makefile b/libretroshare/src/tests/ft/Makefile index ecb41d625..735b1da9f 100644 --- a/libretroshare/src/tests/ft/Makefile +++ b/libretroshare/src/tests/ft/Makefile @@ -7,15 +7,16 @@ RS_TOP_DIR = ../.. include $(RS_TOP_DIR)/tests/scripts/config.mk ############################################################### -TESTOBJ = ftfileprovidertest.o ftfilecreatortest.o ftextralisttest.o ftdataplextest.o fttransfermoduletest.o ftcrc32test.o -#ftserver1test.o ftserver2test.o ftserver3test.o +TESTOBJ = ftfileprovidertest.o ftfilecreatortest.o ftextralisttest.o ftdataplextest.o fttransfermoduletest.o ftcrc32test.o ftcontrollertest.o ftserver1test.o ftserver2test.o ftserver3test.o -TESTS = ftfileprovidertest ftfilecreatortest ftextralisttest ftdataplextest fttransfermoduletest ftcrc32test -#ftserver1test ftserver2test fttransfermoduletest ftserver3test +TESTS = ftfileprovidertest ftfilecreatortest ftextralisttest ftdataplextest fttransfermoduletest ftcrc32test ftcontrollertest ftserver1test ftserver2test fttransfermoduletest ftserver3test all: tests +ftcontrollertest : ftcontrollertest.o + $(CC) $(CFLAGS) -o ftcontrollertest ftcontrollertest.o $(LIBS) + ftfilecreatortest : ftfilecreatortest.o $(CC) $(CFLAGS) -o ftfilecreatortest ftfilecreatortest.o $(LIBS) diff --git a/libretroshare/src/tests/ft/ftcontrollertest.cc b/libretroshare/src/tests/ft/ftcontrollertest.cc index 66b0ddbec..391bc3cd4 100644 --- a/libretroshare/src/tests/ft/ftcontrollertest.cc +++ b/libretroshare/src/tests/ft/ftcontrollertest.cc @@ -27,6 +27,7 @@ * ftServer2Test - Demonstrates how to check for test stuff. */ +#include "retroshare/rsfiles.h" #include "ft/ftserver.h" #include "ft/ftextralist.h" @@ -38,7 +39,7 @@ #include "util/rsdebug.h" -#include "ft/pqitestor.h" +#include "pqitestor.h" #include "util/rsdir.h" #include "util/utest.h" @@ -73,7 +74,7 @@ int main(int argc, char **argv) bool debugStderr = true; bool loadAll = false; - std::list fileList; + std::list fileList; std::list extraList; std::list peerIds; std::map mFtServers; @@ -120,7 +121,13 @@ int main(int argc, char **argv) for(; optind < argc; optind++) { std::cerr << "Adding: " << argv[optind] << std::endl; - fileList.push_back(std::string(argv[optind])); + + SharedDirInfo info ; + info.shareflags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ; + info.filename = std::string(argv[optind]); + info.virtualname = info.filename ; + + fileList.push_back(info) ; } /* We need to setup a series 2 - 4 different ftServers.... @@ -136,7 +143,7 @@ int main(int argc, char **argv) std::list baseFriendList, friendList; std::list::iterator fit; - P3Hub *testHub = new P3Hub(); + P3Hub *testHub = new P3Hub(0,NULL); testHub->start(); /* Setup Base Friend Info */ @@ -191,7 +198,7 @@ int main(int argc, char **argv) /* add server */ ftServer *server; - server = new ftServer(authMgr, connMgr); + server = new ftServer(connMgr); mFtServers[*it] = server; if (!mLoadServer) { @@ -386,7 +393,7 @@ void *do_server_test_thread(void *data) } DirDetails details; - uint32_t flags = DIR_FLAGS_DETAILS | DIR_FLAGS_REMOTE; + flags = DIR_FLAGS_DETAILS | DIR_FLAGS_REMOTE; void *ref = NULL; if(!server->RequestDirDetails(ref,details,flags)) diff --git a/libretroshare/src/tests/ft/ftserver1test.cc b/libretroshare/src/tests/ft/ftserver1test.cc index 406105e52..d8d2f2461 100644 --- a/libretroshare/src/tests/ft/ftserver1test.cc +++ b/libretroshare/src/tests/ft/ftserver1test.cc @@ -44,7 +44,7 @@ #include "util/rsdebug.h" -#include "ft/pqitestor.h" +#include "pqitestor.h" #include "util/rsdir.h" #include diff --git a/libretroshare/src/tests/ft/ftserver2test.cc b/libretroshare/src/tests/ft/ftserver2test.cc index db58aab9a..173da6e1b 100644 --- a/libretroshare/src/tests/ft/ftserver2test.cc +++ b/libretroshare/src/tests/ft/ftserver2test.cc @@ -33,6 +33,7 @@ #endif +#include "retroshare/rsfiles.h" #include "ft/ftserver.h" #include "ft/ftextralist.h" @@ -44,7 +45,7 @@ #include "util/rsdebug.h" -#include "ft/pqitestor.h" +#include "pqitestor.h" #include "util/rsdir.h" #include "util/utest.h" @@ -79,7 +80,7 @@ int main(int argc, char **argv) bool debugStderr = true; bool loadAll = false; - std::list fileList; + std::list fileList; std::list extraList; std::list peerIds; std::map mFtServers; @@ -149,7 +150,11 @@ int main(int argc, char **argv) for(; optind < argc; optind++) { std::cerr << "Adding: " << argv[optind] << std::endl; - fileList.push_back(std::string(argv[optind])); + SharedDirInfo info ; + info.shareflag = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ; + info.filename = string(argv[optind]); + info.virtualname = string(argv[optind]); + fileList.push_back(info) ; } /* We need to setup a series 2 - 4 different ftServers.... diff --git a/libretroshare/src/tests/ft/ftserver3test.cc b/libretroshare/src/tests/ft/ftserver3test.cc index f46497c23..f7110a967 100644 --- a/libretroshare/src/tests/ft/ftserver3test.cc +++ b/libretroshare/src/tests/ft/ftserver3test.cc @@ -50,7 +50,7 @@ #include "util/rsdebug.h" -#include "ft/pqitestor.h" +#include "pqitestor.h" #include "util/rsdir.h" #include "util/utest.h" @@ -86,7 +86,7 @@ int main(int argc, char **argv) bool loadAll = false; bool loadOthers = false; - std::list fileList; + std::list fileList; std::list extraList; std::list peerIds; std::map mFtServers; @@ -159,7 +159,13 @@ int main(int argc, char **argv) for(; optind < argc; optind++) { std::cerr << "Adding: " << argv[optind] << std::endl; - fileList.push_back(std::string(argv[optind])); + + SharedDirInfo info ; + info.filename = std::string(argv[optind]); + info.virtualname = info.filename ; + info.shareflags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ; + + fileList.push_back(info) ; } /* We need to setup a series 2 - 4 different ftServers.... @@ -386,10 +392,10 @@ void *do_server_test_thread(void *data) SizeExpression se(Smaller, minFileSize); Expression *expr = &se; - std::list results; - std::list::iterator it; + std::list results; + std::list::iterator it; - oServer->SearchBoolExp(expr, results); + oServer->SearchBoolExp(expr, results, RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE); if (results.size() < 1) { @@ -400,10 +406,9 @@ void *do_server_test_thread(void *data) } /* find the first remote entry */ - FileDetail sFile; + DirDetails sFile; bool foundFile = false; - for(it = results.begin(); - (it != results.end()); it++) + for(it = results.begin(); (it != results.end()); it++) { std::cerr << "Shared File: " << it->name; std::cerr << std::endl; diff --git a/libretroshare/src/tests/ft/pqitestor.h b/libretroshare/src/tests/ft/pqitestor.h index 0c445acbd..d06cb66b2 100644 --- a/libretroshare/src/tests/ft/pqitestor.h +++ b/libretroshare/src/tests/ft/pqitestor.h @@ -108,44 +108,53 @@ private: class P3Pipe: public P3Interface { -public: - P3Pipe() {return; } -virtual ~P3Pipe() {return; } + public: + P3Pipe() {return; } + virtual ~P3Pipe() {return; } -virtual int tick() { return 1; } -virtual int status() { return 1; } + virtual int tick() { return 1; } + virtual int status() { return 1; } - /* Overloaded from P3Interface */ -virtual int SearchSpecific(RsCacheRequest *item); -virtual int SendSearchResult(RsCacheItem *item); -virtual int SendFileRequest(RsFileRequest *item); -virtual int SendFileData(RsFileData *item); -virtual int SendRsRawItem(RsRawItem *item); + /* Overloaded from P3Interface */ + virtual int SearchSpecific(RsCacheRequest *item); + virtual int SendSearchResult(RsCacheItem *item); + virtual int SendFileRequest(RsFileRequest *item); + virtual int SendFileData(RsFileData *item); + virtual int SendRsRawItem(RsRawItem *item); -virtual RsCacheRequest *RequestedSearch(); -virtual RsCacheItem *GetSearchResult(); -virtual RsFileRequest *GetFileRequest(); -virtual RsFileData *GetFileData(); -virtual RsRawItem *GetRsRawItem(); + virtual RsCacheRequest *RequestedSearch(); + virtual RsCacheItem *GetSearchResult(); + virtual RsFileRequest *GetFileRequest(); + virtual RsFileData *GetFileData(); + virtual RsRawItem *GetRsRawItem(); - /* Lower Interface for PQIHub */ + virtual RsFileChunkMapRequest* GetFileChunkMapRequest() ; + virtual int SendFileChunkMapRequest(RsFileChunkMapRequest*) ; + virtual RsFileChunkMap* GetFileChunkMap() ; + virtual int SendFileChunkMap(RsFileChunkMap*) ; + virtual RsFileCRC32MapRequest* GetFileCRC32MapRequest() ; + virtual int SendFileCRC32MapRequest(RsFileCRC32MapRequest*) ; + virtual RsFileCRC32Map* GetFileCRC32Map() ; + virtual int SendFileCRC32Map(RsFileCRC32Map*) ; -RsItem *PopSentItem(); -int PushRecvdItem(RsItem *item); + /* Lower Interface for PQIHub */ + + RsItem *PopSentItem(); + int PushRecvdItem(RsItem *item); private: -int SendAllItem(RsItem *item); + int SendAllItem(RsItem *item); - RsMutex pipeMtx; + RsMutex pipeMtx; - std::list mSentItems; + std::list mSentItems; - std::list mRecvdRsCacheRequests; - std::list mRecvdRsCacheItems; - std::list mRecvdRsFileRequests; - std::list mRecvdRsFileDatas; - std::list mRecvdRsRawItems; + std::list mRecvdRsCacheRequests; + std::list mRecvdRsCacheItems; + std::list mRecvdRsFileRequests; + std::list mRecvdRsFileDatas; + std::list mRecvdRsRawItems; };