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


C++ TestRunner::getApp方法代码示例

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


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

示例1: run

static bool run(TestRunner& tr)
{
   if(tr.isTestEnabled("fixme"))
   {
      // load and start node
      Node* node = Tester::loadNode(tr, "test-services-customcatalog");
      assertNoException(
         node->start());

      Config cfg = tr.getApp()->getConfig();
      sTestDataDir = cfg["test"]["dataPath"]->getString();

      //config["node"]["modulePath"] = append BPE_MODULES_DIRECTORY;
      //config["bitmunk.catalog.CustomCatalog"]["uploadListings"] = false;

      // run tests
      customCatalogTests(*node, tr);

      // stop and unload node
      node->stop();
      Tester::unloadNode(tr);
   }

   if(tr.isTestEnabled("fixme"))
   {
      // load and start node
      Node* node = Tester::loadNode(tr, "test-services-customcatalog");
      assertNoException(
         node->start());

      Config cfg = tr.getApp()->getConfig();
      sTestDataDir = cfg["test"]["dataPath"]->getString();

      //config["node"]["modulePath"] = BPE_MODULES_DIRECTORY;
      //config["bitmunk.catalog.CustomCatalog"]["uploadListings"] = true;

      // run tests
      interactiveCustomCatalogTests(*node, tr);

      // stop and unload node
      node->stop();
      Tester::unloadNode(tr);
   }

   return true;
};
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:46,代码来源:test-services-customcatalog.cpp

示例2: run

static bool run(TestRunner& tr)
{
   if(tr.isTestEnabled("dyno-perf"))
   {
      Config cfg = tr.getApp()->getConfig();
      // number of loops for each test
      int loops = cfg->hasMember("loops") ? cfg["loops"]->getInt32() : 1;
      for(int i = 0; i < loops; ++i)
      {
         runDynoIterTest(tr);
      }
   }
   return true;
}
开发者ID:zengyuxing007,项目名称:monarch,代码行数:14,代码来源:test-dyno-perf.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: runDynoIterTest

static void runDynoIterTest(TestRunner& tr)
{
   tr.group("DynamicObject iter perf");

   bool all = false;
   Config cfg = tr.getApp()->getConfig();
   if(cfg->hasMember("all"))
   {
      all = cfg["all"]->getBoolean();
   }
   if(all)
   {
      //runDynoIterTest1(tr, "array s:10M  i:1    ", 10000000, 1);
      runDynoIterTest1(tr, "array s:1M   i:1    ", 1000000,  1);
      runDynoIterTest1(tr, "array s:1M   i:2    ", 1000000,  2);
      runDynoIterTest1(tr, "array s:1M   i:5    ", 1000000,  5);
      runDynoIterTest1(tr, "array s:1M   i:10   ", 1000000, 10);
   }
   runDynoIterTest1(tr, "array s:100K i:100  ", 100000, 100);
   runDynoIterTest1(tr, "array s:10K  i:1K   ", 10000, 1000);
   runDynoIterTest1(tr, "array s:1K   i:10K  ", 1000, 10000);
   runDynoIterTest1(tr, "array s:100  i:100K ", 100, 100000);
   runDynoIterTest1(tr, "array s:10   i:1M   ", 10, 1000000);
   if(all)
   {
      runDynoIterTest1(tr, "array s:5    i:1M   ", 5,  1000000);
      runDynoIterTest1(tr, "array s:2    i:1M   ", 2,  1000000);
      runDynoIterTest1(tr, "array s:1    i:1M   ", 1,  1000000);
      runDynoIterTest1(tr, "array s:0    i:1M   ", 0,  1000000);
      //runDynoIterTest1(tr, "array s:5    i:2M   ", 5,  2000000);
      //runDynoIterTest1(tr, "array s:2    i:5M   ", 2,  5000000);
      //runDynoIterTest1(tr, "array s:1    i:10M  ", 1, 10000000);
   }

   tr.ungroup();
}
开发者ID:zengyuxing007,项目名称:monarch,代码行数:36,代码来源:test-dyno-perf.cpp

示例5: runPingTest

static void runPingTest(TestRunner& tr)
{
   tr.test("Ping");

   Config cfg = tr.getApp()->getConfig()["pong"];

   // Stats and control
   PingPong pingPong(cfg);

   // create kernel
   Kernel k;

   // set thread stack size in engine (128k)
   k.getEngine()->getThreadPool()->setThreadStackSize(
      cfg["threadStackSize"]->getUInt32());

   // optional for testing --
   // limit threads to 2: one for accepting, 1 for handling
   //k.getEngine()->getThreadPool()->setPoolSize(2);
   k.getEngine()->getThreadPool()->setPoolSize(cfg["threads"]->getUInt32());

   // start engine
   k.getEngine()->start();

   // create server
   Server server;
   server.setMaxConnectionCount(cfg["maxConnections"]->getInt32());
   InternetAddress address("0.0.0.0", cfg["port"]->getUInt32());

   // create SSL/generic http connection servicer
   HttpConnectionServicer hcs;
//   SslContext context;
//   SslSocketDataPresenter presenter1(&context);
//   NullSocketDataPresenter presenter2;
//   SocketDataPresenterList list(false);
//   list.add(&presenter1);
//   list.add(&presenter2);
   //server.addConnectionService(&address, &hcs);//, &list);
   server.addConnectionService(
      &address, &hcs, NULL, "pong",
      cfg["maxConnections"]->getInt32(),
      cfg["backlog"]->getInt32());

   // create test http request servicer
   NoContentServicer noContentSrv(&pingPong, "/");
   hcs.addRequestServicer(&noContentSrv, false);

   PingServicer ping(&pingPong, "/pong");
   hcs.addRequestServicer(&ping, false);

   const int bufsize = 4096;
   char buf[bufsize];
   memset(buf, '.', bufsize);
   DataServicer data(&pingPong, "/data", buf, bufsize);
   hcs.addRequestServicer(&data, false);

   StatsServicer stats(&pingPong, "/stats");
   hcs.addRequestServicer(&stats, false);

   ResetServicer reset(&pingPong, "/reset");
   hcs.addRequestServicer(&reset, false);

   QuitServicer quit(&pingPong, "/quit");
   hcs.addRequestServicer(&quit, false);

   if(server.start(&k))
   {
      uint64_t num = cfg["num"]->getUInt64();
      MO_INFO("Server started.");
      if(num == 0)
      {
         MO_INFO("Servicing forever. CTRL-C to quit.");
      }
      {
         MO_INFO("Servicing approximately %" PRIu64 " connections.", num);
      }
   }
   else if(Exception::get() != NULL)
   {
      MO_ERROR("Server started with errors=%s\n",
         Exception::get()->getMessage());
   }

   // start timing
   pingPong.reset();

   // either serve for limited time, or wait for lock
   uint32_t time = cfg["time"]->getUInt32();
   if(time != 0)
   {
      Thread::sleep(time);
   }
   else
   {
      pingPong.getLock().wait();
   }

   server.stop();
   MO_INFO("Server stopped.");

//.........这里部分代码省略.........
开发者ID:bsletten,项目名称:monarch,代码行数:101,代码来源:test-pong.cpp

示例6: run

static bool run(TestRunner& tr)
{
   if(tr.isTestEnabled("fixme"))
   {
      // load and start node
      Node* node = Tester::loadNode(tr/*, "test-node-services"*/);
      assertNoException(
         node->start());

      //cout << "You may need to remove testuser5.profile from /tmp/ to "
      //   "run the password update test." << endl;

      // login the devuser
      //node.login("devuser", "password");
      //node.login("testuser5", "password");
      assertNoExceptionSet();

      // run tests
      //mediaGetTest(node, tr);
      //userGetTest(node, tr);
      //userAddTest(node, tr);
      //userUpdateTest(node, tr);
      //accountGetTest(node, tr);
      //contributorGetTest(node, tr);
      //permissionGetTest(node, tr);
      //reviewGetTest(node, tr);
      //acquireLicenseTest(node, tr);

      // performance tests
      //accountGetPerfTest(node, tr);

      // stop and unload node
      node->stop();
      Tester::unloadNode(tr);
   }

   if(tr.isTestEnabled("fixme"))
   {
      // load and start node
      Node* node = Tester::loadNode(tr/*, "test-node-services"*/);
      assertNoException(
         node->start());

      // login the devuser
      //node.login("devuser", "password");
      //node.login("testuser5", "password");
      assertNoExceptionSet();

      Config cfg = tr.getApp()->getConfig();
      const char* test = cfg["monarch.test.Tester"]["test"]->getString();
      bool all = (strcmp(test, "all") == 0);

      if(all || (strcmp(test, "ping") == 0))
      {
         pingPerfTest(*node, tr);
      }

      // stop and unload node
      node->stop();
      Tester::unloadNode(tr);
   }

   return true;
};
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:64,代码来源:test-node-services.cpp


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