mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-15 16:49:20 -05:00
Added framework for testing a pair of GXS services.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7272 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6be4a464a5
commit
23f6c405c8
6 changed files with 279 additions and 1 deletions
|
|
@ -0,0 +1,64 @@
|
|||
|
||||
// local
|
||||
#include "GxsPairServiceTester.h"
|
||||
#include "GxsPeerNode.h"
|
||||
#include "gxstestservice.h"
|
||||
|
||||
// libretroshare
|
||||
#include "serialiser/rsnxsitems.h"
|
||||
|
||||
GxsPairServiceTester::GxsPairServiceTester(const RsPeerId &peerId1, const RsPeerId &peerId2, int testMode)
|
||||
:SetServiceTester()
|
||||
{
|
||||
// setup stuff.
|
||||
addSerialType(new RsNxsSerialiser(RS_SERVICE_GXS_TYPE_TEST));
|
||||
|
||||
std::list<RsPeerId> friendList1, friendList2;
|
||||
friendList1.push_back(peerId2);
|
||||
friendList2.push_back(peerId1);
|
||||
|
||||
GxsPeerNode *n1 = new GxsPeerNode(peerId1, friendList1, testMode);
|
||||
GxsPeerNode *n2 = new GxsPeerNode(peerId2, friendList2, testMode);
|
||||
|
||||
addNode(peerId1, n1);
|
||||
addNode(peerId2, n2);
|
||||
|
||||
startup();
|
||||
tick();
|
||||
|
||||
bringOnline(peerId1, friendList1);
|
||||
bringOnline(peerId2, friendList2);
|
||||
}
|
||||
|
||||
|
||||
GxsPairServiceTester::~GxsPairServiceTester()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GxsPeerNode *GxsPairServiceTester::getGxsPeerNode(const RsPeerId &id)
|
||||
{
|
||||
return (GxsPeerNode *) getPeerNode(id);
|
||||
}
|
||||
|
||||
|
||||
void GxsPairServiceTester::createGroup(const RsPeerId &id, const std::string &name)
|
||||
{
|
||||
/* create a couple of groups */
|
||||
GxsTestService *testService = getGxsPeerNode(id)->mTestService;
|
||||
RsTokenService *tokenService = testService->RsGenExchange::getTokenService();
|
||||
|
||||
RsTestGroup grp1;
|
||||
grp1.mMeta.mGroupName = name;
|
||||
grp1.mTestString = "testString";
|
||||
uint32_t token1;
|
||||
|
||||
testService->submitTestGroup(token1, grp1);
|
||||
while(tokenService->requestStatus(token1) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
{
|
||||
tick();
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue