mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-22 07:41:20 -04:00
Nxs items now do not support the concept of version
timestamp has been added to grp sync item updated data service and grps to deal with this added msg and grp meta types which serves to hold meta data of grp and msg removed observer temporarily updated nxs item tests, need to update data service tests git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5256 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
03e2ee72e0
commit
d533a2e580
15 changed files with 965 additions and 729 deletions
|
@ -11,26 +11,12 @@ INITTEST();
|
|||
|
||||
RsSerialType* init_item(RsNxsGrp& nxg)
|
||||
{
|
||||
nxg.clear();
|
||||
|
||||
randString(SHORT_STR, nxg.identity);
|
||||
randString(SHORT_STR, nxg.grpId);
|
||||
nxg.timeStamp = rand()%23;
|
||||
nxg.transactionNumber = rand()%23;
|
||||
nxg.grpFlag = rand()%242;
|
||||
init_item(nxg.grp);
|
||||
|
||||
init_item(nxg.adminSign);
|
||||
init_item(nxg.idSign);
|
||||
|
||||
int nKey = rand()%12;
|
||||
|
||||
for(int i=0; i < nKey; i++){
|
||||
nxg.keys.groupId = nxg.grpId;
|
||||
std::string s;
|
||||
RsTlvSecurityKey k;
|
||||
init_item(k);
|
||||
nxg.keys.keys[k.keyId] = k;
|
||||
}
|
||||
init_item(nxg.meta);
|
||||
|
||||
return new RsNxsSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||
}
|
||||
|
@ -38,15 +24,12 @@ RsSerialType* init_item(RsNxsGrp& nxg)
|
|||
|
||||
RsSerialType* init_item(RsNxsMsg& nxm)
|
||||
{
|
||||
nxm.clear();
|
||||
|
||||
randString(SHORT_STR, nxm.msgId);
|
||||
randString(SHORT_STR, nxm.grpId);
|
||||
randString(SHORT_STR, nxm.identity);
|
||||
|
||||
init_item(nxm.publishSign);
|
||||
init_item(nxm.idSign);
|
||||
init_item(nxm.msg);
|
||||
nxm.msgFlag = rand()%4252;
|
||||
nxm.timeStamp = rand()%246;
|
||||
init_item(nxm.meta);
|
||||
nxm.transactionNumber = rand()%23;
|
||||
|
||||
return new RsNxsSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||
|
@ -55,7 +38,6 @@ RsSerialType* init_item(RsNxsMsg& nxm)
|
|||
RsSerialType* init_item(RsNxsSyncGrp& rsg)
|
||||
{
|
||||
rsg.clear();
|
||||
|
||||
rsg.flag = RsNxsSyncGrp::FLAG_USE_SYNC_HASH;
|
||||
rsg.syncAge = rand()%2423;
|
||||
randString(3124,rsg.syncHash);
|
||||
|
@ -82,9 +64,8 @@ RsSerialType* init_item(RsNxsSyncGrpItem& rsgl)
|
|||
|
||||
rsgl.flag = RsNxsSyncGrpItem::FLAG_RESPONSE;
|
||||
rsgl.transactionNumber = rand()%23;
|
||||
rsgl.publishTs = rand()%23;
|
||||
randString(SHORT_STR, rsgl.grpId);
|
||||
init_item(rsgl.adminSign);
|
||||
|
||||
|
||||
return new RsNxsSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||
}
|
||||
|
@ -115,26 +96,11 @@ RsSerialType* init_item(RsNxsTransac& rstx){
|
|||
|
||||
bool operator==(const RsNxsGrp& l, const RsNxsGrp& r){
|
||||
|
||||
if(!(l.adminSign == r.adminSign)) return false;
|
||||
if(!(l.idSign == r.idSign)) return false;
|
||||
if(l.timeStamp != r.timeStamp) return false;
|
||||
if(l.grpFlag != r.grpFlag) return false;
|
||||
if(l.identity != r.identity) return false;
|
||||
if(l.grpId != r.grpId) return false;
|
||||
if(l.keys.groupId != r.keys.groupId) return false;
|
||||
if(!(l.grp == r.grp) ) return false;
|
||||
if(!(l.meta == r.meta) ) return false;
|
||||
if(l.transactionNumber != r.transactionNumber) return false;
|
||||
|
||||
std::map<std::string, RsTlvSecurityKey>::const_iterator mit =
|
||||
l.keys.keys.begin(), mit_end = l.keys.keys.end();
|
||||
|
||||
for(; mit != mit_end; mit++){
|
||||
const RsTlvSecurityKey& lk = l.keys.keys.find(mit->first)->second;
|
||||
const RsTlvSecurityKey& rk = r.keys.keys.find(mit->first)->second;
|
||||
|
||||
if(! ( lk == rk) ) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -142,12 +108,8 @@ bool operator==(const RsNxsMsg& l, const RsNxsMsg& r){
|
|||
|
||||
if(l.msgId != r.msgId) return false;
|
||||
if(l.grpId != r.grpId) return false;
|
||||
if(l.identity != r.identity) return false;
|
||||
if(l.timeStamp != r.timeStamp) return false;
|
||||
if(l.msgFlag != r.msgFlag) return false;
|
||||
if(! (l.msg == r.msg) ) return false;
|
||||
if(! (l.publishSign == r.publishSign) ) return false;
|
||||
if(! (l.idSign == r.idSign) ) return false;
|
||||
if(! (l.meta == r.meta) ) return false;
|
||||
if(l.transactionNumber != r.transactionNumber) return false;
|
||||
|
||||
return true;
|
||||
|
@ -179,7 +141,7 @@ bool operator==(const RsNxsSyncMsg& l, const RsNxsSyncMsg& r)
|
|||
bool operator==(const RsNxsSyncGrpItem& l, const RsNxsSyncGrpItem& r)
|
||||
{
|
||||
if(l.flag != r.flag) return false;
|
||||
if(! (l.adminSign == r.adminSign) ) return false;
|
||||
if(l.publishTs != r.publishTs) return false;
|
||||
if(l.grpId != r.grpId) return false;
|
||||
if(l.transactionNumber != r.transactionNumber) return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue