mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 07:59:29 -05:00
Improvements to tests.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7326 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2232e8e583
commit
c945aa18dd
@ -60,30 +60,34 @@ const RsPgpId & FakePgpAuxUtils::getPGPOwnId()
|
|||||||
|
|
||||||
RsPgpId FakePgpAuxUtils::getPGPId(const RsPeerId& sslid)
|
RsPgpId FakePgpAuxUtils::getPGPId(const RsPeerId& sslid)
|
||||||
{
|
{
|
||||||
std::cerr << "FakePgpAuxUtils::getPGPId()";
|
|
||||||
/* convert an sslId */
|
/* convert an sslId */
|
||||||
std::string idstring = sslid.toStdString();
|
std::string idstring = sslid.toStdString();
|
||||||
idstring.resize(RsPgpId::SIZE_IN_BYTES*2, '0');
|
idstring.resize(RsPgpId::SIZE_IN_BYTES*2, '0');
|
||||||
RsPgpId pgpId(idstring);
|
RsPgpId pgpId(idstring);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
std::cerr << "FakePgpAuxUtils::getPGPId()";
|
||||||
std::cerr << " RsPeerId: " << sslid.toStdString();
|
std::cerr << " RsPeerId: " << sslid.toStdString();
|
||||||
std::cerr << " RsPgpId: " << pgpId.toStdString();
|
std::cerr << " RsPgpId: " << pgpId.toStdString();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
return pgpId;
|
return pgpId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FakePgpAuxUtils::getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const
|
bool FakePgpAuxUtils::getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const
|
||||||
{
|
{
|
||||||
std::cerr << "FakePgpAuxUtils::getKeyFingerprint()";
|
|
||||||
/* convert an sslId */
|
/* convert an sslId */
|
||||||
std::string idstring = id.toStdString();
|
std::string idstring = id.toStdString();
|
||||||
idstring.resize(PGPFingerprintType::SIZE_IN_BYTES*2, '0');
|
idstring.resize(PGPFingerprintType::SIZE_IN_BYTES*2, '0');
|
||||||
PGPFingerprintType pgpfp(idstring);
|
PGPFingerprintType pgpfp(idstring);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
std::cerr << "FakePgpAuxUtils::getKeyFingerprint()";
|
||||||
std::cerr << " RsPeerId: " << id.toStdString();
|
std::cerr << " RsPeerId: " << id.toStdString();
|
||||||
std::cerr << " RsPgpId: " << pgpfp.toStdString();
|
std::cerr << " RsPgpId: " << pgpfp.toStdString();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
fp = pgpfp;
|
fp = pgpfp;
|
||||||
return true;
|
return true;
|
||||||
|
@ -13,6 +13,12 @@
|
|||||||
#include "FakePgpAuxUtils.h"
|
#include "FakePgpAuxUtils.h"
|
||||||
#include "gxstestservice.h"
|
#include "gxstestservice.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USER_NETSERVICE_WRAPPER
|
||||||
|
#include "RsGxsNetServiceTester.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
GxsPeerNode::GxsPeerNode(const RsPeerId &ownId, const std::list<RsPeerId> &friends, int testMode, bool useIdentityService)
|
GxsPeerNode::GxsPeerNode(const RsPeerId &ownId, const std::list<RsPeerId> &friends, int testMode, bool useIdentityService)
|
||||||
:PeerNode(ownId, friends, false),
|
:PeerNode(ownId, friends, false),
|
||||||
mUseIdentityService(useIdentityService),
|
mUseIdentityService(useIdentityService),
|
||||||
@ -62,12 +68,16 @@ GxsPeerNode::GxsPeerNode(const RsPeerId &ownId, const std::list<RsPeerId> &frien
|
|||||||
mGxsIdService, mGxsCircles,
|
mGxsIdService, mGxsCircles,
|
||||||
mPgpAuxUtils,
|
mPgpAuxUtils,
|
||||||
false); // don't synchronise group automatic (need explicit group request)
|
false); // don't synchronise group automatic (need explicit group request)
|
||||||
|
|
||||||
mGxsIdService->setNes(mGxsIdNs);
|
mGxsIdService->setNes(mGxsIdNs);
|
||||||
/**** GxsCircle service ****/
|
/**** GxsCircle service ****/
|
||||||
|
|
||||||
mGxsCirclesNs = new RsGxsNetService(
|
#ifdef USER_NETSERVICE_WRAPPER
|
||||||
RS_SERVICE_GXS_TYPE_GXSCIRCLE, mGxsCirclesDs, nxsMgr,
|
mGxsCirclesNs = new RsGxsNetServiceTester
|
||||||
|
#else
|
||||||
|
mGxsCirclesNs = new RsGxsNetService
|
||||||
|
#endif
|
||||||
|
(RS_SERVICE_GXS_TYPE_GXSCIRCLE, mGxsCirclesDs, nxsMgr,
|
||||||
mGxsCircles, mGxsCircles->getServiceInfo(),
|
mGxsCircles, mGxsCircles->getServiceInfo(),
|
||||||
mGxsIdService, mGxsCircles,
|
mGxsIdService, mGxsCircles,
|
||||||
mPgpAuxUtils);
|
mPgpAuxUtils);
|
||||||
@ -88,8 +98,12 @@ GxsPeerNode::GxsPeerNode(const RsPeerId &ownId, const std::list<RsPeerId> &frien
|
|||||||
|
|
||||||
mTestService = new GxsTestService(mTestDs, NULL, mGxsIdService, testMode);
|
mTestService = new GxsTestService(mTestDs, NULL, mGxsIdService, testMode);
|
||||||
|
|
||||||
mTestNs = new RsGxsNetService(
|
#ifdef USER_NETSERVICE_WRAPPER
|
||||||
RS_SERVICE_GXS_TYPE_TEST, mTestDs, nxsMgr,
|
mTestNs = new RsGxsNetServiceTester
|
||||||
|
#else
|
||||||
|
mTestNs = new RsGxsNetService
|
||||||
|
#endif
|
||||||
|
(RS_SERVICE_GXS_TYPE_TEST, mTestDs, nxsMgr,
|
||||||
mTestService, mTestService->getServiceInfo(),
|
mTestService, mTestService->getServiceInfo(),
|
||||||
mGxsIdService, mGxsCircles,
|
mGxsIdService, mGxsCircles,
|
||||||
mPgpAuxUtils);
|
mPgpAuxUtils);
|
||||||
@ -149,7 +163,30 @@ GxsPeerNode::~GxsPeerNode()
|
|||||||
RsDirUtil::cleanupDirectory(mGxsDir, filesToKeep);
|
RsDirUtil::cleanupDirectory(mGxsDir, filesToKeep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GxsPeerNode::checkTestServiceAllowedGroups(const RsPeerId &peerId)
|
||||||
|
{
|
||||||
|
#ifdef USER_NETSERVICE_WRAPPER
|
||||||
|
std::vector<RsGxsGroupId> groups;
|
||||||
|
return ((RsGxsNetServiceTester *) mTestNs)->fetchAllowedGroups(peerId, groups);
|
||||||
|
#else
|
||||||
|
std::cerr << "GxsPeerNode::checkTestServiceAllowedGroups() not available";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GxsPeerNode::checkCircleServiceAllowedGroups(const RsPeerId &peerId)
|
||||||
|
{
|
||||||
|
#ifdef USER_NETSERVICE_WRAPPER
|
||||||
|
std::vector<RsGxsGroupId> groups;
|
||||||
|
return ((RsGxsNetServiceTester *) mGxsCirclesNs)->fetchAllowedGroups(peerId, groups);
|
||||||
|
#else
|
||||||
|
std::cerr << "GxsPeerNode::checkCircleServiceAllowedGroups() not available";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool GxsPeerNode::createIdentity(const std::string &name,
|
bool GxsPeerNode::createIdentity(const std::string &name,
|
||||||
bool pgpLinked,
|
bool pgpLinked,
|
||||||
@ -269,6 +306,11 @@ bool GxsPeerNode::createCircle(const std::string &name,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cerr << "GxsPeerNode::createCircle()";
|
||||||
|
std::cerr << " CircleType: " << (uint32_t) grp1.mMeta.mCircleType;
|
||||||
|
std::cerr << " CircleId: " << grp1.mMeta.mCircleId.toStdString();
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
if (!mGxsCircles->createGroup(token, grp1))
|
if (!mGxsCircles->createGroup(token, grp1))
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,9 @@ public:
|
|||||||
GxsPeerNode(const RsPeerId &ownId, const std::list<RsPeerId> &peers, int testMode, bool useIdentityService);
|
GxsPeerNode(const RsPeerId &ownId, const std::list<RsPeerId> &peers, int testMode, bool useIdentityService);
|
||||||
~GxsPeerNode();
|
~GxsPeerNode();
|
||||||
|
|
||||||
|
bool checkTestServiceAllowedGroups(const RsPeerId &peerId);
|
||||||
|
bool checkCircleServiceAllowedGroups(const RsPeerId &peerId);
|
||||||
|
|
||||||
bool createIdentity(const std::string &name,
|
bool createIdentity(const std::string &name,
|
||||||
bool pgpLinked,
|
bool pgpLinked,
|
||||||
uint32_t circleType,
|
uint32_t circleType,
|
||||||
|
@ -0,0 +1,149 @@
|
|||||||
|
|
||||||
|
#include "RsGxsNetServiceTester.h"
|
||||||
|
#include "services/p3gxscircles.h"
|
||||||
|
|
||||||
|
/* This is a wrapper class used to allow testing
|
||||||
|
* of internal functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
RsGxsNetServiceTester::RsGxsNetServiceTester(
|
||||||
|
uint16_t servType, RsGeneralDataService *gds,
|
||||||
|
RsNxsNetMgr *netMgr,
|
||||||
|
RsNxsObserver *nxsObs, // used to be = NULL.
|
||||||
|
const RsServiceInfo serviceInfo,
|
||||||
|
RsGixsReputation* reputations,
|
||||||
|
RsGcxs* circles,
|
||||||
|
PgpAuxUtils *pgpUtils,
|
||||||
|
bool grpAutoSync)
|
||||||
|
:RsGxsNetService(servType, gds, netMgr, nxsObs,
|
||||||
|
serviceInfo, reputations, circles, pgpUtils, grpAutoSync)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// This Function mimics RsGxsNetService::handleRecvSyncGroup()
|
||||||
|
// It gets all GrpMetaData then checks canSendGrpId.
|
||||||
|
bool RsGxsNetServiceTester::fetchAllowedGroups(const RsPeerId &peerId, std::vector<RsGxsGroupId> &groups)
|
||||||
|
{
|
||||||
|
std::cerr << "RsGxsNetServiceTester::fetchAllowedGroups() for: ";
|
||||||
|
std::cerr << peerId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
/* get data */
|
||||||
|
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grp;
|
||||||
|
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator it;
|
||||||
|
mDataStore->retrieveGxsGrpMetaData(grp);
|
||||||
|
|
||||||
|
for(it = grp.begin(); it != grp.end(); it++)
|
||||||
|
{
|
||||||
|
RsGxsGrpMetaData& grpMeta = *(it->second);
|
||||||
|
std::cerr << "GroupId: " << it->first << " ";
|
||||||
|
std::cerr << " CircleId: " << grpMeta.mCircleId << " ";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
if (grpMeta.mCircleType == GXS_CIRCLE_TYPE_EXTERNAL)
|
||||||
|
{
|
||||||
|
std::cerr << "External Circle Members:";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<RsPgpId> friendlist;
|
||||||
|
std::list<RsPgpId>::iterator fit;
|
||||||
|
mCircles->recipients(grpMeta.mCircleId, friendlist);
|
||||||
|
for(fit = friendlist.begin(); fit != friendlist.end(); fit++)
|
||||||
|
{
|
||||||
|
std::cerr << "\t PgpId: " << *fit;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "External Circle Details:";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
RsGxsCircleDetails details;
|
||||||
|
((p3GxsCircles*) mCircles)->getCircleDetails(grpMeta.mCircleId, details);
|
||||||
|
|
||||||
|
std::set<RsGxsId>::iterator uit;
|
||||||
|
for(uit = details.mUnknownPeers.begin();
|
||||||
|
uit != details.mUnknownPeers.end(); uit++)
|
||||||
|
{
|
||||||
|
std::cerr << "\t Unknown GxsId: " << *uit;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
std::map<RsPgpId, std::list<RsGxsId> >::iterator mit;
|
||||||
|
for(mit = details.mAllowedPeers.begin();
|
||||||
|
mit != details.mAllowedPeers.end(); mit++)
|
||||||
|
{
|
||||||
|
std::cerr << "\t Allowed PgpId: " << mit->first;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::list<RsGxsId>::iterator lit;
|
||||||
|
for(lit = mit->second.begin();
|
||||||
|
lit != mit->second.end(); lit++)
|
||||||
|
{
|
||||||
|
std::cerr << "\t\t From GxsId: " << *lit;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Not External Circle";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(it = grp.begin(); it != grp.end(); it++)
|
||||||
|
{
|
||||||
|
RsGxsGrpMetaData& grpMeta = *(it->second);
|
||||||
|
std::vector<GrpIdCircleVet> toVet;
|
||||||
|
bool result = false;
|
||||||
|
int count = 0;
|
||||||
|
while(!(result = canSendGrpId(peerId, grpMeta, toVet)))
|
||||||
|
{
|
||||||
|
if (toVet.empty())
|
||||||
|
{
|
||||||
|
// okay.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "RsGxsNetServiceTester::fetchAllowedGroups() pending group: ";
|
||||||
|
std::cerr << grpMeta.mGroupId;
|
||||||
|
std::cerr << " circleType: ";
|
||||||
|
std::cerr << (uint32_t) grpMeta.mCircleType;
|
||||||
|
std::cerr << " circleId: " << grpMeta.mCircleId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
sleep(1);
|
||||||
|
if (count++ > 3)
|
||||||
|
{
|
||||||
|
std::cerr << "RsGxsNetServiceTester::fetchAllowedGroups() Giving up!";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "\tGroupId: " << it->first << " ";
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
groups.push_back(grpMeta.mGroupId);
|
||||||
|
std::cerr << " Allowed";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << " Not Allowed";
|
||||||
|
}
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
delete (it->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
#include "gxs/rsgxsnetservice.h"
|
||||||
|
|
||||||
|
/* This is a wrapper class used to allow testing
|
||||||
|
* of internal functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
class RsGxsNetServiceTester: public RsGxsNetService
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
RsGxsNetServiceTester(
|
||||||
|
uint16_t servType, RsGeneralDataService *gds,
|
||||||
|
RsNxsNetMgr *netMgr,
|
||||||
|
RsNxsObserver *nxsObs, // used to be = NULL.
|
||||||
|
const RsServiceInfo serviceInfo,
|
||||||
|
RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL,
|
||||||
|
PgpAuxUtils *pgpUtils = NULL,
|
||||||
|
bool grpAutoSync = true);
|
||||||
|
|
||||||
|
|
||||||
|
bool fetchAllowedGroups(const RsPeerId &peerId, std::vector<RsGxsGroupId> &groups);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
364
tests/unittests/libretroshare/services/gxs/gxscircle_mintest.cc
Normal file
364
tests/unittests/libretroshare/services/gxs/gxscircle_mintest.cc
Normal file
@ -0,0 +1,364 @@
|
|||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
// from librssimulator
|
||||||
|
|
||||||
|
// from libretroshare
|
||||||
|
#include "serialiser/rsnxsitems.h"
|
||||||
|
|
||||||
|
// local
|
||||||
|
#include "GxsPairServiceTester.h"
|
||||||
|
#include "GxsPeerNode.h"
|
||||||
|
#include "gxstestservice.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fancy Circle / ID tests.
|
||||||
|
*
|
||||||
|
* 1) Have to create a GxsID-PgpLinked for external Circle tests...
|
||||||
|
* - These take some time to move + be hash checked.
|
||||||
|
*
|
||||||
|
* 2) Have to create Forums with Signed Msgs to make the Authors Move.
|
||||||
|
*
|
||||||
|
* 3) Then we create a bunch of Circles.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test 1: nothing in Groups.... only sync packets.
|
||||||
|
*
|
||||||
|
* This test is rather slow - should speed it up.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//TEST(libretroshare_services, DISABLED_GxsMinCircles1)
|
||||||
|
TEST(libretroshare_services, GxsMinCircles1)
|
||||||
|
{
|
||||||
|
time_t starttime = time(NULL);
|
||||||
|
RsGxsCircleId nullCircleId;
|
||||||
|
RsGxsId nullAuthorId;
|
||||||
|
std::list<RsPgpId> nullLocalMembers;
|
||||||
|
std::list<RsGxsId> nullExtMembers;
|
||||||
|
|
||||||
|
RsPeerId p1 = RsPeerId::random();
|
||||||
|
RsPeerId p2 = RsPeerId::random();
|
||||||
|
|
||||||
|
/* tweak ids - so that they are easy to ID. */
|
||||||
|
((unsigned char *) p1.toByteArray())[0] = 1;
|
||||||
|
((unsigned char *) p2.toByteArray())[0] = 2;
|
||||||
|
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) PeerIds";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "Peer1 : " << p1.toStdString();
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "Peer2 : " << p2.toStdString();
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
int testMode = 0;
|
||||||
|
|
||||||
|
GxsPairServiceTester tester(p1, p2, testMode, true);
|
||||||
|
GxsPeerNode *peerNode1 = tester.getGxsPeerNode(p1);
|
||||||
|
GxsPeerNode *peerNode2 = tester.getGxsPeerNode(p2);
|
||||||
|
|
||||||
|
// Standard Filters.
|
||||||
|
|
||||||
|
// create Identities.
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Create Identities";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
RsGxsId gxsId1, gxsId2;
|
||||||
|
EXPECT_TRUE(peerNode1->createIdentity("gxsid1", true, GXS_CIRCLE_TYPE_PUBLIC, nullCircleId, gxsId1));
|
||||||
|
EXPECT_TRUE(peerNode2->createIdentity("gxsid2", true, GXS_CIRCLE_TYPE_PUBLIC, nullCircleId, gxsId2));
|
||||||
|
|
||||||
|
std::map<RsPeerId, RsGxsId> NodeIdMap;
|
||||||
|
NodeIdMap[p1] = gxsId1;
|
||||||
|
NodeIdMap[p2] = gxsId2;
|
||||||
|
|
||||||
|
// create Group / Msg (for Id exchange).
|
||||||
|
RsGxsGroupId p1GroupId1;
|
||||||
|
RsGxsMessageId p1g1MsgId1;
|
||||||
|
EXPECT_TRUE(peerNode1->createGroup("p1group1", GXS_CIRCLE_TYPE_PUBLIC, nullCircleId, nullAuthorId, p1GroupId1));
|
||||||
|
EXPECT_TRUE(peerNode1->createMsg("p1g1msg1", p1GroupId1, gxsId1, p1g1MsgId1));
|
||||||
|
std::cerr << "p1->group1 id: " << p1GroupId1;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "p1->group1, msgId: " << p1g1MsgId1;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
// let Group Exchange.
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Let Groups Exchange";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
int counter = 0;
|
||||||
|
while(counter < 30)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
tester.tick();
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Checking Group Exchange";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
std::list<RsGxsGroupId> p1GroupList;
|
||||||
|
std::list<RsGxsGroupId> p2GroupList;
|
||||||
|
EXPECT_TRUE(peerNode1->getGroupList(p1GroupList));
|
||||||
|
EXPECT_TRUE(peerNode2->getGroupList(p2GroupList));
|
||||||
|
EXPECT_TRUE(p1GroupList.size() == 1);
|
||||||
|
EXPECT_TRUE(p2GroupList.size() == 1);
|
||||||
|
EXPECT_TRUE(p1GroupList.end() != std::find(p1GroupList.begin(), p1GroupList.end(), p1GroupId1));
|
||||||
|
EXPECT_TRUE(p2GroupList.end() != std::find(p2GroupList.begin(), p2GroupList.end(), p1GroupId1));
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
std::vector<RsTestGroup> p1Groups;
|
||||||
|
std::vector<RsTestGroup> p2Groups;
|
||||||
|
EXPECT_TRUE(peerNode1->getGroups(p1Groups));
|
||||||
|
EXPECT_TRUE(peerNode2->getGroups(p2Groups));
|
||||||
|
EXPECT_TRUE(p1Groups.size() == 2);
|
||||||
|
EXPECT_TRUE(p2Groups.size() == 2);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subscribe to Groups - so that we can get a msgs, and reply msg for
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Subscribing to Groups";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
EXPECT_TRUE(peerNode2->subscribeToGroup(p1GroupId1, true));
|
||||||
|
RsGxsMessageId p2g1MsgId2;
|
||||||
|
EXPECT_TRUE(peerNode2->createMsg("p2g1msg2", p1GroupId1, gxsId2, p2g1MsgId2));
|
||||||
|
|
||||||
|
// let Group Exchange.
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Let Groups Exchange";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
counter = 0;
|
||||||
|
while(counter < 30)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
tester.tick();
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now we have setup the basics... GxsIds have been exchanged.
|
||||||
|
// now create some circles....
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Creating Circles";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
// Ext Group containing p2 (missing creator!) shared publicly.
|
||||||
|
std::string circleName3 = "p1c3-EC-public-p2";
|
||||||
|
RsGxsGroupId p1c3_circleId;
|
||||||
|
std::list<RsGxsId> p1c3_members;
|
||||||
|
p1c3_members.push_back(gxsId2);
|
||||||
|
EXPECT_TRUE(peerNode1->createCircle(circleName3, GXS_CIRCLE_TYPE_PUBLIC,
|
||||||
|
nullCircleId, nullAuthorId, nullLocalMembers, p1c3_members, p1c3_circleId));
|
||||||
|
|
||||||
|
std::cerr << "Circle3: " << circleName3 << " CircleId: " << p1c3_circleId.toStdString() << std::endl;
|
||||||
|
|
||||||
|
counter = 0;
|
||||||
|
while(counter < 60)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
tester.tick();
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Creating Groups";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
RsGxsCircleId circleId3(p1c3_circleId.toStdString());
|
||||||
|
|
||||||
|
RsGxsGroupId cgId3;
|
||||||
|
RsGxsMessageId cmId3;
|
||||||
|
EXPECT_TRUE(peerNode1->createGroup("cgId3", GXS_CIRCLE_TYPE_EXTERNAL, circleId3, nullAuthorId, cgId3));
|
||||||
|
EXPECT_TRUE(peerNode1->createMsg("cmId3", cgId3, gxsId1, cmId3));
|
||||||
|
|
||||||
|
// Expected Results.
|
||||||
|
std::map<RsPeerId, std::map<RsGxsGroupId, uint32_t> > mExpectedPeerMsgs;
|
||||||
|
std::list<RsGxsMessageId> emptyList;
|
||||||
|
uint32_t expectedMsgCount = 0;
|
||||||
|
|
||||||
|
// Group 3, circle only has p2. but p1 creates. different counts.
|
||||||
|
// i.e. orig not in circle.
|
||||||
|
mExpectedPeerMsgs[p1][cgId3] = 2; // orig + own. (shouldn't receive from p2)
|
||||||
|
mExpectedPeerMsgs[p2][cgId3] = 1; // own (shouldn't accept from p1)
|
||||||
|
|
||||||
|
// let Group Exchange.
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Let Restricted Groups Exchange";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
counter = 0;
|
||||||
|
while(counter < 60)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
tester.tick();
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Subscribe / Create Msgs.";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
{
|
||||||
|
std::cerr << "GroupId cgId3: " << cgId3.toStdString();
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::map<RsPeerId, RsGxsId>::iterator nit;
|
||||||
|
for(nit = NodeIdMap.begin(); nit != NodeIdMap.end(); nit++)
|
||||||
|
{
|
||||||
|
GxsPeerNode *peerNode = tester.getGxsPeerNode(nit->first);
|
||||||
|
|
||||||
|
std::list<RsGxsGroupId> groupList;
|
||||||
|
std::list<RsGxsGroupId>::iterator it;
|
||||||
|
EXPECT_TRUE(peerNode->getGroupList(groupList));
|
||||||
|
|
||||||
|
std::cerr << "peer: " << nit->first << " has #Groups: " << groupList.size();
|
||||||
|
std::cerr << std::endl;
|
||||||
|
for(it = groupList.begin(); it != groupList.end(); it++)
|
||||||
|
{
|
||||||
|
std::cerr << "\t groupId: " << *it;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Now we Subscribe / Create a Msg per Group that they have
|
||||||
|
for(nit = NodeIdMap.begin(); nit != NodeIdMap.end(); nit++)
|
||||||
|
{
|
||||||
|
GxsPeerNode *peerNode = tester.getGxsPeerNode(nit->first);
|
||||||
|
|
||||||
|
std::list<RsGxsGroupId> groupList;
|
||||||
|
std::list<RsGxsGroupId>::iterator it;
|
||||||
|
EXPECT_TRUE(peerNode->getGroupList(groupList));
|
||||||
|
|
||||||
|
for(it = groupList.begin(); it != groupList.end(); it++)
|
||||||
|
{
|
||||||
|
RsGxsMessageId msgId;
|
||||||
|
EXPECT_TRUE(peerNode->subscribeToGroup(*it, true));
|
||||||
|
EXPECT_TRUE(peerNode->createMsg("msg", *it, nit->second, msgId));
|
||||||
|
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "Created Msg peer: " << nit->first;
|
||||||
|
std::cerr << " GxsId: " << nit->second;
|
||||||
|
std::cerr << " GroupId: " << *it;
|
||||||
|
std::cerr << " MsgId: " << msgId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// let Group Exchange.
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Exchange Restricted Group Messages";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
counter = 0;
|
||||||
|
while(counter < 60)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
tester.tick();
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Checking Msg Count";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
// Check messages.
|
||||||
|
std::map<RsPeerId, std::map<RsGxsGroupId, uint32_t> >::iterator nit;
|
||||||
|
for(nit = mExpectedPeerMsgs.begin(); nit != mExpectedPeerMsgs.end(); nit++)
|
||||||
|
{
|
||||||
|
std::cerr << "Node Id: " << nit->first;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
GxsPeerNode *peerNode = tester.getGxsPeerNode(nit->first);
|
||||||
|
|
||||||
|
std::map<RsGxsGroupId, uint32_t> &groupMap = nit->second;
|
||||||
|
std::map<RsGxsGroupId, uint32_t>::iterator git;
|
||||||
|
std::list<RsGxsGroupId> groupList;
|
||||||
|
std::list<RsGxsGroupId>::iterator lit;
|
||||||
|
EXPECT_TRUE(peerNode->getGroupList(groupList));
|
||||||
|
|
||||||
|
for(git = groupMap.begin(); git != groupMap.end(); git++)
|
||||||
|
{
|
||||||
|
if (git->second)
|
||||||
|
{
|
||||||
|
/* expect to find it in groupList */
|
||||||
|
lit = std::find(groupList.begin(), groupList.end(), git->first);
|
||||||
|
EXPECT_TRUE(lit != groupList.end());
|
||||||
|
if (lit != groupList.end())
|
||||||
|
{
|
||||||
|
/* check message count */
|
||||||
|
std::list<RsGxsMessageId> msgList;
|
||||||
|
peerNode->getMsgList(git->first, msgList);
|
||||||
|
EXPECT_TRUE(msgList.size() == git->second);
|
||||||
|
|
||||||
|
std::cerr << "\t GroupId: " << git->first;
|
||||||
|
std::cerr << " Expected Msg Count: " << git->second;
|
||||||
|
std::cerr << " Actual Msg Count: " << msgList.size();
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<RsGxsMessageId>::iterator mit;
|
||||||
|
for(mit = msgList.begin(); mit != msgList.end(); mit++)
|
||||||
|
{
|
||||||
|
std::cerr << "\t\tMsgId: " << *mit;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "\t GroupId: " << git->first;
|
||||||
|
std::cerr << " Error Expected but missing";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lit = std::find(groupList.begin(), groupList.end(), git->first);
|
||||||
|
EXPECT_TRUE(lit == groupList.end());
|
||||||
|
|
||||||
|
if (lit == groupList.end())
|
||||||
|
{
|
||||||
|
std::cerr << "\t GroupId: " << git->first;
|
||||||
|
std::cerr << " Not present - as expected";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "\t GroupId: " << git->first;
|
||||||
|
std::cerr << " ERROR - not expected";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Test Finished";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
@ -179,7 +179,7 @@ TEST(libretroshare_services, GxsCircles1)
|
|||||||
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::string circleName1 = "p1c1-EC-public-p1p2p3p4";
|
||||||
// Ext Group, containing everyone, shared publicly.
|
// Ext Group, containing everyone, shared publicly.
|
||||||
RsGxsGroupId p1c1_circleId;
|
RsGxsGroupId p1c1_circleId;
|
||||||
std::list<RsGxsId> p1c1_members;
|
std::list<RsGxsId> p1c1_members;
|
||||||
@ -187,51 +187,73 @@ TEST(libretroshare_services, GxsCircles1)
|
|||||||
p1c1_members.push_back(gxsId2);
|
p1c1_members.push_back(gxsId2);
|
||||||
p1c1_members.push_back(gxsId3);
|
p1c1_members.push_back(gxsId3);
|
||||||
p1c1_members.push_back(gxsId4);
|
p1c1_members.push_back(gxsId4);
|
||||||
EXPECT_TRUE(peerNode1->createCircle("p1c1-EC-public-p1p2p3p4", GXS_CIRCLE_TYPE_PUBLIC,
|
EXPECT_TRUE(peerNode1->createCircle(circleName1, GXS_CIRCLE_TYPE_PUBLIC,
|
||||||
nullCircleId, nullAuthorId, nullLocalMembers, p1c1_members, p1c1_circleId));
|
nullCircleId, nullAuthorId, nullLocalMembers, p1c1_members, p1c1_circleId));
|
||||||
|
|
||||||
|
|
||||||
// Ext Group containing p1,p2, shared publicly.
|
// Ext Group containing p1,p2, shared publicly.
|
||||||
|
std::string circleName2 = "p1c2-EC-public-p1p2";
|
||||||
RsGxsGroupId p1c2_circleId;
|
RsGxsGroupId p1c2_circleId;
|
||||||
std::list<RsGxsId> p1c2_members;
|
std::list<RsGxsId> p1c2_members;
|
||||||
p1c2_members.push_back(gxsId1);
|
p1c2_members.push_back(gxsId1);
|
||||||
p1c2_members.push_back(gxsId2);
|
p1c2_members.push_back(gxsId2);
|
||||||
EXPECT_TRUE(peerNode1->createCircle("p1c2-EC-public-p1p2", GXS_CIRCLE_TYPE_PUBLIC,
|
EXPECT_TRUE(peerNode1->createCircle(circleName2, GXS_CIRCLE_TYPE_PUBLIC,
|
||||||
nullCircleId, nullAuthorId, nullLocalMembers, p1c2_members, p1c2_circleId));
|
nullCircleId, nullAuthorId, nullLocalMembers, p1c2_members, p1c2_circleId));
|
||||||
|
|
||||||
// Ext Group containing p2 (missing creator!) shared publicly.
|
// Ext Group containing p2 (missing creator!) shared publicly.
|
||||||
|
std::string circleName3 = "p1c3-EC-public-p2";
|
||||||
RsGxsGroupId p1c3_circleId;
|
RsGxsGroupId p1c3_circleId;
|
||||||
std::list<RsGxsId> p1c3_members;
|
std::list<RsGxsId> p1c3_members;
|
||||||
p1c3_members.push_back(gxsId2);
|
p1c3_members.push_back(gxsId2);
|
||||||
EXPECT_TRUE(peerNode1->createCircle("p1c3-EC-public-p2", GXS_CIRCLE_TYPE_PUBLIC,
|
EXPECT_TRUE(peerNode1->createCircle(circleName3, GXS_CIRCLE_TYPE_PUBLIC,
|
||||||
nullCircleId, nullAuthorId, nullLocalMembers, p1c3_members, p1c3_circleId));
|
nullCircleId, nullAuthorId, nullLocalMembers, p1c3_members, p1c3_circleId));
|
||||||
|
|
||||||
// Ext Group containing p1,p2,p3 shared SELF-REF.
|
// Ext Group containing p1,p2,p3 shared SELF-REF.
|
||||||
|
std::string circleName4 = "p1c4-EC-self-p1p2p3";
|
||||||
RsGxsGroupId p1c4_circleId;
|
RsGxsGroupId p1c4_circleId;
|
||||||
std::list<RsGxsId> p1c4_members;
|
std::list<RsGxsId> p1c4_members;
|
||||||
p1c4_members.push_back(gxsId1);
|
p1c4_members.push_back(gxsId1);
|
||||||
p1c4_members.push_back(gxsId2);
|
p1c4_members.push_back(gxsId2);
|
||||||
p1c4_members.push_back(gxsId3);
|
p1c4_members.push_back(gxsId3);
|
||||||
EXPECT_TRUE(peerNode1->createCircle("p1c4-EC-self-p1p2p3", GXS_CIRCLE_TYPE_EXT_SELF,
|
EXPECT_TRUE(peerNode1->createCircle(circleName4, GXS_CIRCLE_TYPE_EXT_SELF,
|
||||||
nullCircleId, nullAuthorId, nullLocalMembers, p1c4_members, p1c4_circleId));
|
nullCircleId, nullAuthorId, nullLocalMembers, p1c4_members, p1c4_circleId));
|
||||||
|
|
||||||
// Ext Group containing p1,p2 shared EXT p1c4. (p1,p2,p3).
|
// Ext Group containing p1,p2 shared EXT p1c4. (p1,p2,p3).
|
||||||
|
RsGxsCircleId constrain_circleId(p1c4_circleId.toStdString());
|
||||||
|
std::string circleName5 = "p1c5-EC-ext-p1p2";
|
||||||
RsGxsGroupId p1c5_circleId;
|
RsGxsGroupId p1c5_circleId;
|
||||||
std::list<RsGxsId> p1c5_members;
|
std::list<RsGxsId> p1c5_members;
|
||||||
p1c5_members.push_back(gxsId1);
|
p1c5_members.push_back(gxsId1);
|
||||||
p1c5_members.push_back(gxsId2);
|
p1c5_members.push_back(gxsId2);
|
||||||
EXPECT_TRUE(peerNode1->createCircle("p1c5-EC-ext-p1p2", GXS_CIRCLE_TYPE_EXTERNAL,
|
EXPECT_TRUE(peerNode1->createCircle(circleName5, GXS_CIRCLE_TYPE_EXTERNAL,
|
||||||
nullCircleId, nullAuthorId, nullLocalMembers, p1c5_members, p1c5_circleId));
|
constrain_circleId, nullAuthorId, nullLocalMembers, p1c5_members, p1c5_circleId));
|
||||||
|
|
||||||
|
|
||||||
// Ext Group containing p1,p4 shared EXT p1c4. (p1,p2,p3).
|
// Ext Group containing p1,p4 shared EXT p1c4. (p1,p2,p3).
|
||||||
// (does p4 get stuff).
|
// (does p4 get stuff).
|
||||||
|
std::string circleName6 = "p1c6-EC-ext-p1p4";
|
||||||
RsGxsGroupId p1c6_circleId;
|
RsGxsGroupId p1c6_circleId;
|
||||||
std::list<RsGxsId> p1c6_members;
|
std::list<RsGxsId> p1c6_members;
|
||||||
p1c6_members.push_back(gxsId1);
|
p1c6_members.push_back(gxsId1);
|
||||||
p1c6_members.push_back(gxsId4);
|
p1c6_members.push_back(gxsId4);
|
||||||
EXPECT_TRUE(peerNode1->createCircle("p1c6-EC-ext-p1p4", GXS_CIRCLE_TYPE_EXTERNAL,
|
EXPECT_TRUE(peerNode1->createCircle(circleName6, GXS_CIRCLE_TYPE_EXTERNAL,
|
||||||
nullCircleId, nullAuthorId, nullLocalMembers, p1c6_members, p1c6_circleId));
|
constrain_circleId, nullAuthorId, nullLocalMembers, p1c6_members, p1c6_circleId));
|
||||||
|
|
||||||
|
std::cerr << "Circle1: " << circleName1 << " CircleId: " << p1c1_circleId.toStdString() << std::endl;
|
||||||
|
std::cerr << "Circle2: " << circleName2 << " CircleId: " << p1c2_circleId.toStdString() << std::endl;
|
||||||
|
std::cerr << "Circle3: " << circleName3 << " CircleId: " << p1c3_circleId.toStdString() << std::endl;
|
||||||
|
std::cerr << "Circle4: " << circleName4 << " CircleId: " << p1c4_circleId.toStdString() << std::endl;
|
||||||
|
std::cerr << "Circle5: " << circleName5 << " CircleId: " << p1c5_circleId.toStdString() << std::endl;
|
||||||
|
std::cerr << "Circle6: " << circleName6 << " CircleId: " << p1c6_circleId.toStdString() << std::endl;
|
||||||
|
|
||||||
|
counter = 0;
|
||||||
|
while(counter < 60)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
tester.tick();
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
std::cerr << "TEST(libretroshare_services, GxsCircles1) Creating Groups";
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Creating Groups";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
@ -495,9 +517,64 @@ TEST(libretroshare_services, GxsCircles1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Test Finished";
|
||||||
|
std::cerr << std::endl;
|
||||||
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
tester.PrintCapturedPackets();
|
// Below here is extra checks - which require rsgxsnetservice to be overloaded by RsGxsNetServiceTester
|
||||||
|
// needs private->protected.
|
||||||
|
#if 0
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Checking Grp Availability";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
{
|
||||||
|
std::map<RsPeerId, RsGxsId>::const_iterator nit;
|
||||||
|
for(nit = NodeIdMap.begin(); nit != NodeIdMap.end(); nit++)
|
||||||
|
{
|
||||||
|
GxsPeerNode *peerNode = tester.getGxsPeerNode(nit->first);
|
||||||
|
std::cerr << "=============================";
|
||||||
|
std::cerr << " PeerId: " << nit->first;
|
||||||
|
std::cerr << " & GxsId: " << nit->second;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::map<RsPeerId, RsGxsId>::const_iterator nit2;
|
||||||
|
for(nit2 = NodeIdMap.begin(); nit2 != NodeIdMap.end(); nit2++)
|
||||||
|
{
|
||||||
|
if (nit->first == nit2->first)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "-----------------------";
|
||||||
|
std::cerr << "PeerId: " << nit->first;
|
||||||
|
std::cerr << " TestService checkAllowed(" << nit2->first;
|
||||||
|
std::cerr << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
peerNode->checkTestServiceAllowedGroups(nit2->first);
|
||||||
|
|
||||||
|
std::cerr << "-----------------------";
|
||||||
|
std::cerr << "PeerId: " << nit->first;
|
||||||
|
std::cerr << " CircleService checkAllowed(" << nit2->first;
|
||||||
|
std::cerr << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
peerNode->checkCircleServiceAllowedGroups(nit2->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "TEST(libretroshare_services, GxsCircles1) Finished - Printing Captured Packets";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "TIME TO GET HERE: " << time(NULL) - starttime;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// no need to print packets.
|
||||||
|
//tester.PrintCapturedPackets();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ CONFIG += bitdht
|
|||||||
|
|
||||||
CONFIG += gxs debug
|
CONFIG += gxs debug
|
||||||
|
|
||||||
LIBS += -lgtest.a
|
LIBS += -lgtest
|
||||||
|
|
||||||
gxs {
|
gxs {
|
||||||
DEFINES += RS_ENABLE_GXS
|
DEFINES += RS_ENABLE_GXS
|
||||||
@ -274,10 +274,11 @@ HEADERS += libretroshare/gxs/nxs_test/nxsdummyservices.h \
|
|||||||
SOURCES += libretroshare/gxs/nxs_test/nxsdummyservices.cc \
|
SOURCES += libretroshare/gxs/nxs_test/nxsdummyservices.cc \
|
||||||
libretroshare/gxs/nxs_test/nxsgrptestscenario.cc \
|
libretroshare/gxs/nxs_test/nxsgrptestscenario.cc \
|
||||||
libretroshare/gxs/nxs_test/nxsmsgtestscenario.cc \
|
libretroshare/gxs/nxs_test/nxsmsgtestscenario.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/nxstesthub.cc \
|
||||||
libretroshare/gxs/nxs_test/rsgxsnetservice_test.cc
|
|
||||||
|
# libretroshare/gxs/nxs_test/rsgxsnetservice_test.cc
|
||||||
|
# libretroshare/gxs/nxs_test/nxsmsgsync_test.cc \
|
||||||
|
# libretroshare/gxs/nxs_test/nxsgrpsync_test.cc \
|
||||||
|
|
||||||
HEADERS += libretroshare/gxs/gen_exchange/genexchangetester.h \
|
HEADERS += libretroshare/gxs/gen_exchange/genexchangetester.h \
|
||||||
libretroshare/gxs/gen_exchange/gxspublishmsgtest.h \
|
libretroshare/gxs/gen_exchange/gxspublishmsgtest.h \
|
||||||
@ -326,6 +327,8 @@ HEADERS += libretroshare/services/gxs/rsgxstestitems.h \
|
|||||||
libretroshare/services/gxs/GxsPairServiceTester.h \
|
libretroshare/services/gxs/GxsPairServiceTester.h \
|
||||||
libretroshare/services/gxs/FakePgpAuxUtils.h \
|
libretroshare/services/gxs/FakePgpAuxUtils.h \
|
||||||
|
|
||||||
|
# libretroshare/services/gxs/RsGxsNetServiceTester.h \
|
||||||
|
|
||||||
SOURCES += libretroshare/services/gxs/rsgxstestitems.cc \
|
SOURCES += libretroshare/services/gxs/rsgxstestitems.cc \
|
||||||
libretroshare/services/gxs/gxstestservice.cc \
|
libretroshare/services/gxs/gxstestservice.cc \
|
||||||
libretroshare/services/gxs/GxsIsolatedServiceTester.cc \
|
libretroshare/services/gxs/GxsIsolatedServiceTester.cc \
|
||||||
@ -335,3 +338,8 @@ SOURCES += libretroshare/services/gxs/rsgxstestitems.cc \
|
|||||||
libretroshare/services/gxs/nxsbasic_test.cc \
|
libretroshare/services/gxs/nxsbasic_test.cc \
|
||||||
libretroshare/services/gxs/nxspair_tests.cc \
|
libretroshare/services/gxs/nxspair_tests.cc \
|
||||||
libretroshare/services/gxs/gxscircle_tests.cc \
|
libretroshare/services/gxs/gxscircle_tests.cc \
|
||||||
|
|
||||||
|
# libretroshare/services/gxs/gxscircle_mintest.cc \
|
||||||
|
|
||||||
|
|
||||||
|
# libretroshare/services/gxs/RsGxsNetServiceTester.cc \
|
||||||
|
Loading…
Reference in New Issue
Block a user