mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
All Msg and Grp meta modification tests done, no fixes needed!
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5475 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
932a1a44f5
commit
e99d84403d
@ -391,6 +391,8 @@ bool GenExchangeTester::testGrpMetaModRequest()
|
|||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
std::string newServiceString;
|
std::string newServiceString;
|
||||||
|
uint32_t newGrpStatus = randNum();
|
||||||
|
uint32_t newSubscribeGrpFlag = randNum();
|
||||||
randString(SHORT_STR, newServiceString);
|
randString(SHORT_STR, newServiceString);
|
||||||
|
|
||||||
// mod service flag for first grp
|
// mod service flag for first grp
|
||||||
@ -398,6 +400,14 @@ bool GenExchangeTester::testGrpMetaModRequest()
|
|||||||
pollForToken(token, opts);
|
pollForToken(token, opts);
|
||||||
ok = mTestService->acknowledgeTokenGrp(token, grpId);
|
ok = mTestService->acknowledgeTokenGrp(token, grpId);
|
||||||
|
|
||||||
|
mTestService->setGroupStatusFlagTS(token, grpIds[0], newGrpStatus);
|
||||||
|
pollForToken(token, opts);
|
||||||
|
ok = mTestService->acknowledgeTokenGrp(token, grpId);
|
||||||
|
|
||||||
|
mTestService->setGroupSubscribeFlagTS(token, grpIds[0], newSubscribeGrpFlag);
|
||||||
|
pollForToken(token, opts);
|
||||||
|
ok = mTestService->acknowledgeTokenGrp(token, grpId);
|
||||||
|
|
||||||
std::list<RsGxsGroupId> reqGrpIds;
|
std::list<RsGxsGroupId> reqGrpIds;
|
||||||
reqGrpIds.push_back(grpIds[0]);
|
reqGrpIds.push_back(grpIds[0]);
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||||
@ -416,6 +426,13 @@ bool GenExchangeTester::testGrpMetaModRequest()
|
|||||||
if(meta.mServiceString != newServiceString)
|
if(meta.mServiceString != newServiceString)
|
||||||
ok = false;
|
ok = false;
|
||||||
|
|
||||||
|
if(meta.mSubscribeFlags != newSubscribeGrpFlag)
|
||||||
|
ok = false;
|
||||||
|
|
||||||
|
if(meta.mGroupStatus != newGrpStatus)
|
||||||
|
ok = false;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
breakDown();
|
breakDown();
|
||||||
@ -425,8 +442,6 @@ bool GenExchangeTester::testGrpMetaModRequest()
|
|||||||
|
|
||||||
void GenExchangeTester::setUpLargeGrps(uint32_t nGrps)
|
void GenExchangeTester::setUpLargeGrps(uint32_t nGrps)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
for(int i=0; i < nGrps; i++)
|
for(int i=0; i < nGrps; i++)
|
||||||
{
|
{
|
||||||
RsDummyGrp* dgrp = new RsDummyGrp();
|
RsDummyGrp* dgrp = new RsDummyGrp();
|
||||||
@ -442,6 +457,97 @@ void GenExchangeTester::setUpLargeGrps(uint32_t nGrps)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GenExchangeTester::testMsgMetaModRequest()
|
||||||
|
{
|
||||||
|
setUp();
|
||||||
|
setUpGrps();
|
||||||
|
|
||||||
|
RsDummyMsg* msg = new RsDummyMsg();
|
||||||
|
init(msg);
|
||||||
|
|
||||||
|
msg->meta.mGroupId = mRandGrpIds[(rand()%3)];
|
||||||
|
uint32_t token;
|
||||||
|
RsDummyMsg* msgOut = new RsDummyMsg();
|
||||||
|
*msgOut = *msg;
|
||||||
|
mTestService->publishDummyMsg(token, msg);
|
||||||
|
|
||||||
|
// poll will block until found
|
||||||
|
RsTokReqOptionsV2 opts;
|
||||||
|
opts.mReqType = 4200;
|
||||||
|
pollForToken(token, opts);
|
||||||
|
RsGxsGrpMsgIdPair msgId;
|
||||||
|
|
||||||
|
mTestService->acknowledgeTokenMsg(token, msgId);
|
||||||
|
|
||||||
|
if(msgId.first.empty() || msgId.second.empty()){
|
||||||
|
breakDown();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string newServiceString;
|
||||||
|
randString(SHORT_STR, newServiceString);
|
||||||
|
|
||||||
|
// first modify service string
|
||||||
|
mTestService->setMsgServiceStringTS(token, msgId, newServiceString);
|
||||||
|
pollForToken(token, opts);
|
||||||
|
|
||||||
|
mTestService->acknowledgeTokenMsg(token, msgId);
|
||||||
|
|
||||||
|
uint32_t newStatus = 2;
|
||||||
|
// first modify service string
|
||||||
|
mTestService->setMsgStatusFlagTS(token, msgId, newStatus);
|
||||||
|
pollForToken(token, opts);
|
||||||
|
|
||||||
|
mTestService->acknowledgeTokenMsg(token, msgId);
|
||||||
|
|
||||||
|
// now request msg
|
||||||
|
GxsMsgReq req;
|
||||||
|
std::vector<RsGxsMessageId> msgV;
|
||||||
|
msgV.push_back(msgId.second);
|
||||||
|
req.insert(std::make_pair(msgId.first, msgV));
|
||||||
|
|
||||||
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_META;
|
||||||
|
mTokenService->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, req);
|
||||||
|
|
||||||
|
// poll again
|
||||||
|
pollForToken(token, opts);
|
||||||
|
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
if(mMsgMetaDataIn.empty())
|
||||||
|
ok = false;
|
||||||
|
|
||||||
|
if(ok){
|
||||||
|
|
||||||
|
GxsMsgMetaMap::iterator mit = mMsgMetaDataIn.begin();
|
||||||
|
std::vector<RsMsgMetaData>& metaV = mit->second;
|
||||||
|
|
||||||
|
RsMsgMetaData meta;
|
||||||
|
if(metaV.empty()){
|
||||||
|
ok = false;
|
||||||
|
}else{
|
||||||
|
meta = *(metaV.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(meta.mServiceString != newServiceString)
|
||||||
|
ok &= false;
|
||||||
|
|
||||||
|
if(meta.mMsgStatus != newStatus)
|
||||||
|
ok &= false;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************/
|
||||||
|
|
||||||
|
// complete
|
||||||
|
breakDown();
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bool GenExchangeTester::testMsgSubmissionRetrieval()
|
bool GenExchangeTester::testMsgSubmissionRetrieval()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ int main()
|
|||||||
CHECK(tester.testRelatedMsgIdRetrieval_Parents()); REPORT("tester.testRelatedMsgIdRetrieval_Parents()");
|
CHECK(tester.testRelatedMsgIdRetrieval_Parents()); REPORT("tester.testRelatedMsgIdRetrieval_Parents()");
|
||||||
CHECK(tester.testRelatedMsgIdRetrieval_OrigMsgId()); REPORT("tester.testRelatedMsgIdRetrieval_OrigMsgId()");
|
CHECK(tester.testRelatedMsgIdRetrieval_OrigMsgId()); REPORT("tester.testRelatedMsgIdRetrieval_OrigMsgId()");
|
||||||
CHECK(tester.testRelatedMsgIdRetrieval_Latest()); REPORT("tester.testRelatedMsgIdRetrieval_Latest()");
|
CHECK(tester.testRelatedMsgIdRetrieval_Latest()); REPORT("tester.testRelatedMsgIdRetrieval_Latest()");
|
||||||
|
CHECK(tester.testMsgMetaModRequest()); REPORT("tester.testMsgMetaModRequest()");
|
||||||
|
|
||||||
CHECK(tester.testGrpSubmissionRetrieval()); REPORT("tester.testGrpSubmissionRetrieval()");
|
CHECK(tester.testGrpSubmissionRetrieval()); REPORT("tester.testGrpSubmissionRetrieval()");
|
||||||
CHECK(tester.testGrpMetaRetrieval()); REPORT("tester.testGrpMetaRetrieval()");
|
CHECK(tester.testGrpMetaRetrieval()); REPORT("tester.testGrpMetaRetrieval()");
|
||||||
|
Loading…
Reference in New Issue
Block a user