mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-20 05:56:05 -04:00
group sync unit test now working
added to .pro file git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7280 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ef8f48ae73
commit
4907d29156
@ -55,5 +55,6 @@ bool rs_nxs_test::RsNxsSimpleDummyReputation::loadReputation(const RsGxsId& id,
|
||||
|
||||
bool rs_nxs_test::RsNxsSimpleDummyReputation::getReputation(const RsGxsId& id,
|
||||
GixsReputation& rep) {
|
||||
rep.score = 5;
|
||||
return true;
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ NxsGrpSync::NxsGrpSync()
|
||||
RsGxsGrpMetaData* meta = new RsGxsGrpMetaData();
|
||||
init_item(meta);
|
||||
grp->metaData = meta;
|
||||
meta->mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED;
|
||||
RsNxsGrp* grp_copy = grp->clone();
|
||||
|
||||
|
||||
|
@ -188,9 +188,9 @@ void rs_nxs_test::NxsTestHub::Wait(int seconds) {
|
||||
|
||||
bool rs_nxs_test::NxsTestHub::recvItem(RsRawItem* item, const RsPeerId& peerFrom)
|
||||
{
|
||||
RsPeerId id = item->PeerId();
|
||||
item->PeerId(peerFrom);
|
||||
return mPeerNxsMap[id]->recv(item); //
|
||||
PayLoad p(peerFrom, item);
|
||||
mPayLoad.push(p);
|
||||
return true;
|
||||
}
|
||||
|
||||
void rs_nxs_test::NxsTestHub::tick()
|
||||
@ -199,6 +199,20 @@ void rs_nxs_test::NxsTestHub::tick()
|
||||
|
||||
PeerNxsMap::iterator it = mPeerNxsMap.begin();
|
||||
|
||||
// deliver payloads to peer's net services
|
||||
while(!mPayLoad.empty())
|
||||
{
|
||||
PayLoad& p = mPayLoad.front();
|
||||
|
||||
RsRawItem* item = p.second;
|
||||
RsPeerId peerFrom = p.first;
|
||||
RsPeerId peerTo = item->PeerId();
|
||||
item->PeerId(peerFrom);
|
||||
mPeerNxsMap[peerTo]->recv(item); //
|
||||
mPayLoad.pop();
|
||||
}
|
||||
|
||||
// then tick net services
|
||||
for(; it != mPeerNxsMap.end(); it++)
|
||||
{
|
||||
RsGxsNetService::pointer s = it->second;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "util/rsthreads.h"
|
||||
#include "gxs/rsgxsnetservice.h"
|
||||
#include "nxstestscenario.h"
|
||||
#include <queue>
|
||||
|
||||
// it would probably be useful if the test scenario
|
||||
// provided the net dummy managers
|
||||
@ -96,9 +97,12 @@ namespace rs_nxs_test
|
||||
|
||||
private:
|
||||
|
||||
typedef std::pair<RsPeerId, RsRawItem*> PayLoad;
|
||||
|
||||
typedef std::map<RsPeerId, RsGxsNetService::pointer > PeerNxsMap ;
|
||||
PeerNxsMap mPeerNxsMap;
|
||||
NxsTestScenario::pointer mTestScenario;
|
||||
std::queue<PayLoad> mPayLoad;
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -260,12 +260,17 @@ HEADERS += libretroshare/gxs/common/data_support.h \
|
||||
|
||||
SOURCES += libretroshare/gxs/common/data_support.cc \
|
||||
|
||||
#HEADERS += libretroshare/gxs/nxs_test/nxstesthub.h \
|
||||
# libretroshare/gxs/nxs_test/nxstestscenario.h \
|
||||
#
|
||||
#SOURCES += libretroshare/gxs/nxs_test/nxstesthub.cc \
|
||||
# libretroshare/gxs/nxs_test/nxstestscenario.cc \
|
||||
# libretroshare/gxs/nxs_test/rsgxsnetservice_test.cc \
|
||||
HEADERS += libretroshare/gxs/nxs_test/nxsdummyservices.h \
|
||||
libretroshare/gxs/nxs_test/nxsgrpsync_test.h \
|
||||
libretroshare/gxs/nxs_test/nxsmsgsync_test.h \
|
||||
libretroshare/gxs/nxs_test/nxstesthub.h \
|
||||
libretroshare/gxs/nxs_test/nxstestscenario.h
|
||||
|
||||
SOURCES += libretroshare/gxs/nxs_test/nxsdummyservices.cc \
|
||||
libretroshare/gxs/nxs_test/nxsgrpsync_test.cc \
|
||||
libretroshare/gxs/nxs_test/nxsmsgsync_test.cc \
|
||||
libretroshare/gxs/nxs_test/nxstesthub.cc \
|
||||
libretroshare/gxs/nxs_test/rsgxsnetservice_test.cc
|
||||
|
||||
HEADERS += libretroshare/gxs/gen_exchange/genexchangetester.h \
|
||||
libretroshare/gxs/gen_exchange/gxspublishmsgtest.h \
|
||||
|
Loading…
x
Reference in New Issue
Block a user