[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "regression-test-setLocatorDestIds" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Apr 11 16:41:34 CDT 2011


branch "regression-test-setLocatorDestIds" has been created
        at  380a45c5726befcc0e01ce2b1cf181cd98605e48 (commit)

- Log -----------------------------------------------------------------
commit 380a45c5726befcc0e01ce2b1cf181cd98605e48
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Mon Apr 11 16:39:21 2011 -0500

    Added regression test for fix to setEndpointLocatorDestinationIds found during SIPit.

diff --git a/test/TestRouting.cpp b/test/TestRouting.cpp
index 0c5d4c7..b3751ff 100644
--- a/test/TestRouting.cpp
+++ b/test/TestRouting.cpp
@@ -584,3 +584,74 @@ BOOST_FIXTURE_TEST_CASE(AttendedTransfer, PerTestFixture)
         BOOST_CHECK(unknownException);
     }
 }
+
+/**
+ * Test changing the locator ids for a registered endpoint locator.
+ */
+BOOST_AUTO_TEST_CASE(ChangeLocatorIds)
+{
+    bool addLocatorSucceeded(true);
+    try
+    {
+        SharedTestData::instance.locatorRegistry->addEndpointLocator("TestChannel", 
+                                                                     SharedTestData::instance.regExIds, 
+                                                                     SharedTestData::instance.endpointLocatorPrx);
+    }
+    catch (...)
+    {
+        addLocatorSucceeded = false;
+        BOOST_TEST_MESSAGE("Exception adding EndpointLocator.");
+    }
+
+    BOOST_REQUIRE(addLocatorSucceeded);
+
+    // Change the set of ids that our mock endpoint locator is supporting locally. 
+    SharedTestData::instance.endpointLocator->clear();
+
+    SharedTestData::instance.endpointLocator->addEndpoint("abc");
+    SharedTestData::instance.endpointLocator->addEndpoint("def");
+
+    // Initialize the regular expressions for the ids that our mock channel will support.
+    SharedTestData::instance.regExIds.push_back("abc");
+    SharedTestData::instance.regExIds.push_back("def");  
+
+    // Tell the routing service we have different destination ids
+    bool modSucceeded(true);
+    try
+    {
+        std::vector<std::string> newvals;
+        newvals.push_back("abc");
+        newvals.push_back("def");
+        SharedTestData::instance.locatorRegistry->setEndpointLocatorDestinationIds("TestChannel", newvals);
+    }
+    catch (...)
+    {
+        modSucceeded = false;
+        BOOST_TEST_MESSAGE("Exception modifying EndpointLocator.");
+    }
+    BOOST_REQUIRE(modSucceeded);
+
+    // Now make sure we can do a lookup with the new ids. 
+    bool lookupSucceeded(true);
+    try
+    {
+        BOOST_TEST_MESSAGE("Looking up endpoint via Routing Service...");
+        string lookupVal = "abc";
+        AsteriskSCF::Core::Endpoint::V1::EndpointSeq seq = SharedTestData::instance.locatorRegistry->lookup(lookupVal);
+
+        BOOST_TEST_MESSAGE(" ...lookup completed.");
+
+        BOOST_CHECK(seq.size() > 0);
+        BOOST_CHECK(seq[0]->getId() == lookupVal);
+    }
+    catch (...)
+    {
+        lookupSucceeded = false;
+        BOOST_TEST_MESSAGE("Exception during lookup of modified EndpointLocator.");
+    }
+
+    BOOST_CHECK(lookupSucceeded);
+
+    BOOST_TEST_MESSAGE("Completed ChangeLocatorIds test.");
+
+}

commit 62336bb7f690b64562ccd19ed6cd370f6e47ac28
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Apr 11 17:59:49 2011 -0300

    Fix a scoping issue.

diff --git a/src/EndpointRegistry.cpp b/src/EndpointRegistry.cpp
index 73a51d3..362d625 100644
--- a/src/EndpointRegistry.cpp
+++ b/src/EndpointRegistry.cpp
@@ -224,7 +224,7 @@ void EndpointRegistry::setEndpointLocatorDestinationIds(const std::string& locat
 
         {   // critical scope
             boost::shared_lock<boost::shared_mutex> lock(mImpl->mLock);
-            EndpointLocatorMapIterator existing = mImpl->mEndpointLocatorMap.find(locatorId);
+            existing = mImpl->mEndpointLocatorMap.find(locatorId);
             end = mImpl->mEndpointLocatorMap.end();
         }
 

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/routing.git



More information about the asterisk-scf-commits mailing list