mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-30 09:56:14 -05:00
2a5854188e
ported some of the tests across. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7233 b45a01b8-16f6-495d-af2f-9b41ad6348cc
77 lines
1.4 KiB
C++
77 lines
1.4 KiB
C++
/*
|
|
* gxspublishmsgtest.cpp
|
|
*
|
|
* Created on: 27 Apr 2013
|
|
* Author: crispy
|
|
*/
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "gxspublishmsgtest.h"
|
|
|
|
#define POLLING_TIME_OUT 5
|
|
|
|
GxsPublishMsgTest::GxsPublishMsgTest(GenExchangeTestService* const testService,
|
|
RsGeneralDataService* dataService)
|
|
: GenExchangeTest(testService, dataService, POLLING_TIME_OUT)
|
|
{
|
|
}
|
|
|
|
GxsPublishMsgTest::~GxsPublishMsgTest()
|
|
{
|
|
}
|
|
|
|
void GxsPublishMsgTest::runTests()
|
|
{
|
|
EXPECT_TRUE(testMsgSubmissionRetrieval());
|
|
}
|
|
|
|
bool GxsPublishMsgTest::testMsgSubmissionRetrieval()
|
|
{
|
|
// start up
|
|
setUp();
|
|
std::list<RsGxsGroupId> grpIds;
|
|
createGrps(4, grpIds);
|
|
|
|
/********************/
|
|
|
|
RsDummyMsg* msg = new RsDummyMsg();
|
|
init(*msg);
|
|
|
|
msg->meta.mGroupId = grpIds.front();
|
|
uint32_t token;
|
|
RsDummyMsg* msgOut = new RsDummyMsg();
|
|
*msgOut = *msg;
|
|
getTestService()->publishDummyMsg(token, msg);
|
|
|
|
|
|
RsGxsGrpMsgIdPair msgId;
|
|
pollForMsgAcknowledgement(token, msgId);
|
|
msgOut->meta.mMsgId = msgId.second;
|
|
|
|
DummyMsgMap msgMap;
|
|
std::vector<RsDummyMsg*> msgV;
|
|
msgV.push_back(msgOut);
|
|
msgMap[msgOut->meta.mGroupId] = msgV;
|
|
storeToMsgDataOutMaps(msgMap);
|
|
|
|
|
|
RsTokReqOptions opts;
|
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
|
|
|
getTokenService()->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds);
|
|
|
|
// poll again
|
|
pollForToken(token, opts, true);
|
|
|
|
bool ok = compareMsgDataMaps();
|
|
|
|
// complete
|
|
breakDown();
|
|
|
|
return ok;
|
|
}
|
|
|
|
|
|
|