mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-21 23:40:26 -04:00
Bug fix for ES_GXS_MSG_COMMENTS option
Fix for run thread loop of RsGenExchange (was using logic rather than isRunning, which led to some crashes on rs close Added request and get MsgRelated function for ids, meta and data added template function to ease getting meta data from back end; Updated Nxs tests, tests passed (failed initially because of change option requirements) Added test for msgrelated Ids, still need to add test for all msgRelated functions (bug with mask, not filtering correctly) Made changes for forum and wiki gui to use new API but gui needs to call correct get functions now (Bob). git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5817 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8d556955c5
commit
f74a328d61
27 changed files with 872 additions and 310 deletions
|
@ -3,7 +3,6 @@
|
|||
#include "gxs/rsdataservice.h"
|
||||
#include "gxs/rsgxsflags.h"
|
||||
|
||||
|
||||
GenExchangeTester::GenExchangeTester()
|
||||
: mGenTestMutex("genTest")
|
||||
{
|
||||
|
@ -15,24 +14,28 @@ void GenExchangeTester::setUp()
|
|||
{
|
||||
mDataStore = new RsDataService("./", "testServiceDb", RS_SERVICE_TYPE_DUMMY, NULL);
|
||||
mNxs = new RsDummyNetService();
|
||||
mTestService = new GenExchangeTestService(mDataStore, mNxs);
|
||||
mGxsCore.addService(mTestService);
|
||||
|
||||
RsGixsDummy* gixsDummy = new RsGixsDummy("incoming", "outgoing");
|
||||
|
||||
mTestService = new GenExchangeTestService(mDataStore, mNxs, gixsDummy, 0);
|
||||
mTokenService = mTestService->getTokenService();
|
||||
mGxsCore.start();
|
||||
mTestService->start();
|
||||
}
|
||||
|
||||
void GenExchangeTester::setUpGrps()
|
||||
void GenExchangeTester::setUpGrps(uint32_t grpFlags)
|
||||
{
|
||||
// create some random grps to allow msg testing
|
||||
|
||||
RsDummyGrp* dgrp1 = new RsDummyGrp();
|
||||
RsDummyGrp* dgrp2 = new RsDummyGrp();
|
||||
RsDummyGrp* dgrp3 = new RsDummyGrp();
|
||||
|
||||
init(dgrp1);
|
||||
dgrp1->meta.mGroupFlags = grpFlags;
|
||||
uint32_t token;
|
||||
mTestService->publishDummyGrp(token, dgrp1);
|
||||
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 45000;
|
||||
pollForToken(token, opts);
|
||||
|
||||
|
@ -40,11 +43,15 @@ void GenExchangeTester::setUpGrps()
|
|||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
mRandGrpIds.push_back(grpId);
|
||||
|
||||
init(dgrp2);
|
||||
dgrp2->meta.mGroupFlags = grpFlags;
|
||||
mTestService->publishDummyGrp(token, dgrp2);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
mRandGrpIds.push_back(grpId);
|
||||
|
||||
init(dgrp3);
|
||||
dgrp3->meta.mGroupFlags = grpFlags;
|
||||
mTestService->publishDummyGrp(token, dgrp3);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
|
@ -54,10 +61,8 @@ void GenExchangeTester::setUpGrps()
|
|||
|
||||
void GenExchangeTester::breakDown()
|
||||
{
|
||||
mTestService->join();
|
||||
|
||||
mGxsCore.join(); // indicate server to stop
|
||||
|
||||
mGxsCore.removeService(mTestService);
|
||||
delete mTestService;
|
||||
|
||||
// a bit protracted, but start a new db and use to clear up junk
|
||||
|
@ -147,7 +152,7 @@ bool GenExchangeTester::testGrpSubmissionRetrieval()
|
|||
init(dgrp2);
|
||||
init(dgrp3);
|
||||
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 45000;
|
||||
uint32_t token;
|
||||
RsGxsGroupId grpId;
|
||||
|
@ -240,7 +245,7 @@ bool GenExchangeTester::testGrpMetaRetrieval()
|
|||
init(dgrp2);
|
||||
init(dgrp3);
|
||||
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 45000;
|
||||
uint32_t token;
|
||||
RsGxsGroupId grpId;
|
||||
|
@ -316,7 +321,7 @@ bool GenExchangeTester::testGrpIdRetrieval()
|
|||
setUpLargeGrps(30); // create a large amount of grps
|
||||
|
||||
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_IDS;
|
||||
uint32_t token;
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
|
@ -369,7 +374,7 @@ bool GenExchangeTester::testGrpMetaModRequest()
|
|||
init(dgrp3);
|
||||
|
||||
uint32_t token;
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 45000;
|
||||
std::vector<RsGxsGroupId> grpIds;
|
||||
RsGxsGroupId grpId;
|
||||
|
@ -449,7 +454,7 @@ void GenExchangeTester::setUpLargeGrps(uint32_t nGrps)
|
|||
RsGxsGroupId grpId;
|
||||
uint32_t token;
|
||||
init(dgrp);
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 4000;
|
||||
mTestService->publishDummyGrp(token, dgrp);
|
||||
pollForToken(token, opts);
|
||||
|
@ -473,7 +478,7 @@ bool GenExchangeTester::testMsgMetaModRequest()
|
|||
mTestService->publishDummyMsg(token, msg);
|
||||
|
||||
// poll will block until found
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 4200;
|
||||
pollForToken(token, opts);
|
||||
RsGxsGrpMsgIdPair msgId;
|
||||
|
@ -554,7 +559,7 @@ bool GenExchangeTester::testMsgSubmissionRetrieval()
|
|||
|
||||
// start up
|
||||
setUp();
|
||||
setUpGrps();
|
||||
setUpGrps(GXS_SERV::FLAG_PRIVACY_PUBLIC);
|
||||
|
||||
/********************/
|
||||
|
||||
|
@ -568,8 +573,8 @@ bool GenExchangeTester::testMsgSubmissionRetrieval()
|
|||
mTestService->publishDummyMsg(token, msg);
|
||||
|
||||
// poll will block until found
|
||||
RsTokReqOptionsV2 opts;
|
||||
opts.mReqType = 4200;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
pollForToken(token, opts);
|
||||
RsGxsGrpMsgIdPair msgId;
|
||||
|
||||
|
@ -644,7 +649,7 @@ bool GenExchangeTester::testMsgIdRetrieval()
|
|||
|
||||
// start up
|
||||
setUp();
|
||||
setUpGrps();
|
||||
setUpGrps(GXS_SERV::FLAG_PRIVACY_PUBLIC);
|
||||
|
||||
/********************/
|
||||
|
||||
|
@ -656,7 +661,7 @@ bool GenExchangeTester::testMsgIdRetrieval()
|
|||
int nMsgs = (rand()%121)+2; // test a large number of msgs
|
||||
std::vector<RsDummyMsg*> msgs;
|
||||
createMsgs(msgs, nMsgs);
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 4000;
|
||||
uint32_t token;
|
||||
|
||||
|
@ -725,14 +730,13 @@ bool GenExchangeTester::testMsgIdRetrieval()
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GenExchangeTester::testMsgChildRetrieval()
|
||||
bool GenExchangeTester::testMsgAllVersions()
|
||||
{
|
||||
// start up
|
||||
setUp();
|
||||
setUpGrps();
|
||||
setUpGrps(GXS_SERV::FLAG_PRIVACY_PUBLIC);
|
||||
|
||||
/********************/
|
||||
// want to create several msgs of the same version (i.e. same origMsgId)
|
||||
|
||||
|
||||
// create msgs
|
||||
|
@ -741,31 +745,27 @@ bool GenExchangeTester::testMsgChildRetrieval()
|
|||
int nMsgs = (rand()%50)+2; // test a large number of msgs
|
||||
std::vector<RsDummyMsg*> msgs;
|
||||
createMsgs(msgs, nMsgs);
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 4000;
|
||||
uint32_t token;
|
||||
|
||||
bool first = true;
|
||||
RsGxsGrpMsgIdPair firstMsgId;
|
||||
|
||||
// everyone is parent of first msg
|
||||
|
||||
// everyone is a version of first msg
|
||||
for(int i=0; i < nMsgs; i++)
|
||||
{
|
||||
RsDummyMsg* msg = msgs[i];
|
||||
|
||||
int j = rand()%5;
|
||||
|
||||
|
||||
if(first){
|
||||
msg->meta.mParentId = "";
|
||||
msg->meta.mOrigMsgId = "";
|
||||
msg->meta.mOrigMsgId = ""; // don't worry GXS sets origid to first
|
||||
}
|
||||
else
|
||||
{
|
||||
msg->meta.mParentId = firstMsgId.second;
|
||||
msg->meta.mParentId = "";
|
||||
msg->meta.mGroupId = firstMsgId.first;
|
||||
msg->meta.mOrigMsgId = "";
|
||||
msg->meta.mOrigMsgId = firstMsgId.second;
|
||||
}
|
||||
|
||||
mTestService->publishDummyMsg(token, msg);
|
||||
|
@ -773,13 +773,6 @@ bool GenExchangeTester::testMsgChildRetrieval()
|
|||
RsGxsGrpMsgIdPair msgId;
|
||||
mTestService->acknowledgeTokenMsg(token, msgId);
|
||||
|
||||
// less than half have no parents
|
||||
if(first){
|
||||
firstMsgId.second = msgId.second;
|
||||
firstMsgId.first = msgId.first;
|
||||
|
||||
}
|
||||
|
||||
if(msgId.first.empty() || msgId.second.empty())
|
||||
{
|
||||
breakDown();
|
||||
|
@ -787,23 +780,30 @@ bool GenExchangeTester::testMsgChildRetrieval()
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!first)
|
||||
{
|
||||
mMsgIdsOut[msgId.first].push_back(msgId.second);
|
||||
|
||||
|
||||
// less than half have no parents
|
||||
if(first){
|
||||
firstMsgId.second = msgId.second;
|
||||
firstMsgId.first = msgId.first;
|
||||
first = false;
|
||||
|
||||
}
|
||||
|
||||
mMsgRelatedIdsOut[firstMsgId].push_back(msgId.second);
|
||||
}
|
||||
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_PARENT | RS_TOKREQOPT_MSG_LATEST;
|
||||
mTokenService->requestMsgRelatedInfo(token, 0, opts, firstMsgId);
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_IDS;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_VERSIONS;
|
||||
std::vector<RsGxsGrpMsgIdPair> msgIdList;
|
||||
msgIdList.push_back(firstMsgId);
|
||||
mTokenService->requestMsgRelatedInfo(token, 0, opts, msgIdList);
|
||||
|
||||
pollForToken(token, opts);
|
||||
|
||||
GxsMsgIdResult::iterator mit = mMsgIdsOut.begin();
|
||||
for(; mit != mMsgIdsOut.end(); mit++)
|
||||
MsgRelatedIdResult::iterator mit = mMsgRelatedIdsOut.begin();
|
||||
for(; mit != mMsgRelatedIdsOut.end(); mit++)
|
||||
{
|
||||
std::vector<RsGxsMessageId> msgIdsOut, msgIdsIn;
|
||||
msgIdsOut = mit->second;
|
||||
|
@ -813,7 +813,7 @@ bool GenExchangeTester::testMsgChildRetrieval()
|
|||
for(; vit_out != msgIdsOut.end(); vit_out++)
|
||||
{
|
||||
bool found = false;
|
||||
msgIdsIn = mMsgIdsIn[mit->first];
|
||||
msgIdsIn = mMsgRelatedIdsIn[mit->first];
|
||||
vit_in = msgIdsIn.begin();
|
||||
|
||||
for(; vit_in != msgIdsIn.end(); vit_in++)
|
||||
|
@ -830,21 +830,129 @@ bool GenExchangeTester::testMsgChildRetrieval()
|
|||
}
|
||||
}
|
||||
|
||||
/********************/
|
||||
|
||||
// complete
|
||||
breakDown();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GenExchangeTester::testMsgChildRetrieval()
|
||||
{
|
||||
// // start up
|
||||
// setUp();
|
||||
// setUpGrps(GXS_SERV::FLAG_PRIVACY_PUBLIC);
|
||||
|
||||
// /********************/
|
||||
|
||||
|
||||
// // create msgs
|
||||
// // then make all requests immediately then poll afterwards for each and run outbound test
|
||||
// // we want only latest for now
|
||||
// int nMsgs = (rand()%50)+2; // test a large number of msgs
|
||||
// std::vector<RsDummyMsg*> msgs;
|
||||
// createMsgs(msgs, nMsgs);
|
||||
// RsTokReqOptions opts;
|
||||
// opts.mReqType = 4000;
|
||||
// uint32_t token;
|
||||
|
||||
// bool first = true;
|
||||
// RsGxsGrpMsgIdPair firstMsgId;
|
||||
|
||||
// // everyone is parent of first msg
|
||||
|
||||
// for(int i=0; i < nMsgs; i++)
|
||||
// {
|
||||
// RsDummyMsg* msg = msgs[i];
|
||||
|
||||
// if(first){
|
||||
// msg->meta.mParentId = "";
|
||||
// msg->meta.mOrigMsgId = "";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// msg->meta.mParentId = firstMsgId.second;
|
||||
// msg->meta.mGroupId = firstMsgId.first;
|
||||
// msg->meta.mOrigMsgId = "";
|
||||
// }
|
||||
|
||||
// mTestService->publishDummyMsg(token, msg);
|
||||
// pollForToken(token, opts);
|
||||
// RsGxsGrpMsgIdPair msgId;
|
||||
// mTestService->acknowledgeTokenMsg(token, msgId);
|
||||
|
||||
|
||||
// if(msgId.first.empty() || msgId.second.empty())
|
||||
// {
|
||||
// breakDown();
|
||||
// std::cerr << "serious error: Acknowledgement failed! " << std::endl;
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if(!first)
|
||||
// {
|
||||
// mMsgIdsOut[msgId.first].push_back(msgId.second);
|
||||
// }
|
||||
|
||||
// if(first){
|
||||
// firstMsgId.second = msgId.second;
|
||||
// firstMsgId.first = msgId.first;
|
||||
// first = false;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||
// opts.mOptions = RS_TOKREQOPT_MSG_PARENT | RS_TOKREQOPT_MSG_LATEST;
|
||||
// std::vector<RsGxsGrpMsgIdPair> msgIdList;
|
||||
// msgIdList.push_back(firstMsgId);
|
||||
// mTokenService->requestMsgRelatedInfo(token, 0, opts, msgIdList);
|
||||
|
||||
// pollForToken(token, opts);
|
||||
|
||||
// GxsMsgIdResult::iterator mit = mMsgIdsOut.begin();
|
||||
// for(; mit != mMsgIdsOut.end(); mit++)
|
||||
// {
|
||||
// std::vector<RsGxsMessageId> msgIdsOut, msgIdsIn;
|
||||
// msgIdsOut = mit->second;
|
||||
|
||||
// std::vector<RsGxsMessageId>::iterator vit_out = msgIdsOut.begin(), vit_in;
|
||||
|
||||
// for(; vit_out != msgIdsOut.end(); vit_out++)
|
||||
// {
|
||||
// bool found = false;
|
||||
// msgIdsIn = mMsgIdsIn[mit->first];
|
||||
// vit_in = msgIdsIn.begin();
|
||||
|
||||
// for(; vit_in != msgIdsIn.end(); vit_in++)
|
||||
// {
|
||||
// if(*vit_in == *vit_out)
|
||||
// found = true;
|
||||
// }
|
||||
|
||||
// if(!found){
|
||||
// breakDown();
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
// /********************/
|
||||
|
||||
// // complete
|
||||
// breakDown();
|
||||
|
||||
// return true;
|
||||
}
|
||||
|
||||
bool GenExchangeTester::testSpecificMsgMetaRetrieval()
|
||||
{
|
||||
|
||||
|
||||
// start up
|
||||
setUp();
|
||||
setUpGrps();
|
||||
setUpGrps(GXS_SERV::FLAG_PRIVACY_PUBLIC);
|
||||
|
||||
/********************/
|
||||
|
||||
|
@ -858,7 +966,7 @@ bool GenExchangeTester::testSpecificMsgMetaRetrieval()
|
|||
mTestService->publishDummyMsg(token, msg);
|
||||
|
||||
// poll will block until found
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 4200;
|
||||
pollForToken(token, opts);
|
||||
RsGxsGrpMsgIdPair msgId;
|
||||
|
@ -955,7 +1063,7 @@ bool GenExchangeTester::testMsgIdRetrieval_OptParents()
|
|||
int nMsgs = (rand()%50)+2; // test a large number of msgs
|
||||
std::vector<RsDummyMsg*> msgs;
|
||||
createMsgs(msgs, nMsgs);
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 4000;
|
||||
uint32_t token;
|
||||
|
||||
|
@ -1053,7 +1161,7 @@ bool GenExchangeTester::testMsgIdRetrieval_OptOrigMsgId()
|
|||
int nMsgs = (rand()%50)+2; // test a large number of msgs
|
||||
std::vector<RsDummyMsg*> msgs;
|
||||
createMsgs(msgs, nMsgs);
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 4000;
|
||||
uint32_t token;
|
||||
|
||||
|
@ -1153,7 +1261,7 @@ bool GenExchangeTester::testMsgIdRetrieval_OptLatest()
|
|||
int nMsgs = (rand()%50)+2; // test a large number of msgs
|
||||
std::vector<RsDummyMsg*> msgs;
|
||||
createMsgs(msgs, nMsgs);
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 4000;
|
||||
uint32_t token;
|
||||
|
||||
|
@ -1499,7 +1607,7 @@ void GenExchangeTester::init(RsDummyMsg *msgItem) const
|
|||
init(msgItem->meta);
|
||||
}
|
||||
|
||||
void GenExchangeTester::pollForToken(uint32_t token, const RsTokReqOptionsV2 &opts)
|
||||
void GenExchangeTester::pollForToken(uint32_t token, const RsTokReqOptions &opts)
|
||||
{
|
||||
double timeDelta = 0.2;
|
||||
|
||||
|
@ -1511,8 +1619,8 @@ void GenExchangeTester::pollForToken(uint32_t token, const RsTokReqOptionsV2 &op
|
|||
Sleep((int) (timeDelta * 1000));
|
||||
#endif
|
||||
|
||||
if(RsTokenServiceV2::GXS_REQUEST_V2_STATUS_COMPLETE ==
|
||||
mTokenService->requestStatus(token))
|
||||
if((RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == mTokenService->requestStatus(token))
|
||||
|| (RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == mTokenService->requestStatus(token)))
|
||||
{
|
||||
switch(opts.mReqType)
|
||||
{
|
||||
|
@ -1534,6 +1642,9 @@ void GenExchangeTester::pollForToken(uint32_t token, const RsTokReqOptionsV2 &op
|
|||
case GXS_REQUEST_TYPE_MSG_IDS:
|
||||
mTestService->getMsgListTS(token, mMsgIdsIn);
|
||||
break;
|
||||
case GXS_REQUEST_TYPE_MSG_RELATED_IDS:
|
||||
mTestService->getMsgRelatedListTS(token, mMsgRelatedIdsIn);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -21,10 +21,11 @@ class GenExchangeTester
|
|||
{
|
||||
public:
|
||||
|
||||
void pollForToken(uint32_t, const RsTokReqOptionsV2& opts);
|
||||
void pollForToken(uint32_t, const RsTokReqOptions& opts);
|
||||
|
||||
GenExchangeTester();
|
||||
|
||||
// message tests
|
||||
bool testMsgSubmissionRetrieval();
|
||||
bool testMsgIdRetrieval();
|
||||
bool testMsgIdRetrieval_OptParents();
|
||||
|
@ -32,9 +33,12 @@ public:
|
|||
bool testMsgIdRetrieval_OptLatest();
|
||||
bool testSpecificMsgMetaRetrieval();
|
||||
|
||||
// request msg related tests
|
||||
bool testMsgChildRetrieval();
|
||||
bool testMsgAllVersions();
|
||||
|
||||
|
||||
// group tests
|
||||
bool testGrpSubmissionRetrieval();
|
||||
bool testSpecificGrpRetrieval();
|
||||
bool testGrpIdRetrieval();
|
||||
|
@ -52,7 +56,7 @@ private:
|
|||
void breakDown();
|
||||
|
||||
|
||||
void setUpGrps(); // to be called at start of msg tests
|
||||
void setUpGrps(uint32_t grpFlag=0); // to be called at start of msg tests
|
||||
|
||||
/*!
|
||||
* Can be called at start grpId or grpMeta test
|
||||
|
@ -92,17 +96,18 @@ private:
|
|||
GxsMsgMetaMap mMsgMetaDataOut, mMsgMetaDataIn;
|
||||
GxsMsgIdResult mMsgIdsOut, mMsgIdsIn;
|
||||
|
||||
MsgRelatedIdResult mMsgRelatedIdsOut, mMsgRelatedIdsIn;
|
||||
|
||||
std::vector<RsGxsGroupId> mRandGrpIds; // ids that exist to help group testing
|
||||
|
||||
private:
|
||||
|
||||
GenExchangeTestService* mTestService;
|
||||
RsTokenServiceV2* mTokenService;
|
||||
RsTokenService* mTokenService;
|
||||
|
||||
RsNetworkExchangeService* mNxs;
|
||||
RsGeneralDataService* mDataStore;
|
||||
|
||||
GxsCoreServer mGxsCore;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "genexchangetestservice.h"
|
||||
|
||||
GenExchangeTestService::GenExchangeTestService(RsGeneralDataService *dataServ, RsNetworkExchangeService * netService)
|
||||
: RsGenExchange(dataServ, netService, new RsDummySerialiser(), RS_SERVICE_TYPE_DUMMY)
|
||||
GenExchangeTestService::GenExchangeTestService(RsGeneralDataService *dataServ, RsNetworkExchangeService * netService,
|
||||
RsGixs* gixs, uint32_t authenPolicy)
|
||||
: RsGenExchange(dataServ, netService, new RsDummySerialiser(), RS_SERVICE_TYPE_DUMMY, gixs, authenPolicy)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -51,6 +52,11 @@ bool GenExchangeTestService::getMsgListTS(const uint32_t &token, GxsMsgIdResult
|
|||
return getMsgList(token, msgIds);
|
||||
}
|
||||
|
||||
bool GenExchangeTestService::getMsgRelatedListTS(const uint32_t &token, MsgRelatedIdResult &msgIds)
|
||||
{
|
||||
return getMsgRelatedList(token, msgIds);
|
||||
}
|
||||
|
||||
void GenExchangeTestService::setGroupServiceStringTS(uint32_t &token, const RsGxsGroupId &grpId, const std::string &servString)
|
||||
{
|
||||
RsGenExchange::setGroupServiceString(token, grpId, servString);
|
||||
|
@ -58,12 +64,12 @@ void GenExchangeTestService::setGroupServiceStringTS(uint32_t &token, const RsGx
|
|||
|
||||
void GenExchangeTestService::setGroupStatusFlagTS(uint32_t &token, const RsGxsGroupId &grpId, const uint32_t &status)
|
||||
{
|
||||
RsGenExchange::setGroupStatusFlag(token, grpId, status);
|
||||
RsGenExchange::setGroupStatusFlags(token, grpId, status, 0xff);
|
||||
}
|
||||
|
||||
void GenExchangeTestService::setGroupSubscribeFlagTS(uint32_t &token, const RsGxsGroupId &grpId, const uint32_t &status)
|
||||
{
|
||||
RsGenExchange::setGroupSubscribeFlag(token, grpId, status);
|
||||
RsGenExchange::setGroupSubscribeFlags(token, grpId, status, 0xff);
|
||||
}
|
||||
|
||||
void GenExchangeTestService::setMsgServiceStringTS(uint32_t &token, const RsGxsGrpMsgIdPair &msgId, const std::string &servString)
|
||||
|
@ -73,6 +79,10 @@ void GenExchangeTestService::setMsgServiceStringTS(uint32_t &token, const RsGxsG
|
|||
|
||||
void GenExchangeTestService::setMsgStatusFlagTS(uint32_t &token, const RsGxsGrpMsgIdPair &msgId, const uint32_t &status)
|
||||
{
|
||||
RsGenExchange::setMsgStatusFlag(token, msgId, status);
|
||||
RsGenExchange::setMsgStatusFlags(token, msgId, status, 0xff);
|
||||
}
|
||||
|
||||
void GenExchangeTestService::service_tick()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
#define GENEXCHANGETESTSERVICE_H
|
||||
|
||||
#include "gxs/rsgenexchange.h"
|
||||
#include "gxs/rsgxsifaceimpl.h"
|
||||
#include "rsdummyservices.h"
|
||||
|
||||
class GenExchangeTestService : public RsGenExchange
|
||||
{
|
||||
public:
|
||||
GenExchangeTestService(RsGeneralDataService* dataServ, RsNetworkExchangeService*);
|
||||
GenExchangeTestService(RsGeneralDataService* dataServ, RsNetworkExchangeService*, RsGixs* gixs, uint32_t authenPolicy);
|
||||
|
||||
void notifyChanges(std::vector<RsGxsNotify*>& changes);
|
||||
|
||||
|
@ -59,6 +60,13 @@ public:
|
|||
*/
|
||||
bool getMsgDataTS(const uint32_t &token, GxsMsgDataMap& msgItems);
|
||||
|
||||
/*!
|
||||
* Retrieve msg related list for a given token sectioned by group Ids
|
||||
* @param token token to be redeemed
|
||||
* @param msgIds a map of grpMsgIdPair -> msgList (vector)
|
||||
*/
|
||||
bool getMsgRelatedListTS(const uint32_t &token, MsgRelatedIdResult &msgIds);
|
||||
|
||||
|
||||
void setGroupSubscribeFlagTS(uint32_t& token, const RsGxsGroupId& grpId, const uint32_t& status);
|
||||
|
||||
|
@ -70,6 +78,8 @@ public:
|
|||
|
||||
void setMsgServiceStringTS(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, const std::string& servString );
|
||||
|
||||
void service_tick();
|
||||
|
||||
};
|
||||
|
||||
#endif // GENEXCHANGETESTSERVICE_H
|
||||
|
|
|
@ -15,13 +15,13 @@ CONFIG += gen_exchange_target
|
|||
#CONFIG += dstore_target
|
||||
#CONFIG += gxsdata_target
|
||||
|
||||
|
||||
CONFIG += bitdht
|
||||
|
||||
|
||||
|
||||
gen_exchange_target {
|
||||
|
||||
TARGET = gen_exchange_test
|
||||
#TARGET = gen_exchange_test
|
||||
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ TARGET = nxs_net_test
|
|||
|
||||
gxsdata_target {
|
||||
|
||||
TARGET = gxsdata_test
|
||||
#TARGET = gxsdata_test
|
||||
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,10 @@ win32 {
|
|||
GPGME_DIR = ../../../../gpgme-1.1.8
|
||||
GPG_ERROR_DIR = ../../../../lib/libgpg-error-1.7
|
||||
GPGME_DIR = ../../../../lib/gpgme-1.1.8
|
||||
INCLUDEPATH += . $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
|
||||
SSL_DIR = ../../../../../OpenSSL
|
||||
OPENPGPSDK_DIR = ../../../../openpgpsdk/src
|
||||
INCLUDEPATH += . $${SSL_DIR}/include $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src \
|
||||
$${OPENPGPSDK_DIR}
|
||||
|
||||
SQLITE_DIR = ../../../../../../Libraries/sqlite/sqlite-autoconf-3070900
|
||||
INCLUDEPATH += . \
|
||||
|
@ -186,48 +189,6 @@ gen_exchange_target {
|
|||
|
||||
}
|
||||
|
||||
nxs_net_test {
|
||||
|
||||
SOURCES += \
|
||||
support.cc \
|
||||
nxstesthub.cc \
|
||||
rsgxsnetservice_test.cc \
|
||||
nxstestscenario.cc \
|
||||
data_support.cc
|
||||
|
||||
|
||||
HEADERS += support.h \
|
||||
nxstesthub.h \
|
||||
rsgxsnetservice_test.h \
|
||||
nxstestscenario.h \
|
||||
data_support.h
|
||||
}
|
||||
|
||||
|
||||
dstore_target {
|
||||
TARGET = rs_dstore_test
|
||||
SOURCES += \
|
||||
support.cc \
|
||||
rsdataservice_test.cc \
|
||||
data_support.cc
|
||||
|
||||
HEADERS += support.h \
|
||||
rsdataservice_test.h \
|
||||
data_support.h
|
||||
|
||||
|
||||
}
|
||||
|
||||
gxsdata_target {
|
||||
|
||||
SOURCES += \
|
||||
support.cc \
|
||||
data_support.cc \
|
||||
rsgxsdata_test.cc
|
||||
|
||||
HEADERS += \
|
||||
support.h \
|
||||
rsgxsdata_test.h
|
||||
}
|
||||
|
||||
INCLUDEPATH += ../../
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
// dummy services to make
|
||||
|
||||
#include "gxs/rsnxs.h"
|
||||
#include "gxs/rsgixs.h"
|
||||
#include "serialiser/rsgxsitems.h"
|
||||
|
||||
class RsDummyNetService: public RsNetworkExchangeService
|
||||
|
@ -90,7 +91,75 @@ public:
|
|||
|
||||
};
|
||||
|
||||
/*!
|
||||
* Dummy implementation of Gixs service for
|
||||
* testing
|
||||
* Limited to creating two ids upon construction which can be used
|
||||
* for signing data
|
||||
*/
|
||||
class RsGixsDummy : public RsGixs
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* constructs keys for both incoming and outgoing id (no private keys for incoming id)
|
||||
* @param
|
||||
* @param dummyId This is is the only id thats exists in this dummy interface
|
||||
*/
|
||||
RsGixsDummy(const RsGxsId& incomingId, const RsGxsId& outgoingId){}
|
||||
|
||||
/*!
|
||||
*
|
||||
* @return id used for signing incoming data (should have both public and private components)
|
||||
*/
|
||||
const RsGxsId& getOutgoing(){ return mOutgoingId; }
|
||||
|
||||
/*!
|
||||
*
|
||||
* @return id used for signing outgoing data(only have public parts)
|
||||
*/
|
||||
const RsGxsId& getIncoming(){ return mIncomingId; }
|
||||
|
||||
// Key related interface - used for validating msgs and groups.
|
||||
/*!
|
||||
* Use to query a whether given key is available by its key reference
|
||||
* @param keyref the keyref of key that is being checked for
|
||||
* @return true if available, false otherwise
|
||||
*/
|
||||
bool haveKey(const RsGxsId &id){ return false;}
|
||||
|
||||
/*!
|
||||
* Use to query whether private key member of the given key reference is available
|
||||
* @param keyref the KeyRef of the key being checked for
|
||||
* @return true if private key is held here, false otherwise
|
||||
*/
|
||||
bool havePrivateKey(const RsGxsId &id){ return false; }
|
||||
|
||||
// The fetchKey has an optional peerList.. this is people that had the msg with the signature.
|
||||
// These same people should have the identity - so we ask them first.
|
||||
/*!
|
||||
* Use to request a given key reference
|
||||
* @param keyref the KeyRef of the key being requested
|
||||
* @return will
|
||||
*/
|
||||
bool requestKey(const RsGxsId &id, const std::list<PeerId> &peers){ return false ;}
|
||||
bool requestPrivateKey(const RsGxsId &id){ return false;}
|
||||
|
||||
|
||||
/*!
|
||||
* Retrieves a key identity
|
||||
* @param keyref
|
||||
* @return a pointer to a valid profile if successful, otherwise NULL
|
||||
*
|
||||
*/
|
||||
int getKey(const RsGxsId &id, RsTlvSecurityKey &key){ return false; }
|
||||
int getPrivateKey(const RsGxsId &id, RsTlvSecurityKey &key){ return false; } // For signing outgoing messages.
|
||||
|
||||
private:
|
||||
|
||||
RsGxsId mIncomingId, mOutgoingId;
|
||||
};
|
||||
|
||||
|
||||
#endif // RSDUMMYSERVICES_H
|
||||
|
|
|
@ -14,19 +14,20 @@ int main()
|
|||
{
|
||||
GenExchangeTester tester;
|
||||
|
||||
CHECK(tester.testMsgSubmissionRetrieval()); REPORT("testMsgSubmissionRetrieval()");
|
||||
// CHECK(tester.testMsgSubmissionRetrieval()); REPORT("testMsgSubmissionRetrieval()");
|
||||
// CHECK(tester.testSpecificMsgMetaRetrieval()); REPORT("testSpecificMsgMetaRetrieval()");
|
||||
// CHECK(tester.testMsgIdRetrieval()); REPORT("tester.testMsgIdRetrieval()");
|
||||
// CHECK(tester.testMsgIdRetrieval()); REPORT("tester.testMsgIdRetrieval()");
|
||||
// CHECK(tester.testMsgIdRetrieval_OptParents()); REPORT("tester.testRelatedMsgIdRetrieval_Parents()");
|
||||
// CHECK(tester.testMsgIdRetrieval_OptOrigMsgId()); REPORT("tester.testRelatedMsgIdRetrieval_OrigMsgId()");
|
||||
// CHECK(tester.testMsgIdRetrieval_OptLatest()); REPORT("tester.testRelatedMsgIdRetrieval_Latest()");
|
||||
CHECK(tester.testMsgIdRetrieval_OptOrigMsgId()); REPORT("tester.testRelatedMsgIdRetrieval_OrigMsgId()");
|
||||
CHECK(tester.testMsgIdRetrieval_OptLatest()); REPORT("tester.testRelatedMsgIdRetrieval_Latest()");
|
||||
CHECK(tester.testMsgMetaModRequest()); REPORT("tester.testMsgMetaModRequest()");
|
||||
CHECK(tester.testMsgChildRetrieval()); REPORT("tester.testMsgMetaModRequest()");
|
||||
// CHECK(tester.testMsgChildRetrieval()); REPORT("tester.testMsgMetaModRequest()");
|
||||
CHECK(tester.testMsgAllVersions()); REPORT("tester.testMsgAllVersions()");
|
||||
|
||||
CHECK(tester.testGrpSubmissionRetrieval()); REPORT("tester.testGrpSubmissionRetrieval()");
|
||||
CHECK(tester.testGrpMetaRetrieval()); REPORT("tester.testGrpMetaRetrieval()");
|
||||
CHECK(tester.testGrpIdRetrieval()); REPORT("tester.testGrpIdRetrieval()");
|
||||
CHECK(tester.testGrpMetaModRequest()); REPORT("tester.testGrpMetaModRequest()");
|
||||
// CHECK(tester.testGrpSubmissionRetrieval()); REPORT("tester.testGrpSubmissionRetrieval()");
|
||||
// CHECK(tester.testGrpMetaRetrieval()); REPORT("tester.testGrpMetaRetrieval()");
|
||||
// CHECK(tester.testGrpIdRetrieval()); REPORT("tester.testGrpIdRetrieval()");
|
||||
// CHECK(tester.testGrpMetaModRequest()); REPORT("tester.testGrpMetaModRequest()");
|
||||
|
||||
FINALREPORT("RsGenExchangeTest");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue