⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sipregistrarservertest.cpp

📁 sip协议站
💻 CPP
字号:
// // Copyright (C) 2006 SIPfoundry Inc.// License by SIPfoundry under the LGPL license.// // Copyright (C) 2006 Pingtel Corp.// Licensed to SIPfoundry under a Contributor Agreement.// // $$//////////////////////////////////////////////////////////////////////////////// SYSTEM INCLUDES#include <cppunit/extensions/HelperMacros.h>#include <cppunit/TestCase.h>#include <iostream>#include <memory>#include <sipxunit/TestUtilities.h>#include <stdlib.h>// APPLICATION INCLUDES#include "net/Url.h"#include "os/OsDateTime.h"#include "os/OsFS.h"#include "os/OsProcess.h"#include "testlib/RegistrationDbTestContext.h"#include "SipRegistrar.h"#include "SipRegistrarServer.h"using namespace std;// DEFINES// CONSTANTS// TYPEDEFS// FORWARD DECLARATIONSclass SipRegistrarServerTest : public CppUnit::TestCase{   CPPUNIT_TEST_SUITE(SipRegistrarServerTest);   CPPUNIT_TEST(testPullUpdates);   CPPUNIT_TEST_SUITE_END();public:   SipRegistrarServerTest() :      mRegistrar(NULL)      {}   void testPullUpdates()      {         RegistrationDbTestContext testDbContext(TEST_DATA_DIR "/regdbdata",                                                 TEST_WORK_DIR "/regdbdata"                                                 );         testDbContext.inputFile("updatesToPull.xml");         // Pull all updates with primary = R1 and updateNumber > 1.         UtlSList updates;         int numUpdates = getRegistrarServer().pullUpdates(            "R1",        // registrarName            1,           // updateNumber -- pull only the updates with larger numbers            updates);    // updates are returned in this list         // Verify that the right updates got pulled.         CPPUNIT_ASSERT_EQUAL(1, numUpdates);      }   // Create the registrar for testing, without starting the associated thread   void setUp()      {         // Create and initialize the registrar, but don't start it.         // For unit testing, we just need the registrar object, not the thread.         // This arrangement is wacky and we'll try to improve it in the future.         OsConfigDb configDb;        // empty configuration DB is OK         mRegistrar = SipRegistrar::getInstance(&configDb);         // The config was empty so replication is not configured         CPPUNIT_ASSERT(!mRegistrar->isReplicationConfigured());      }   void tearDown()      {         delete mRegistrar;      }   private:   SipRegistrar*      mRegistrar;   SipRegistrarServer& getRegistrarServer()      {         return mRegistrar->getRegistrarServer();      }};CPPUNIT_TEST_SUITE_REGISTRATION(SipRegistrarServerTest);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -