From 9196c0fba06b73d4e02e9ce1b390e38e3822f9cf Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.com> Date: Wed, 22 Sep 2010 17:18:31 -0400 Subject: [PATCH] [#4123] Use a better way to get incoming call ID in unit test --- sflphone-common/src/managerimpl.cpp | 2 -- sflphone-common/src/managerimpl.h | 2 -- sflphone-common/src/sip/sipvoiplink.h | 3 +++ sflphone-common/test/siptest.cpp | 15 ++++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 8eabaedd69..de54ca7dfb 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -3687,8 +3687,6 @@ CallID ManagerImpl::getNewCallID () random_id << (unsigned) rand(); } - _lastCallID = random_id.str(); - return random_id.str(); } diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h index d6a122fc8e..84390acb39 100644 --- a/sflphone-common/src/managerimpl.h +++ b/sflphone-common/src/managerimpl.h @@ -1426,8 +1426,6 @@ class ManagerImpl Conf::YamlParser *parser; Conf::YamlEmitter *emitter; - std::string _lastCallID; - #ifdef TEST bool testCallAccountMap(); bool testAccountMap(); diff --git a/sflphone-common/src/sip/sipvoiplink.h b/sflphone-common/src/sip/sipvoiplink.h index 8513725bf6..a65d9a9f80 100644 --- a/sflphone-common/src/sip/sipvoiplink.h +++ b/sflphone-common/src/sip/sipvoiplink.h @@ -521,6 +521,9 @@ class SIPVoIPLink : public VoIPLink * @return int The extern (public) port */ int findLocalPortFromUri (const std::string& uri, pjsip_transport *transport); + + + friend class SIPTest; }; diff --git a/sflphone-common/test/siptest.cpp b/sflphone-common/test/siptest.cpp index 3293f03946..aec455bdfc 100644 --- a/sflphone-common/test/siptest.cpp +++ b/sflphone-common/test/siptest.cpp @@ -38,6 +38,7 @@ #include "siptest.h" #include "manager.h" +#include "sip/sipvoiplink.h" using std::cout; using std::endl; @@ -158,15 +159,15 @@ void SIPTest::testSimpleIncomingIpCall () // the incoming invite. sleep(2); - // CallList should not be used if receiving only one call - CPPUNIT_ASSERT(Manager::instance().getCallList().size() == 0); - // CPPUNIT_ASSERT(Manager::instance()._callAccountMap.size() == 1); + SIPVoIPLink *siplink = SIPVoIPLink::instance (""); + + CPPUNIT_ASSERT(siplink->_callMap.size() == 1); + CallMap::iterator iterCallId = siplink->_callMap.begin(); - // TODO: hmmm, need to find a better way to retreive the call id - // std::map<std::string, std::string>::iterator iterCallId = Manager::instance()._callAccountMap.begin(); - // CPPUNIT_ASSERT(iterCallId != Manager::instance()._callAccountMap.end()); + // TODO: hmmm, should IP2IP call be stored in call list.... + CPPUNIT_ASSERT(Manager::instance().getCallList().size() == 0); - std::string testcallid = Manager::instance()._lastCallID; + std::string testcallid = iterCallId->first; CPPUNIT_ASSERT(Manager::instance().answerCall(testcallid)); -- GitLab