mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 00:49:41 -05:00
added gxs group tests (submission, all retrieval types)
also tested group meta mod request for service strings all group and msg submission and retrieval requests now tested msg meta mod request to test still Added fixes: genexchange (mGrpSign was not included in overloaded assignment operator) added grp sign flag as Db field git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5473 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a6cb2b6a35
commit
932a1a44f5
@ -51,6 +51,7 @@
|
||||
#define KEY_ADMIN_SIGN std::string("adminSign")
|
||||
#define KEY_KEY_SET std::string("keySet")
|
||||
#define KEY_GRP_NAME std::string("grpName")
|
||||
#define KEY_GRP_SIGN_FLAGS std::string("signFlags")
|
||||
|
||||
// grp local
|
||||
#define KEY_GRP_SUBCR_FLAG std::string("subscribeFlag")
|
||||
@ -99,6 +100,7 @@
|
||||
#define COL_GRP_LAST_POST 12
|
||||
#define COL_ORIG_GRP_ID 13
|
||||
#define COL_GRP_SERV_STRING 14
|
||||
#define COL_GRP_SIGN_FLAGS 15
|
||||
|
||||
// msg col numbers
|
||||
#define COL_PUBLISH_SIGN 5
|
||||
@ -151,6 +153,7 @@ RsDataService::RsDataService(const std::string &serviceDir, const std::string &d
|
||||
grpMetaColumns.push_back(KEY_KEY_SET); grpMetaColumns.push_back(KEY_GRP_SUBCR_FLAG); grpMetaColumns.push_back(KEY_GRP_POP);
|
||||
grpMetaColumns.push_back(KEY_MSG_COUNT); grpMetaColumns.push_back(KEY_GRP_STATUS); grpMetaColumns.push_back(KEY_GRP_NAME);
|
||||
grpMetaColumns.push_back(KEY_GRP_LAST_POST); grpMetaColumns.push_back(KEY_ORIG_GRP_ID); grpMetaColumns.push_back(KEY_NXS_SERV_STRING);
|
||||
grpMetaColumns.push_back(KEY_GRP_SIGN_FLAGS);
|
||||
|
||||
// for retrieving actual grp data
|
||||
grpColumns.push_back(KEY_GRP_ID); grpColumns.push_back(KEY_NXS_FILE); grpColumns.push_back(KEY_NXS_FILE_OFFSET);
|
||||
@ -208,6 +211,7 @@ void RsDataService::initialise(){
|
||||
KEY_ORIG_GRP_ID + " TEXT," +
|
||||
KEY_NXS_SERV_STRING + " TEXT," +
|
||||
KEY_NXS_FLAGS + " INT," +
|
||||
KEY_GRP_SIGN_FLAGS + " INT," +
|
||||
KEY_IDENTITY_SIGN + " BLOB);");
|
||||
|
||||
}
|
||||
@ -234,6 +238,7 @@ RsGxsGrpMetaData* RsDataService::getGrpMeta(RetroCursor &c)
|
||||
c.getString(COL_GRP_NAME, grpMeta->mGroupName);
|
||||
c.getString(COL_ORIG_GRP_ID, grpMeta->mOrigGrpId);
|
||||
c.getString(COL_GRP_SERV_STRING, grpMeta->mServiceString);
|
||||
grpMeta->mSignFlags = c.getInt32(COL_GRP_SIGN_FLAGS);
|
||||
|
||||
grpMeta->mPublishTs = c.getInt32(COL_TIME_STAMP);
|
||||
grpMeta->mGroupFlags = c.getInt32(COL_NXS_FLAGS);
|
||||
@ -540,6 +545,7 @@ int RsDataService::storeGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
|
||||
cv.put(KEY_NXS_SERV_STRING, grpMetaPtr->mServiceString);
|
||||
cv.put(KEY_NXS_FLAGS, (int32_t)grpMetaPtr->mGroupFlags);
|
||||
cv.put(KEY_TIME_STAMP, (int32_t)grpMetaPtr->mPublishTs);
|
||||
cv.put(KEY_GRP_SIGN_FLAGS, (int32_t)grpMetaPtr->mSignFlags);
|
||||
|
||||
if(! (grpMetaPtr->mAuthorId.empty()) ){
|
||||
cv.put(KEY_NXS_IDENTITY, grpMetaPtr->mAuthorId);
|
||||
@ -857,26 +863,62 @@ void RsDataService::retrieveMsgMeta(RetroCursor *c, std::vector<RsGxsMsgMetaData
|
||||
}
|
||||
}
|
||||
|
||||
int RsDataService::retrieveGxsGrpMetaData(std::map<std::string, RsGxsGrpMetaData *>& grp)
|
||||
int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaData *>& grp)
|
||||
{
|
||||
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, grpMetaColumns, "", "");
|
||||
|
||||
if(c)
|
||||
{
|
||||
bool valid = c->moveToFirst();
|
||||
|
||||
while(valid)
|
||||
if(grp.empty()){
|
||||
|
||||
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, grpMetaColumns, "", "");
|
||||
|
||||
if(c)
|
||||
{
|
||||
RsGxsGrpMetaData* g = getGrpMeta(*c);
|
||||
bool valid = c->moveToFirst();
|
||||
|
||||
if(g)
|
||||
while(valid)
|
||||
{
|
||||
grp[g->mGroupId] = g;
|
||||
RsGxsGrpMetaData* g = getGrpMeta(*c);
|
||||
|
||||
if(g)
|
||||
{
|
||||
grp[g->mGroupId] = g;
|
||||
}
|
||||
valid = c->moveToNext();
|
||||
}
|
||||
valid = c->moveToNext();
|
||||
delete c;
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
|
||||
std::map<RsGxsGroupId, RsGxsGrpMetaData *>::iterator mit = grp.begin();
|
||||
|
||||
for(; mit != grp.end(); mit++)
|
||||
{
|
||||
const RsGxsGroupId& grpId = mit->first;
|
||||
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, grpMetaColumns, "grpId='" + grpId + "'", "");
|
||||
|
||||
if(c)
|
||||
{
|
||||
bool valid = c->moveToFirst();
|
||||
|
||||
while(valid)
|
||||
{
|
||||
RsGxsGrpMetaData* g = getGrpMeta(*c);
|
||||
|
||||
if(g)
|
||||
{
|
||||
grp[g->mGroupId] = g;
|
||||
}
|
||||
valid = c->moveToNext();
|
||||
}
|
||||
delete c;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
delete c;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -624,20 +624,21 @@ void RsGenExchange::publishGrps()
|
||||
|
||||
if(ok)
|
||||
{
|
||||
grp->metaData = new RsGxsGrpMetaData();
|
||||
*(grp->metaData) = grpItem->meta;
|
||||
createGroup(grp);
|
||||
size = grp->metaData->serial_size();
|
||||
char mData[size];
|
||||
grp->metaData->mGroupId = grp->grpId;
|
||||
ok = grp->metaData->serialise(mData, size);
|
||||
grp->meta.setBinData(mData, size);
|
||||
grp->metaData = new RsGxsGrpMetaData();
|
||||
grpItem->meta.mPublishTs = time(NULL);
|
||||
*(grp->metaData) = grpItem->meta;
|
||||
createGroup(grp);
|
||||
size = grp->metaData->serial_size();
|
||||
char mData[size];
|
||||
grp->metaData->mGroupId = grp->grpId;
|
||||
ok = grp->metaData->serialise(mData, size);
|
||||
grp->meta.setBinData(mData, size);
|
||||
|
||||
ok = mDataAccess->addGroupData(grp);
|
||||
ok = mDataAccess->addGroupData(grp);
|
||||
|
||||
// add to published to allow acknowledgement
|
||||
mGrpNotify.insert(std::make_pair(mit->first, grp->grpId));
|
||||
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenServiceV2::GXS_REQUEST_STATUS_COMPLETE);
|
||||
// add to published to allow acknowledgement
|
||||
mGrpNotify.insert(std::make_pair(mit->first, grp->grpId));
|
||||
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenServiceV2::GXS_REQUEST_STATUS_COMPLETE);
|
||||
}
|
||||
|
||||
if(!ok)
|
||||
|
@ -268,6 +268,7 @@ void RsGxsGrpMetaData::operator =(const RsGroupMetaData& rMeta)
|
||||
this->mSubscribeFlags = rMeta.mSubscribeFlags;
|
||||
this->mGroupName = rMeta.mGroupName;
|
||||
this->mServiceString = rMeta.mServiceString;
|
||||
this->mSignFlags = rMeta.mSignFlags;
|
||||
}
|
||||
|
||||
void RsGxsMsgMetaData::operator =(const RsMsgMetaData& rMeta)
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
std::string mGroupName;
|
||||
uint32_t mGroupFlags;
|
||||
uint32_t mPublishTs;
|
||||
uint32_t mSignFlags;
|
||||
std::string mAuthorId;
|
||||
|
||||
|
||||
|
@ -327,9 +327,9 @@ private:
|
||||
private:
|
||||
|
||||
RsGeneralDataService* mDataStore;
|
||||
uint32_t mNextToken;
|
||||
std::map<uint32_t, uint32_t> mPublicToken;
|
||||
std::map<uint32_t, GxsRequest*> mRequests;
|
||||
uint32_t mNextToken;
|
||||
std::map<uint32_t, uint32_t> mPublicToken;
|
||||
std::map<uint32_t, GxsRequest*> mRequests;
|
||||
|
||||
RsMutex mDataMutex;
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
this->mPublishTs = rGxsMeta.mPublishTs;
|
||||
this->mThreadId = rGxsMeta.mThreadId;
|
||||
this->mServiceString = rGxsMeta.mServiceString;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -39,4 +40,5 @@
|
||||
this->mSubscribeFlags = rGxsMeta.mSubscribeFlags;
|
||||
this->mGroupName = rGxsMeta.mGroupName;
|
||||
this->mServiceString = rGxsMeta.mServiceString;
|
||||
this->mSignFlags = rGxsMeta.mSignFlags;
|
||||
}
|
||||
|
@ -126,6 +126,321 @@ void GenExchangeTester::breakDown()
|
||||
mGrpMetaDataOut.clear();
|
||||
}
|
||||
|
||||
bool GenExchangeTester::testGrpSubmissionRetrieval()
|
||||
{
|
||||
|
||||
|
||||
setUp();
|
||||
|
||||
// create some random grps to allow msg testing
|
||||
|
||||
RsDummyGrp* dgrp1 = new RsDummyGrp();
|
||||
RsDummyGrp* dgrp2 = new RsDummyGrp();
|
||||
RsDummyGrp* dgrp3 = new RsDummyGrp();
|
||||
|
||||
RsDummyGrp* dgrp1_copy = new RsDummyGrp();
|
||||
RsDummyGrp* dgrp2_copy = new RsDummyGrp();
|
||||
RsDummyGrp* dgrp3_copy = new RsDummyGrp();
|
||||
|
||||
init(dgrp1);
|
||||
init(dgrp2);
|
||||
init(dgrp3);
|
||||
|
||||
RsTokReqOptionsV2 opts;
|
||||
opts.mReqType = 45000;
|
||||
uint32_t token;
|
||||
RsGxsGroupId grpId;
|
||||
|
||||
*dgrp1_copy = *dgrp1;
|
||||
mTestService->publishDummyGrp(token, dgrp1);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
dgrp1_copy->meta.mGroupId = grpId;
|
||||
mGrpDataOut.push_back(dgrp1_copy);
|
||||
|
||||
*dgrp2_copy = *dgrp2;
|
||||
mTestService->publishDummyGrp(token, dgrp2);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
dgrp2_copy->meta.mGroupId = grpId;
|
||||
mGrpDataOut.push_back(dgrp2_copy);
|
||||
|
||||
*dgrp3_copy = *dgrp3;
|
||||
mTestService->publishDummyGrp(token, dgrp3);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
dgrp3_copy->meta.mGroupId = grpId;
|
||||
mGrpDataOut.push_back(dgrp3_copy);
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
mTokenService->requestGroupInfo(token, 0, opts, grpIds);
|
||||
|
||||
pollForToken(token, opts);
|
||||
|
||||
std::vector<RsGxsGrpItem*>::iterator lit_out = mGrpDataOut.begin();
|
||||
|
||||
bool ok = true;
|
||||
|
||||
for(; lit_out != mGrpDataOut.end(); lit_out++)
|
||||
{
|
||||
RsDummyGrp* grpOut = dynamic_cast<RsDummyGrp*>(*lit_out);
|
||||
if(!grpOut)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::vector<RsGxsGrpItem*>::iterator lit_in = mGrpDataIn.begin();
|
||||
|
||||
bool found = true;
|
||||
for(; lit_in != mGrpDataIn.end(); lit_in++)
|
||||
{
|
||||
RsDummyGrp* grpIn = dynamic_cast<RsDummyGrp*>(*lit_in);
|
||||
|
||||
if(!grpIn)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(grpIn->meta.mGroupId == grpOut->meta.mGroupId)
|
||||
{
|
||||
found = true;
|
||||
ok &= *grpIn == *grpOut;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
breakDown();
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool GenExchangeTester::testGrpMetaRetrieval()
|
||||
{
|
||||
setUp();
|
||||
|
||||
// create some random grps to allow msg testing
|
||||
|
||||
RsDummyGrp* dgrp1 = new RsDummyGrp();
|
||||
RsDummyGrp* dgrp2 = new RsDummyGrp();
|
||||
RsDummyGrp* dgrp3 = new RsDummyGrp();
|
||||
|
||||
init(dgrp1);
|
||||
init(dgrp2);
|
||||
init(dgrp3);
|
||||
|
||||
RsTokReqOptionsV2 opts;
|
||||
opts.mReqType = 45000;
|
||||
uint32_t token;
|
||||
RsGxsGroupId grpId;
|
||||
|
||||
RsGroupMetaData tempMeta;
|
||||
|
||||
tempMeta = dgrp1->meta;
|
||||
mTestService->publishDummyGrp(token, dgrp1);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
tempMeta.mGroupId = grpId;
|
||||
mGrpMetaDataOut.push_back(tempMeta);
|
||||
|
||||
|
||||
tempMeta = dgrp2->meta;
|
||||
mTestService->publishDummyGrp(token, dgrp2);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
tempMeta.mGroupId = grpId;
|
||||
mGrpMetaDataOut.push_back(tempMeta);
|
||||
|
||||
tempMeta = dgrp3->meta;
|
||||
mTestService->publishDummyGrp(token, dgrp3);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
tempMeta.mGroupId = grpId;
|
||||
mGrpMetaDataOut.push_back(tempMeta);
|
||||
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
mTokenService->requestGroupInfo(token, 0, opts, grpIds);
|
||||
|
||||
pollForToken(token, opts);
|
||||
|
||||
std::list<RsGroupMetaData>::iterator lit_out = mGrpMetaDataOut.begin();
|
||||
|
||||
bool ok = true;
|
||||
|
||||
for(; lit_out != mGrpMetaDataOut.end(); lit_out++)
|
||||
{
|
||||
const RsGroupMetaData& grpMetaOut = *lit_out;
|
||||
|
||||
std::list<RsGroupMetaData>::iterator lit_in = mGrpMetaDataIn.begin();
|
||||
|
||||
bool found = true;
|
||||
for(; lit_in != mGrpMetaDataIn.end(); lit_in++)
|
||||
{
|
||||
const RsGroupMetaData& grpMetaIn = *lit_in;
|
||||
|
||||
if(grpMetaOut.mGroupId == grpMetaIn.mGroupId)
|
||||
{
|
||||
found = true;
|
||||
ok &= grpMetaIn == grpMetaOut;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
breakDown();
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool GenExchangeTester::testGrpIdRetrieval()
|
||||
{
|
||||
setUp();
|
||||
setUpLargeGrps(30); // create a large amount of grps
|
||||
|
||||
|
||||
RsTokReqOptionsV2 opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_IDS;
|
||||
uint32_t token;
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
mTokenService->requestGroupInfo(token, 0, opts, grpIds);
|
||||
|
||||
pollForToken(token, opts);
|
||||
|
||||
std::list<RsGxsGroupId>::iterator lit_out = mGrpIdsOut.begin();
|
||||
|
||||
bool ok = true;
|
||||
|
||||
for(; lit_out != mGrpIdsOut.end(); lit_out++)
|
||||
{
|
||||
std::list<RsGxsGroupId>::iterator lit_in = mGrpIdsIn.begin();
|
||||
|
||||
bool found = true;
|
||||
for(; lit_in != mGrpIdsIn.end(); lit_in++)
|
||||
{
|
||||
|
||||
if(*lit_out == *lit_in)
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
breakDown();
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
bool GenExchangeTester::testGrpMetaModRequest()
|
||||
{
|
||||
|
||||
setUp();
|
||||
|
||||
// create some random grps to allow msg testing
|
||||
|
||||
RsDummyGrp* dgrp1 = new RsDummyGrp();
|
||||
RsDummyGrp* dgrp2 = new RsDummyGrp();
|
||||
RsDummyGrp* dgrp3 = new RsDummyGrp();
|
||||
init(dgrp1);
|
||||
init(dgrp2);
|
||||
init(dgrp3);
|
||||
|
||||
uint32_t token;
|
||||
RsTokReqOptionsV2 opts;
|
||||
opts.mReqType = 45000;
|
||||
std::vector<RsGxsGroupId> grpIds;
|
||||
RsGxsGroupId grpId;
|
||||
|
||||
mTestService->publishDummyGrp(token, dgrp1);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
grpIds.push_back(grpId);
|
||||
|
||||
mTestService->publishDummyGrp(token, dgrp2);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
grpIds.push_back(grpId);
|
||||
|
||||
mTestService->publishDummyGrp(token, dgrp3);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
grpIds.push_back(grpId);
|
||||
|
||||
bool ok = true;
|
||||
|
||||
std::string newServiceString;
|
||||
randString(SHORT_STR, newServiceString);
|
||||
|
||||
// mod service flag for first grp
|
||||
mTestService->setGroupServiceStringTS(token, grpIds[0], newServiceString);
|
||||
pollForToken(token, opts);
|
||||
ok = mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
|
||||
std::list<RsGxsGroupId> reqGrpIds;
|
||||
reqGrpIds.push_back(grpIds[0]);
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||
mTokenService->requestGroupInfo(token, 0, opts, reqGrpIds);
|
||||
pollForToken(token, opts);
|
||||
|
||||
|
||||
|
||||
if(mGrpMetaDataIn.empty())
|
||||
ok = false;
|
||||
|
||||
if(ok)
|
||||
{
|
||||
RsGroupMetaData meta = *(mGrpMetaDataIn.begin());
|
||||
|
||||
if(meta.mServiceString != newServiceString)
|
||||
ok = false;
|
||||
|
||||
}
|
||||
|
||||
breakDown();
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTester::setUpLargeGrps(uint32_t nGrps)
|
||||
{
|
||||
|
||||
|
||||
for(int i=0; i < nGrps; i++)
|
||||
{
|
||||
RsDummyGrp* dgrp = new RsDummyGrp();
|
||||
RsGxsGroupId grpId;
|
||||
uint32_t token;
|
||||
init(dgrp);
|
||||
RsTokReqOptionsV2 opts;
|
||||
opts.mReqType = 4000;
|
||||
mTestService->publishDummyGrp(token, dgrp);
|
||||
pollForToken(token, opts);
|
||||
mTestService->acknowledgeTokenGrp(token, grpId);
|
||||
mGrpIdsOut.push_back(grpId);
|
||||
}
|
||||
}
|
||||
|
||||
bool GenExchangeTester::testMsgSubmissionRetrieval()
|
||||
{
|
||||
@ -821,18 +1136,6 @@ void GenExchangeTester::createMsgs(std::vector<RsDummyMsg *> &msgs, int nMsgs) c
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool GenExchangeTester::testGrpIdRetrieval()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GenExchangeTester::testGrpMetaModRequest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// helper functions
|
||||
|
||||
void GenExchangeTester::storeGrpMeta(std::list<RsGroupMetaData> &grpMetaData){
|
||||
@ -870,6 +1173,21 @@ void GenExchangeTester::storeMsgIds(GxsMsgIdResult &msgIds)
|
||||
|
||||
void GenExchangeTester::init(RsGroupMetaData &grpMeta) const
|
||||
{
|
||||
randString(SHORT_STR, grpMeta.mGroupId);
|
||||
randString(SHORT_STR, grpMeta.mAuthorId);
|
||||
randString(SHORT_STR, grpMeta.mGroupName);
|
||||
randString(SHORT_STR, grpMeta.mServiceString);
|
||||
|
||||
|
||||
grpMeta.mGroupFlags = randNum();
|
||||
grpMeta.mLastPost = randNum();
|
||||
grpMeta.mGroupStatus = randNum();
|
||||
grpMeta.mMsgCount = randNum();
|
||||
grpMeta.mPop = randNum();
|
||||
grpMeta.mSignFlags = randNum();
|
||||
grpMeta.mPublishTs = randNum();
|
||||
grpMeta.mSubscribeFlags = randNum();
|
||||
|
||||
}
|
||||
|
||||
void GenExchangeTester::init(RsMsgMetaData &msgMeta) const
|
||||
@ -913,6 +1231,35 @@ bool operator ==(const RsMsgMetaData& lMeta, const RsMsgMetaData& rMeta)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator ==(const RsGroupMetaData& lMeta, const RsGroupMetaData& rMeta)
|
||||
{
|
||||
if(lMeta.mAuthorId != rMeta.mAuthorId) return false;
|
||||
if(lMeta.mGroupFlags != rMeta.mGroupFlags) return false;
|
||||
if(lMeta.mGroupId != rMeta.mGroupId) return false;
|
||||
if(lMeta.mGroupName != rMeta.mGroupName) return false;
|
||||
if(lMeta.mGroupStatus != rMeta.mGroupStatus) return false;
|
||||
if(lMeta.mLastPost != rMeta.mLastPost) return false;
|
||||
if(lMeta.mMsgCount != rMeta.mMsgCount) return false;
|
||||
if(lMeta.mPop != rMeta.mPop) return false;
|
||||
// if(lMeta.mPublishTs != rMeta.mPublishTs) return false; set in gxs
|
||||
if(lMeta.mServiceString != rMeta.mServiceString) return false;
|
||||
if(lMeta.mSignFlags != rMeta.mSignFlags) return false;
|
||||
if(lMeta.mSubscribeFlags != rMeta.mSubscribeFlags) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator ==(const RsDummyGrp& lGrp, const RsDummyGrp& rGrp)
|
||||
{
|
||||
|
||||
if(lGrp.grpData != rGrp.grpData) return false;
|
||||
if(! (lGrp.meta == rGrp.meta)) return false;
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool operator ==(const RsDummyMsg& lMsg, const RsDummyMsg& rMsg)
|
||||
{
|
||||
if(lMsg.msgData != rMsg.msgData) return false;
|
||||
@ -923,7 +1270,8 @@ bool operator ==(const RsDummyMsg& lMsg, const RsDummyMsg& rMsg)
|
||||
|
||||
void GenExchangeTester::init(RsDummyGrp *grpItem) const
|
||||
{
|
||||
|
||||
randString(SHORT_STR, grpItem->grpData);
|
||||
init(grpItem->meta);
|
||||
}
|
||||
|
||||
void GenExchangeTester::init(RsDummyMsg *msgItem) const
|
||||
|
@ -9,6 +9,9 @@
|
||||
bool operator ==(const RsMsgMetaData& lMeta, const RsMsgMetaData& rMeta);
|
||||
bool operator ==(const RsDummyMsg& lMsg, const RsDummyMsg& rMsg);
|
||||
|
||||
bool operator ==(const RsGroupMetaData& lMeta, const RsGroupMetaData& rMeta);
|
||||
bool operator ==(const RsDummyGrp& lMsg, const RsDummyGrp& rMsg);
|
||||
|
||||
/*!
|
||||
* The job of the service tester is to send dummy msg items to the GenExchange service
|
||||
* and then retrieve them (ignoring ackowledge message)
|
||||
@ -48,6 +51,13 @@ private:
|
||||
|
||||
void setUpGrps(); // to be called at start of msg tests
|
||||
|
||||
/*!
|
||||
* Can be called at start grpId or grpMeta test
|
||||
* to help out
|
||||
* ids are store is mGrpIdsOut
|
||||
*/
|
||||
void setUpLargeGrps(uint32_t nGrps);
|
||||
|
||||
void storeMsgData(GxsMsgDataMap& msgData);
|
||||
void storeMsgMeta(GxsMsgMetaMap& msgMetaData);
|
||||
void storeMsgIds(GxsMsgIdResult& msgIds);
|
||||
|
@ -50,3 +50,29 @@ bool GenExchangeTestService::getMsgListTS(const uint32_t &token, GxsMsgIdResult
|
||||
{
|
||||
return getMsgList(token, msgIds);
|
||||
}
|
||||
|
||||
void GenExchangeTestService::setGroupServiceStringTS(uint32_t &token, const RsGxsGroupId &grpId, const std::string &servString)
|
||||
{
|
||||
RsGenExchange::setGroupServiceString(token, grpId, servString);
|
||||
}
|
||||
|
||||
void GenExchangeTestService::setGroupStatusFlagTS(uint32_t &token, const RsGxsGroupId &grpId, const uint32_t &status)
|
||||
{
|
||||
RsGenExchange::setGroupStatusFlag(token, grpId, status);
|
||||
}
|
||||
|
||||
void GenExchangeTestService::setGroupSubscribeFlagTS(uint32_t &token, const RsGxsGroupId &grpId, const uint32_t &status)
|
||||
{
|
||||
RsGenExchange::setGroupSubscribeFlag(token, grpId, status);
|
||||
}
|
||||
|
||||
void GenExchangeTestService::setMsgServiceStringTS(uint32_t &token, const RsGxsGrpMsgIdPair &msgId, const std::string &servString)
|
||||
{
|
||||
RsGenExchange::setMsgServiceString(token, msgId, servString);
|
||||
}
|
||||
|
||||
void GenExchangeTestService::setMsgStatusFlagTS(uint32_t &token, const RsGxsGrpMsgIdPair &msgId, const uint32_t &status)
|
||||
{
|
||||
RsGenExchange::setMsgStatusFlag(token, msgId, status);
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,17 @@ public:
|
||||
*/
|
||||
bool getMsgDataTS(const uint32_t &token, GxsMsgDataMap& msgItems);
|
||||
|
||||
|
||||
void setGroupSubscribeFlagTS(uint32_t& token, const RsGxsGroupId& grpId, const uint32_t& status);
|
||||
|
||||
void setGroupStatusFlagTS(uint32_t& token, const RsGxsGroupId& grpId, const uint32_t& status);
|
||||
|
||||
void setGroupServiceStringTS(uint32_t& token, const RsGxsGroupId& grpId, const std::string& servString);
|
||||
|
||||
void setMsgStatusFlagTS(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, const uint32_t& status);
|
||||
|
||||
void setMsgServiceStringTS(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, const std::string& servString );
|
||||
|
||||
};
|
||||
|
||||
#endif // GENEXCHANGETESTSERVICE_H
|
||||
|
@ -21,6 +21,11 @@ int main()
|
||||
CHECK(tester.testRelatedMsgIdRetrieval_OrigMsgId()); REPORT("tester.testRelatedMsgIdRetrieval_OrigMsgId()");
|
||||
CHECK(tester.testRelatedMsgIdRetrieval_Latest()); REPORT("tester.testRelatedMsgIdRetrieval_Latest()");
|
||||
|
||||
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");
|
||||
|
||||
return 0;
|
||||
|
@ -476,7 +476,6 @@ bool RetroDb::sqlUpdate(const std::string &tableName, std::string whereClause, c
|
||||
|
||||
// execute query
|
||||
return execSQL(sqlQuery);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user