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


C++ ASSERT_STR_EQUAL函数代码示例

本文整理汇总了C++中ASSERT_STR_EQUAL函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_STR_EQUAL函数的具体用法?C++ ASSERT_STR_EQUAL怎么用?C++ ASSERT_STR_EQUAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: testNoRouteLocal

   void testNoRouteLocal()
      {
         const char* message =
            "INVITE sip:[email protected] SIP/2.0\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";

         SipMessage testMsg(message, strlen(message));
         Url requestUri;
         UtlSList removedRoutes;
         
         testMsg.normalizeProxyRoutes(UserAgent, requestUri, &removedRoutes);

         UtlString normalizedMsg;
         int msgLen;
         testMsg.getBytes(&normalizedMsg, &msgLen);

         ASSERT_STR_EQUAL(message, normalizedMsg.data());

         UtlString requestUriResult;
         requestUri.toString(requestUriResult);
         
         ASSERT_STR_EQUAL("sip:[email protected]", requestUriResult.data());

         CPPUNIT_ASSERT(removedRoutes.isEmpty());
      }
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:33,代码来源:SipProxyMessageTest.cpp

示例2: getOneRowByLocationCodeTest

   void getOneRowByLocationCodeTest()
   {
      SipDbTestContext sipDbTestContext(TEST_DATA_DIR "/locationdata",
                                        TEST_WORK_DIR "/locationdata"
                                                 );
      sipDbTestContext.inputFile("dummy_loc_db.xml" );
      
      LocationDB* pLocDb = LocationDB::getInstance("dummy_loc_db");
      UtlHashMap hashmap;
      CPPUNIT_ASSERT( !pLocDb->getRowByLocationCode( "5144", hashmap ) );
      CPPUNIT_ASSERT( pLocDb->getRowByLocationCode( "514", hashmap ) );
      CPPUNIT_ASSERT( hashmap.entries() == 4 );

      UtlString* pTempString;
      UtlString key;
      key = "name";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "Montreal", pTempString->data() );
      
      key = "description";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "Go Habs Go!", pTempString->data() );
      
      key = "locationcode";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "514", pTempString->data() );

      key = "subnets";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "10.10.10.0/24,11.11.11.0/24,12.12.12.0/24", pTempString->data() );
   }
开发者ID:LordGaav,项目名称:sipxecs,代码行数:35,代码来源:LocationDbTest.cpp

示例3: testAllNoDefaultPermutations

      void testAllNoDefaultPermutations()
      {
         FallbackRulesUrlMapping* urlmap;
         ResultSet registrations;
         UtlString actual;
         UtlString callTag = "UNK";

         CPPUNIT_ASSERT( urlmap = new FallbackRulesUrlMapping() );
         UtlString simpleXml;
         mFileTestContext->inputFilePath("fallbackrules.xml", simpleXml);
         CPPUNIT_ASSERT( urlmap->loadMappings(simpleXml.data() ) == OS_SUCCESS );

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations, callTag
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 2 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         getResult( registrations, 1, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("salem"),
                                registrations, callTag
                                ) != OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 0 ,  registrations.getSize() );
         
         delete urlmap;
      }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:31,代码来源:FallbackRulesUrlMappingTest.cpp

示例4: testBranchIdparse

   void testBranchIdparse()
      {
         size_t       counter;
         UtlString    uniqueValue;
         UtlString    loopDetectKey;

         CPPUNIT_ASSERT(!BranchId::parse("z9hG4bK11e0671922444aa6a5f7f10b5",
                                         counter, uniqueValue, loopDetectKey));
         CPPUNIT_ASSERT(uniqueValue.isNull());
         CPPUNIT_ASSERT(loopDetectKey.isNull());

         CPPUNIT_ASSERT(!BranchId::parse("az9hG4bK11e0671922444aa6a5f7f10b5",
                                         counter, uniqueValue, loopDetectKey));
         CPPUNIT_ASSERT(uniqueValue.isNull());
         CPPUNIT_ASSERT(loopDetectKey.isNull());

         CPPUNIT_ASSERT(!BranchId::parse("x9hG4bK11e0671922444aa6a5f7f10b5",
                                         counter, uniqueValue, loopDetectKey));
         CPPUNIT_ASSERT(uniqueValue.isNull());
         CPPUNIT_ASSERT(loopDetectKey.isNull());

         CPPUNIT_ASSERT(BranchId::parse("z9hG4bK-XX-0014xXPnvpKqfTHmjFlrAD5sPA~1Pke3N5l0uqpDw00P`ZWYw",
                                        counter, uniqueValue, loopDetectKey));
         CPPUNIT_ASSERT_EQUAL((size_t)20, counter);
         ASSERT_STR_EQUAL("xXPnvpKqfTHmjFlrAD5sPA", uniqueValue.data());
         ASSERT_STR_EQUAL("1Pke3N5l0uqpDw00P`ZWYw", loopDetectKey.data());
      }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:27,代码来源:BranchIdTest.cpp

示例5: testDoubleRoute

   void testDoubleRoute()
      {
         const char* message =
            "INVITE sip:[email protected] SIP/2.0\r\n"
            "Route: <sip:[email protected];lr>, <sip:[email protected];lr>\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";

         SipMessage testMsg(message, strlen(message));
         Url requestUri;
         UtlSList removedRoutes;
         
         testMsg.normalizeProxyRoutes(UserAgent, requestUri, &removedRoutes);

         UtlString normalizedMsg;
         int msgLen;
         testMsg.getBytes(&normalizedMsg, &msgLen);

         const char* expectedMessage = // route header removed, uri swapped
            "INVITE sip:[email protected] SIP/2.0\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";

         ASSERT_STR_EQUAL(expectedMessage, normalizedMsg.data());

         UtlString requestUriResult;
         requestUri.toString(requestUriResult);
         
         ASSERT_STR_EQUAL("sip:[email protected]", requestUriResult.data());

         UtlString* removedRoute;

         CPPUNIT_ASSERT( removedRoute = static_cast<UtlString*>(removedRoutes.get()));
         ASSERT_STR_EQUAL("<sip:[email protected];lr>", removedRoute->data());
         delete removedRoute;

         CPPUNIT_ASSERT( removedRoute = static_cast<UtlString*>(removedRoutes.get()));
         ASSERT_STR_EQUAL("<sip:[email protected];lr>", removedRoute->data());
         delete removedRoute;

         CPPUNIT_ASSERT(removedRoutes.isEmpty());

      }
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:57,代码来源:SipProxyMessageTest.cpp

示例6: testForbidden

   // Test that an out-of-dialog request gets an authentication challenge when
   // the auth rules require it.
   void testForbidden()
      {
         const char* message =
            "INVITE sip:[email protected] SIP/2.0\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 2 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";
         SipMessage testMsg(message, strlen(message));


         UtlString identity; // no authenticated identity
         Url requestUri("sip:[email protected]");

         UtlSList noRemovedRoutes;
         UtlString routeName("example.com");
         RouteState routeState( testMsg, noRemovedRoutes, routeName );

         UtlString rejectReason;

         UtlString method("INVITE");
         const bool bSpiralingRequest = false;
         AuthPlugin::AuthResult priorResult = AuthPlugin::CONTINUE;

         CPPUNIT_ASSERT(AuthPlugin::DENY
                        == enforcer->authorizeAndModify(identity,
                                                        requestUri,
                                                        routeState,
                                                        method,
                                                        priorResult,
                                                        testMsg,
                                                        bSpiralingRequest,
                                                        rejectReason
                                                        ));
         ASSERT_STR_EQUAL("", rejectReason.data());

         // now try the same request, but with an authenticated identity
         // so this time it should provide a reject reason
         identity = "[email protected]le.com";

         CPPUNIT_ASSERT(AuthPlugin::DENY
                        == enforcer->authorizeAndModify(identity,
                                                        requestUri,
                                                        routeState,
                                                        method,
                                                        priorResult,
                                                        testMsg,
                                                        bSpiralingRequest,
                                                        rejectReason
                                                        ));
         ASSERT_STR_EQUAL("Requires NoAccess", rejectReason.data());
      }
开发者ID:ciuc,项目名称:sipxecs,代码行数:59,代码来源:EnforceAuthRulesTest.cpp

示例7: AuthenticatedRefer

   // Test that an authenticated REFER without Replaces to a good target is allowed and not modified
   void AuthenticatedRefer()
      {
         UtlString identity("[email protected]"); // an authenticated identity
         Url requestUri("sip:[email protected]");

         const char* message =
            "REFER sip:[email protected] SIP/2.0\r\n"
            "Refer-To: [email protected]\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";
         SipMessage testMsg(message, strlen(message));

         UtlSList noRemovedRoutes;
         UtlString myRouteName("myhost.example.com");
         RouteState routeState( testMsg, noRemovedRoutes, myRouteName );

         const char unmodifiedRejectReason[] = "unmodified";
         UtlString rejectReason(unmodifiedRejectReason);
         
         UtlString method("REFER");
         bool bSpiralingRequest = false;
         AuthPlugin::AuthResult priorResult = AuthPlugin::CONTINUE;
         
         CPPUNIT_ASSERT(AuthPlugin::CONTINUE
                        == xferctl->authorizeAndModify(identity,
                                                       requestUri,
                                                       routeState,
                                                       method,
                                                       priorResult,
                                                       testMsg,
                                                       bSpiralingRequest,
                                                       rejectReason
                                                       ));
         ASSERT_STR_EQUAL(unmodifiedRejectReason, rejectReason.data());

         UtlString modifiedReferToStr;
         CPPUNIT_ASSERT(testMsg.getReferToField(modifiedReferToStr));

         Url modifiedReferTo(modifiedReferToStr);
         CPPUNIT_ASSERT(Url::SipUrlScheme == modifiedReferTo.getScheme());

         // check that the message has not been modified
         UtlString outputMsg;
         ssize_t    outputSize;
         testMsg.getBytes(&outputMsg, &outputSize);

         ASSERT_STR_EQUAL(message, outputMsg.data());
      }
开发者ID:LordGaav,项目名称:sipxecs,代码行数:56,代码来源:MSFT_ExchangeTransferHackTest.cpp

示例8: testBranchCopy

   void testBranchCopy()
      {
         UtlString sipXbranchId("z9hG4bK-XX-000af33a294c2143da892d81dbc8183fd7f8");
         BranchId  sipXcopied(sipXbranchId);

         ASSERT_STR_EQUAL(sipXbranchId.data(), sipXcopied.data());

         UtlString non_sipXbranchId("z9hG4bK-94rkdeeepdeloepw%ww-lflll");
         BranchId  non_sipXcopied(non_sipXbranchId);

         ASSERT_STR_EQUAL(sipXbranchId.data(), sipXcopied.data());
      }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:12,代码来源:BranchIdTest.cpp

示例9: testMapUriNoRoot

   void testMapUriNoRoot()
      {
         UtlString mapped;

         HttpServer server(NULL);
         server.addUriMap("/notrooturi", "/notrootpath");
         
         CPPUNIT_ASSERT(!HttpServer::mapUri(server.mUriMaps, "/uripath", mapped));
         ASSERT_STR_EQUAL("/uripath", mapped.data());

         CPPUNIT_ASSERT(!HttpServer::mapUri(server.mUriMaps, "/", mapped));
         ASSERT_STR_EQUAL("/", mapped.data());
      }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:13,代码来源:HttpServerTest.cpp

示例10: testNoPermResponse

   // Test that a response message is allowed and is not modified
   void testNoPermResponse()
      {
         OsConfigDb configuration;
         configuration.set("RULES", TEST_DATA_DIR "/enforcerules.xml");

         enforcer->readConfig(configuration);

         UtlString identity; // no authenticated identity
         Url requestUri("sip:[email protected]");

         const char* message =
            "SIP/2.0 200 Ok\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=99911983748\r\n"
            "Call-Id: b1373e736d7d359ead76fa5cd467d999\r\n"
            "Cseq: 2 ACK\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "Record-Route: <sip:example.com;lr;sipXecs-rs=enforce%2Aauth%7E%21d1e296555015a54cb746fa7ac5695cf7>\r\n"
            "\r\n";
         SipMessage testMsg(message, strlen(message));

         UtlSList noRemovedRoutes;
         UtlString routeName("example.com");
         RouteState routeState( testMsg, noRemovedRoutes, routeName );

         const char unmodifiedRejectReason[] = "unmodified";
         UtlString rejectReason(unmodifiedRejectReason);

         UtlString method("INVITE");
         const bool bSpiralingRequest = false;
         AuthPlugin::AuthResult priorResult = AuthPlugin::ALLOW; // SipRouter passes this for responses

         CPPUNIT_ASSERT(AuthPlugin::CONTINUE
                        == enforcer->authorizeAndModify(identity,
                                                        requestUri,
                                                        routeState,
                                                        method,
                                                        priorResult,
                                                        testMsg,
                                                        bSpiralingRequest,
                                                        rejectReason
                                                        ));
         ASSERT_STR_EQUAL(unmodifiedRejectReason, rejectReason.data());

         UtlString recordRoute;
         CPPUNIT_ASSERT(testMsg.getRecordRouteField(0, &recordRoute));
         ASSERT_STR_EQUAL( "<sip:example.com;lr;sipXecs-rs=enforce%2Aauth%7E%21d1e296555015a54cb746fa7ac5695cf7>", recordRoute );
      }
开发者ID:ciuc,项目名称:sipxecs,代码行数:52,代码来源:EnforceAuthRulesTest.cpp

示例11: testMultiplePAIs_Mixed

   void testMultiplePAIs_Mixed()
   {
      const char* message =
         "INVITE sip:[email protected]:5060;x-sipX-pubcontact=47.135.162.145%3A29544 SIP/2.0\r\n"
         "Record-Route: <sip:192.168.0.2:5060;lr>\r\n"
         "From: caller <sip:[email protected]>;tag=94bc25b8-c0a80165-13c4-3e635-37aa1989-3e635\r\n"
         "To: <sip:[email protected]>\r\n"
         "Call-Id: [email protected]com\r\n"
         "Cseq: 1 INVITE\r\n"
         "Max-Forwards: 19\r\n"
         "Supported: replaces\r\n"
         "Contact: <sip:[email protected]:5060;x-sipX-pubcontact=47.135.162.145%3A14956>\r\n"
         "P-Asserted-Identity: \"Some guy\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"foreigner1\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"Some other guy\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"foreigner2\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"foreigner3\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"yet another guy\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"foreigner4\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"you again\" <sip:[email protected]>\r\n"
         "Content-Length: 0\r\n"
         "\r\n";
      SipMessage testMsg(message, strlen(message));
      
      UtlSList noRemovedRoutes;
      UtlString routeName("mydomain.com");
      RouteState routeState( testMsg, noRemovedRoutes, routeName );   
      UtlString rejectReason;
      
      CPPUNIT_ASSERT(AuthPlugin::CONTINUE
                     == spLinter->authorizeAndModify(identity,
                                                     requestUri,
                                                     routeState,
                                                     "INVITE",
                                                     AuthPlugin::CONTINUE,
                                                     testMsg,
                                                     false,
                                                     rejectReason
                                                     ));

      // verify that foreign PAIs are still there.
      const char* pPAI;
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 0, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner1\" <sip:[email protected]>", pPAI );
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 1, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner2\" <sip:[email protected]>", pPAI );
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 2, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner3\" <sip:[email protected]>", pPAI );
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 3, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner4\" <sip:[email protected]>", pPAI );
   } 
开发者ID:chemeris,项目名称:sipxecs,代码行数:51,代码来源:RequestLinterTest.cpp

示例12: testGetAcceptField

   void testGetAcceptField()
      {
         UtlString v;

         HttpMessage m0(
            "SUBSCRIBE sip:[email protected] SIP/2.0\r\n"
            "From: <sip:[email protected]>;tag=1c1198308561\r\n"
            "To: <sip:[email protected];user=phone>\r\n"
            "Call-Id: [email protected]\r\n"
            "Cseq: 1 INVITE\r\n"
            "Via: SIP/2.0/UDP 10.139.4.84;branch=z9hG4bK-de2c934952294f774ee0acbc133e9b1d\r\n"
            "Via: SIP/2.0/UDP 10.139.33.244;branch=z9hG4bKac1198312375\r\n"
            "Content-Length: 0\r\n"
            "\r\n"
                                 );

         CPPUNIT_ASSERT(!m0.getAcceptField(v));

         HttpMessage m1(
            "SUBSCRIBE sip:[email protected] SIP/2.0\r\n"
            "From: <sip:[email protected]>;tag=1c1198308561\r\n"
            "To: <sip:[email protected];user=phone>\r\n"
            "Call-Id: [email protected]\r\n"
            "Cseq: 1 INVITE\r\n"
            "Via: SIP/2.0/UDP 10.139.4.84;branch=z9hG4bK-de2c934952294f774ee0acbc133e9b1d\r\n"
            "Via: SIP/2.0/UDP 10.139.33.244;branch=z9hG4bKac1198312375\r\n"
            "Accept: foo, bar\r\n"
            "Content-Length: 0\r\n"
            "\r\n"
                                 );

         CPPUNIT_ASSERT(m1.getAcceptField(v));
         ASSERT_STR_EQUAL("foo, bar", v.data());

         HttpMessage m2(
            "SUBSCRIBE sip:[email protected] SIP/2.0\r\n"
            "From: <sip:[email protected]>;tag=1c1198308561\r\n"
            "To: <sip:[email protected];user=phone>\r\n"
            "Call-Id: [email protected]\r\n"
            "Cseq: 1 INVITE\r\n"
            "Via: SIP/2.0/UDP 10.139.4.84;branch=z9hG4bK-de2c934952294f774ee0acbc133e9b1d\r\n"
            "Via: SIP/2.0/UDP 10.139.33.244;branch=z9hG4bKac1198312375\r\n"
            "Accept: foo, bar\r\n"
            "Accept: baz\r\n"
            "Content-Length: 0\r\n"
            "\r\n"
                                 );

         CPPUNIT_ASSERT(m2.getAcceptField(v));
         ASSERT_STR_EQUAL("foo, bar,baz", v.data());
      }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:51,代码来源:HttpMessageTest.cpp

示例13: sanityTest

    // Basic santity checking for lines; make sure they work as expected
    void sanityTest()
    {
        Url identity("\"Display Name\" <sip:[email protected]>", Url::NameAddr, NULL) ;
        SipLine line(identity, identity, "userId") ;

        Url url = line.getIdentity() ;
        ASSERT_STR_EQUAL(identity.toString().data(), url.toString().data()) ;
        line.getPreferredContactUri(url) ;
        CPPUNIT_ASSERT(url.isUserHostPortEqual(url, SIP_PORT) == true) ;
        UtlString lineId = line.getLineId() ;
        UtlString lineParamId;
        url.getUrlParameter(SIP_LINE_IDENTIFIER, lineParamId) ;
        ASSERT_STR_EQUAL(lineParamId.data(), lineId.data()) ;
    }
开发者ID:astubbs,项目名称:sipxecs,代码行数:15,代码来源:SipLineTest.cpp

示例14: BadReferFromExchangeWithPort

   // Test that a buggy REFER without Replaces from Exchange is modified
   void BadReferFromExchangeWithPort()
      {
         UtlString identity; // no authenticated identity
         Url requestUri("sip:[email protected]:56777");

         const char* message =
            "REFER sip:[email protected]:56777 SIP/2.0\r\n"
            "Refer-To: [email protected]:56777\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "User-Agent: RTCC/2\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";
         SipMessage testMsg(message, strlen(message));

         UtlSList noRemovedRoutes;
         UtlString myRouteName("myhost.example.com");
         RouteState routeState( testMsg, noRemovedRoutes, myRouteName );

         const char unmodifiedRejectReason[] = "unmodified";
         UtlString rejectReason(unmodifiedRejectReason);
         
         UtlString method("REFER");
         bool bSpiralingRequest = false;
         AuthPlugin::AuthResult priorResult = AuthPlugin::CONTINUE;
         
         CPPUNIT_ASSERT(AuthPlugin::CONTINUE
                        == xferctl->authorizeAndModify(identity,
                                                       requestUri,
                                                       routeState,
                                                       method,
                                                       priorResult,
                                                       testMsg,
                                                       bSpiralingRequest,
                                                       rejectReason
                                                       ));
         ASSERT_STR_EQUAL(unmodifiedRejectReason, rejectReason.data());

         // check that the target has been modified to our domain
         UtlString modifiedReferToStr;
         CPPUNIT_ASSERT(testMsg.getReferToField(modifiedReferToStr));

         ASSERT_STR_EQUAL("sip:[email protected]", modifiedReferToStr.data());
      }
开发者ID:LordGaav,项目名称:sipxecs,代码行数:50,代码来源:MSFT_ExchangeTransferHackTest.cpp

示例15: getOneRowByNameTest

   void getOneRowByNameTest()
   {
      SipDbTestContext sipDbTestContext(TEST_DATA_DIR "/locationdata",
                                        TEST_WORK_DIR "/locationdata"
                                                 );
      sipDbTestContext.inputFile("dummy_loc_db.xml" );
      
      LocationDB* pLocDb = LocationDB::getInstance("dummy_loc_db");
      UtlHashMap hashmap;
      CPPUNIT_ASSERT( !pLocDb->getRowByName( "Washington", hashmap ) );
      CPPUNIT_ASSERT( pLocDb->getRowByName( "Ottawa", hashmap ) );
      CPPUNIT_ASSERT( hashmap.entries() == 4 );

      UtlString* pTempString;
      UtlString key;
      key = "name";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "Ottawa", pTempString->data() );
      
      key = "description";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "One crazy location", pTempString->data() );
      
      key = "locationcode";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "613", pTempString->data() );

      key = "subnets";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "172.30.0.0/16,22.22.22.22/32", pTempString->data() );

      // get a second location row
      CPPUNIT_ASSERT( pLocDb->getRowByName( "Quebec", hashmap ) );
      CPPUNIT_ASSERT( hashmap.entries() == 4 );

      key = "name";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "Quebec", pTempString->data() );
      
      key = "description";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "Happy 400th anniversary", pTempString->data() );
      
      key = "locationcode";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "418", pTempString->data() );

      key = "subnets";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( SPECIAL_IMDB_NULL_VALUE, pTempString->data() );
   }
开发者ID:LordGaav,项目名称:sipxecs,代码行数:59,代码来源:LocationDbTest.cpp


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