[asterisk-scf-commits] asterisk-scf/release/routing.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Apr 22 15:53:06 CDT 2011


branch "master" has been updated
       via  5b9b4472bc3b67c0bcd31817a913dfcafa822551 (commit)
      from  728136565bfcda6555d8335ae68dbc1ed3e0859f (commit)

Summary of changes:
 config/routingtest-integ.config.in |    2 +-
 test/TestRouting.cpp               |  118 +++++++++++++++++++++--------------
 2 files changed, 72 insertions(+), 48 deletions(-)


- Log -----------------------------------------------------------------
commit 5b9b4472bc3b67c0bcd31817a913dfcafa822551
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Fri Apr 22 15:51:48 2011 -0500

    Merge of changes from integration branch regression-test-setLocatorDestIds.

diff --git a/config/routingtest-integ.config.in b/config/routingtest-integ.config.in
index 353bb61..001b4c7 100644
--- a/config/routingtest-integ.config.in
+++ b/config/routingtest-integ.config.in
@@ -90,7 +90,7 @@ ServiceLocatorManagementAdapter.Endpoints=tcp -p 4422
 
 # Test endpoints for the service locator adapter
 ServiceLocatorAdapter.Endpoints=tcp -p 4411
-
+ServiceLocatorLocalAdapter.Endpoints=tcp -p 4412
 
 # Logger configuration
 LoggerAdapter.Endpoints=default
diff --git a/test/TestRouting.cpp b/test/TestRouting.cpp
index f82472d..bd60d11 100644
--- a/test/TestRouting.cpp
+++ b/test/TestRouting.cpp
@@ -287,34 +287,25 @@ public:
  */
 BOOST_AUTO_TEST_CASE(AddAndRemoveEndpointLocator)
 {
-    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_FAIL("Exception adding EndpointLocator.");
     }
 
-    BOOST_CHECK(addLocatorSucceeded);
-
-    bool removeLocatorSucceeded(true);
     try
     {
         SharedTestData::instance.locatorRegistry->removeEndpointLocator("TestChannel");
-
     }
     catch (...)
     {
-        removeLocatorSucceeded = false;
-        BOOST_TEST_MESSAGE("Exception removing EndpointLocator.");
+        BOOST_FAIL("Exception removing EndpointLocator.");
     }
-    BOOST_CHECK(removeLocatorSucceeded);
 
     BOOST_TEST_MESSAGE("Completed AddAndRemoveEndpointLocator test.");
-
 }
 
 /**
@@ -324,7 +315,6 @@ BOOST_AUTO_TEST_CASE(AddAndRemoveEndpointLocator)
  */
 BOOST_AUTO_TEST_CASE(AddEndpointLocatorTwice)
 {
-    bool addLocatorSucceeded(true);
     try
     {
         SharedTestData::instance.locatorRegistry->addEndpointLocator("TestChannel", SharedTestData::instance.regExIds, SharedTestData::instance.endpointLocatorPrx);
@@ -332,27 +322,19 @@ BOOST_AUTO_TEST_CASE(AddEndpointLocatorTwice)
     }
     catch (...)
     {
-        addLocatorSucceeded = false;
-        BOOST_TEST_MESSAGE("Exception adding EndpointLocator the second time.");
+        BOOST_FAIL("Exception adding EndpointLocator the second time.");
     }
 
-    BOOST_CHECK(addLocatorSucceeded);
-
-    bool removeLocatorSucceeded(true);
     try
     {
         SharedTestData::instance.locatorRegistry->removeEndpointLocator("TestChannel");
-
     }
     catch (...)
     {
-        removeLocatorSucceeded = false;
-        BOOST_TEST_MESSAGE("Exception removing EndpointLocator.");
+        BOOST_FAIL("Exception removing EndpointLocator.");
     }
-    BOOST_CHECK(removeLocatorSucceeded);
 
     BOOST_TEST_MESSAGE("Completed AddEndpointLocatorTwice test.");
-
 }
 
 /**
@@ -373,21 +355,16 @@ BOOST_FIXTURE_TEST_CASE(LookupOwnEndpoint, PerTestFixture)
     }
     catch(const IceUtil::Exception &ie)
     {
-        bool IceException(false);
         string msg = "Exception looking up our own endpoint:";
         msg += ie.what();
-        BOOST_TEST_MESSAGE(msg);
-        BOOST_CHECK(IceException);
+        BOOST_FAIL(msg);
     }
     catch (...)
     {
-        bool unknownException(false);
-        BOOST_TEST_MESSAGE("Exception looking up our own endpoint.");
-        BOOST_CHECK(unknownException);
+        BOOST_FAIL("Exception looking up our own endpoint.");
     }
 
     BOOST_TEST_MESSAGE("Completed LookupOwnEndpoint test.");
-
 }
 
 /**
@@ -434,17 +411,13 @@ BOOST_FIXTURE_TEST_CASE(RouteSession, PerTestFixture)
     }
     catch(const IceUtil::Exception &ie)
     {
-        bool IceException(false);
         string msg = "Exception in RouteSession:";
         msg += ie.what();
-        BOOST_TEST_MESSAGE(msg);
-        BOOST_CHECK(IceException);
+        BOOST_FAIL(msg);
     }
     catch (...)
     {
-        bool unknownException(false);
-        BOOST_TEST_MESSAGE("Exception in RouteSession:");
-        BOOST_CHECK(unknownException);
+        BOOST_FAIL("Exception in RouteSession:");
     }
 }
 
@@ -496,17 +469,13 @@ BOOST_FIXTURE_TEST_CASE(BlindTransfer, PerTestFixture)
     }
     catch(const IceUtil::Exception &ie)
     {
-        bool IceException(false);
         string msg = "Exception routing session:";
         msg += ie.what();
-        BOOST_TEST_MESSAGE(msg);
-        BOOST_CHECK(IceException);
+        BOOST_FAIL(msg);
     }
     catch (...)
     {
-        bool unknownException(false);
-        BOOST_TEST_MESSAGE("Exception routing session.");
-        BOOST_CHECK(unknownException);
+        BOOST_FAIL("Exception routing session.");
     }
 }
 
@@ -571,16 +540,71 @@ BOOST_FIXTURE_TEST_CASE(AttendedTransfer, PerTestFixture)
     }
     catch(const IceUtil::Exception &ie)
     {
-        bool IceException(false);
         string msg = "Exception in AttendedTransfer:";
         msg += ie.what();
-        BOOST_TEST_MESSAGE(msg);
-        BOOST_CHECK(IceException);
+        BOOST_FAIL(msg);
+    }
+    catch (...)
+    {
+        BOOST_FAIL("Exception in AttendedTransfer:");
+    }
+}
+
+/**
+ * Test changing the locator ids for a registered endpoint locator.
+ */
+BOOST_AUTO_TEST_CASE(ChangeLocatorIds)
+{
+    try
+    {
+        SharedTestData::instance.locatorRegistry->addEndpointLocator("TestChannel", 
+                                                                     SharedTestData::instance.regExIds, 
+                                                                     SharedTestData::instance.endpointLocatorPrx);
     }
     catch (...)
     {
-        bool unknownException(false);
-        BOOST_TEST_MESSAGE("Exception in AttendedTransfer:");
-        BOOST_CHECK(unknownException);
+        BOOST_FAIL("Exception adding EndpointLocator.");
     }
+
+    // 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
+    try
+    {
+        std::vector<std::string> newvals;
+        newvals.push_back("abc");
+        newvals.push_back("def");
+        SharedTestData::instance.locatorRegistry->setEndpointLocatorDestinationIds("TestChannel", newvals);
+    }
+    catch (...)
+    {
+        BOOST_FAIL("Exception modifying EndpointLocator.");
+    }
+
+    // Now make sure we can do a lookup with the new ids. 
+    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 (...)
+    {
+        BOOST_FAIL("Exception during lookup of modified EndpointLocator.");
+    }
+
+    BOOST_TEST_MESSAGE("Completed ChangeLocatorIds test.");
 }

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


-- 
asterisk-scf/release/routing.git



More information about the asterisk-scf-commits mailing list