当前位置: 首页>>代码示例>>C++>>正文


C++ Messenger::getSecureFromBitmunk方法代码示例

本文整理汇总了C++中Messenger::getSecureFromBitmunk方法的典型用法代码示例。如果您正苦于以下问题:C++ Messenger::getSecureFromBitmunk方法的具体用法?C++ Messenger::getSecureFromBitmunk怎么用?C++ Messenger::getSecureFromBitmunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Messenger的用法示例。


在下文中一共展示了Messenger::getSecureFromBitmunk方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: accountGetTest

static void accountGetTest(Node& node, TestRunner& tr)
{
   tr.group("accounts");

   Messenger* messenger = node.getMessenger();

   tr.test("get");
   {
      Url url("/api/3.0/accounts/?owner=900");

      // get all accounts
      User user;
      messenger->getSecureFromBitmunk(&url, user, node.getDefaultUserId());
      printf("\nAccounts:\n");
      dumpDynamicObject(user);
   }
   tr.passIfNoException();

   tr.ungroup();

   tr.group("account");

   tr.test("get");
   {
      // create url for obtaining users
      Url url("/api/3.0/accounts/9000");

      // get account
      Account account;
      assertNoException(
         messenger->getSecureFromBitmunk(
            &url, account, node.getDefaultUserId()));

      printf("\nAccount:\n");
      dumpDynamicObject(account, false);
   }
   tr.passIfNoException();

   tr.ungroup();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:40,代码来源:test-node-services.cpp

示例2: reviewGetTest

static void reviewGetTest(Node& node, TestRunner& tr)
{
   tr.group("reviews");

   Messenger* messenger = node.getMessenger();

   tr.test("user get");
   {
      // create url for obtaining user reviews
      Url url("/api/3.0/reviews/user/900");

      // get account
      DynamicObject reviews;
      assertNoException(
         messenger->getSecureFromBitmunk(
            &url, reviews, node.getDefaultUserId()));

      printf("\nReviews:\n");
      dumpDynamicObject(reviews, false);
   }
   tr.passIfNoException();

   tr.test("media get");
   {
      // create url for obtaining media reviews
      Url url("/api/3.0/reviews/media/1");

      // get account
      DynamicObject reviews;
      assertNoException(
         messenger->getSecureFromBitmunk(
            &url, reviews, node.getDefaultUserId()));

      printf("\nReviews:\n");
      dumpDynamicObject(reviews, false);
   }
   tr.passIfNoException();

   tr.ungroup();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:40,代码来源:test-node-services.cpp

示例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();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:44,代码来源:test-node-services.cpp

示例4: userGetTest

static void userGetTest(Node& node, TestRunner& tr)
{
   tr.group("user");

   Messenger* messenger = node.getMessenger();

   tr.test("get self (valid)");
   {
      // create url for obtaining users
      Url url("/api/3.0/users/900");

      // get user
      User user;
      assertNoException(
         messenger->getSecureFromBitmunk(&url, user, node.getDefaultUserId()));

      printf("\nUser:\n");
      dumpDynamicObject(user, false);
   }
   tr.passIfNoException();

   /*
   tr.test("get non-self (valid)");
   {
      // create url for obtaining users
      Url url("/api/3.0/users/900");

      // get user
      User user;
      messenger->getSecureFromBitmunk(&url, user, node.getDefaultUserId());
      assertNoException();

      printf("\nUser:\n");
      dumpDynamicObject(user, false);
   }
   tr.passIfNoException();
   */

   tr.test("get identity (valid)");
   {
      // create url for obtaining identity
      Url url("/api/3.0/users/identity/900");

      // get identity
      Identity identity;
      assertNoException(
         messenger->getSecureFromBitmunk(
            &url, identity, node.getDefaultUserId()));

      printf("\nIdentity:\n");
      dumpDynamicObject(identity, false);
   }
   tr.passIfNoException();

   /*
   tr.test("get identity (invalid)");
   {
      // create url for obtaining identity
      Url url("/api/3.0/users/identity/69766");

      // get identity
      Identity identity;
      messenger->getSecureFromBitmunk((
         &url, identity, node.getDefaultUserId());
      assertException();

      printf("\nIdentity:\n");
      dumpDynamicObject(identity, false);
   }
   tr.passIfException();
   */

   /*
   tr.test("sellerKey");
   {
      // create url for obtaining users
      Url url("/api/3.0/users/keys/seller/900");

      // get user
      DynamicObject sellerKey;
      messenger->getFromBitmunk(&url, sellerKey);
      assertNoException();

      printf("\nSeller Key:\n");
      dumpDynamicObject(sellerKey, false);
   }
   tr.passIfNoException();

   tr.test("friends");
   {
      Url url("/api/3.0/friends/?user=900");

      // get friends
      User user;
      messenger->getSecureFromBitmunk(&url, user, node.getDefaultUserId());
      assertNoException();

      printf("\nUser Friends:\n");
      dumpDynamicObject(user, false);
   }
//.........这里部分代码省略.........
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:101,代码来源:test-node-services.cpp


注:本文中的Messenger::getSecureFromBitmunk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。