本文整理汇总了C++中Messenger::getFromBitmunk方法的典型用法代码示例。如果您正苦于以下问题:C++ Messenger::getFromBitmunk方法的具体用法?C++ Messenger::getFromBitmunk怎么用?C++ Messenger::getFromBitmunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messenger
的用法示例。
在下文中一共展示了Messenger::getFromBitmunk方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contributorGetTest
static void contributorGetTest(Node& node, TestRunner& tr)
{
tr.group("contributors");
Messenger* messenger = node.getMessenger();
tr.test("id");
{
Url url("/api/3.0/contributors/1");
// get contributor
DynamicObject contributor;
assertNoException(
messenger->getFromBitmunk(&url, contributor));
printf("\nContributor:\n");
dumpDynamicObject(contributor, false);
}
tr.passIfNoException();
tr.test("owner");
{
Url url("/api/3.0/contributors/?owner=900");
// get contributor
DynamicObject contributors;
assertNoException(
messenger->getFromBitmunk(&url, contributors));
printf("\nContributors:\n");
dumpDynamicObject(contributors, false);
}
tr.passIfNoException();
tr.test("media");
{
Url url("/api/3.0/contributors/?media=1");
// get contributor
DynamicObject contributors;
assertNoException(
messenger->getFromBitmunk(&url, contributors));
printf("\nContributors:\n");
dumpDynamicObject(contributors, false);
}
tr.passIfNoException();
tr.ungroup();
}
示例2: accountGetPerfTest
static void accountGetPerfTest(Node& node, TestRunner& tr)
{
tr.group("accounts perf");
Messenger* messenger = node.getMessenger();
// number of loops
int n = 25;
tr.test("insecure get");
{
Url url("/api/3.0/accounts/?owner=900");
uint64_t startTime = Timer::startTiming();
for(int i = 0; i < n; ++i)
{
User user;
messenger->getFromBitmunk(&url, user);
}
double dt = Timer::getSeconds(startTime);
printf("t=%g ms, r=%g ms, r/s=%g", dt * 1000.0, dt/n * 1000.0, n/dt);
}
tr.passIfNoException();
tr.test("secure get");
{
Url url("/api/3.0/accounts/?owner=900");
uint64_t startTime = Timer::startTiming();
for(int i = 0; i < n; ++i)
{
User user;
messenger->getFromBitmunk(&url, user, node.getDefaultUserId());
}
double dt = Timer::getSeconds(startTime);
printf("t=%g ms, r=%g ms, r/s=%g", dt * 1000.0, dt/n * 1000.0, n/dt);
}
tr.passIfNoException();
tr.ungroup();
}
示例3: pingPerfTest
static void pingPerfTest(Node& node, TestRunner& tr)
{
tr.group("ping perf");
Messenger* messenger = node.getMessenger();
// number of loops for each test
Config cfg = tr.getApp()->getConfig();
//node.getConfigManager()->getConfig(
// tester->getApp()->getMetaConfig()["groups"]["main"]->getString());
int n = cfg->hasMember("loops") ? cfg["loops"]->getInt32() : 50;
tr.test("insecure get");
{
Url url("/api/3.0/system/test/ping");
DynamicObject dummy;
uint64_t startTime = Timer::startTiming();
for(int i = 0; i < n; ++i)
{
messenger->getFromBitmunk(&url, dummy);
}
double dt = Timer::getSeconds(startTime);
printf("t=%g ms, r=%g ms, r/s=%g", dt * 1000.0, dt/n * 1000.0, n/dt);
}
tr.passIfNoException();
tr.test("secure get");
{
Url url("/api/3.0/system/test/ping");
DynamicObject dummy;
uint64_t startTime = Timer::startTiming();
for(int i = 0; i < n; ++i)
{
messenger->getSecureFromBitmunk(&url, dummy, node.getDefaultUserId());
}
double dt = Timer::getSeconds(startTime);
printf("t=%g ms, r=%g ms, r/s=%g", dt * 1000.0, dt/n * 1000.0, n/dt);
}
tr.passIfNoException();
tr.ungroup();
}
示例4: permissionGetTest
static void permissionGetTest(Node& node, TestRunner& tr)
{
tr.group("permissions");
Messenger* messenger = node.getMessenger();
tr.test("group get");
{
// create url for obtaining permission group information
Url url("/api/3.0/permissions/100");
// get permission group
PermissionGroup group;
assertNoException(
messenger->getFromBitmunk(&url, group));
printf("\nGroup:\n");
dumpDynamicObject(group, false);
}
tr.passIfNoException();
tr.ungroup();
}
示例5: mediaGetTest
static void mediaGetTest(Node& node, TestRunner& tr)
{
tr.group("media");
Messenger* messenger = node.getMessenger();
tr.test("get");
{
// create url for obtaining media
Url url("/api/3.0/media/2");
// get media
Media media;
assertNoException(
messenger->getFromBitmunk(&url, media));
printf("\nMedia:\n");
dumpDynamicObject(media, false);
}
tr.passIfNoException();
tr.test("invalid get");
{
// create url for obtaining media
Url url("/api/3.0/media/invalidMediaId");
// get media
Media media;
messenger->getFromBitmunk(&url, media);
}
tr.passIfException();
tr.test("all");
{
// create url for getting media
Url url("/api/3.0/media/?start=0&num=5");
// get results
DynamicObject results;
//assertNoException(
// messenger->getFromBitmunk(&url, results));
printf("\nDISABLED FOR PERFORMANCE\n");
/*
printf("\nGetting 5 media starting at #0\n(of %" PRIu32 " found)\n",
results["total"]->getUInt32());
dumpDynamicObject(results, false);
*/
}
tr.passIfNoException();
tr.test("owned");
{
// create url for searching media
Url url("/api/3.0/media?owner=900");
// get results
DynamicObject results;
assertNoException(
messenger->getFromBitmunk(&url, results));
printf("\nMedia owned by user 900\n");
printf("Results %" PRIu32 "-%" PRIu32 " of %" PRIu32 "\n",
results["start"]->getUInt32(),
results["start"]->getUInt32() + results["num"]->getUInt32(),
results["total"]->getUInt32());
dumpDynamicObject(results, false);
}
tr.passIfNoException();
tr.test("search");
{
// create url for searching media
Url url("/api/3.0/media/?query=test&start=0&num=10");
// get results
DynamicObject results;
assertNoException(
messenger->getFromBitmunk(&url, results));
printf("\nSearching media & contributors for 'test'\n");
printf("Results %" PRIu32 "-%" PRIu32 " of %" PRIu32 "\n",
results["start"]->getUInt32(),
results["start"]->getUInt32() + results["num"]->getUInt32(),
results["total"]->getUInt32());
dumpDynamicObject(results, false);
}
tr.passIfNoException();
tr.test("genre media");
{
// create url for searching media
Url url("/api/3.0/media?type=audio&genre=165&start=4&num=5");
// get results
DynamicObject results;
assertNoException(
messenger->getFromBitmunk(&url, results));
printf("\nAudio from genre 165\n");
//.........这里部分代码省略.........