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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Sun Dec 4 17:54:01 CST 2011


branch "master" has been updated
       via  9f904f9821b2ba067f532272bd3140c75abd22cf (commit)
      from  722e080131e9a32952103bd55bf3243ba3b61fd0 (commit)

Summary of changes:
 src/ServiceLocator.cpp      |   17 +++++++++++++++--
 test/TestServiceLocator.cpp |   37 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 51 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit 9f904f9821b2ba067f532272bd3140c75abd22cf
Author: Joshua Colp <jcolp at digium.com>
Date:   Sun Dec 4 19:48:05 2011 -0400

    Add support for getting the Service Locator Management interface using a facet and for locating the IceStorm topic manager using the service locator itself. (issue ASTSCF-317)

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 2522101..55091d2 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -267,9 +267,9 @@ void ServiceLocatorApp::start(const string& appName, const Ice::CommunicatorPtr&
             lg(Info) << "Operating in an active state and pushing updates." << endl;
         }
     }
-	catch (const std::exception& e)
+    catch (const std::exception& e)
     {
-		lg(Warning) << "Operating in an active and standalone state since we got an exception: " << e.what() << endl;
+        lg(Warning) << "Operating in an active and standalone state since we got an exception: " << e.what() << endl;
     }
     catch (...)
     {
@@ -287,6 +287,19 @@ void ServiceLocatorApp::start(const string& appName, const Ice::CommunicatorPtr&
 
     mDiscoveryAdapter->add(locatorService, communicator->stringToIdentity("LocatorService"));
 
+    mDiscoveryAdapter->addFacet(locatorServiceManagement, communicator->stringToIdentity("LocatorService"), ServiceLocatorManagementFacet);
+
+    // Make our IceStorm topic manager available to all if we are the active service. This is because by adding it
+    // we will replicate it.
+    if (mReplicaService->isActive() == true)
+    {
+	ServiceManagementPrx icestormManagement = locatorServiceManagement->addService(topicManager, "TopicManager", Ice::Current());
+	ServiceLocatorParamsPtr params = new ServiceLocatorParams;
+	params->category = TopicManagerCategory;
+	params->service = "default";
+	icestormManagement->addLocatorParams(params, "");
+    }
+
     mDiscoveryAdapter->activate();
 
     lg(Info) << "Activated service discovery.";
diff --git a/test/TestServiceLocator.cpp b/test/TestServiceLocator.cpp
index ccf4122..595b1a2 100644
--- a/test/TestServiceLocator.cpp
+++ b/test/TestServiceLocator.cpp
@@ -239,6 +239,40 @@ using namespace InternalTestNS;
 BOOST_GLOBAL_FIXTURE(GlobalIceFixture);
 
 /**
+ * Confirm that we find the built-in IceStorm topic manager.
+ */
+BOOST_AUTO_TEST_CASE(FindBuiltinIceStorm)
+{
+    bool found = testbed.findService(TopicManagerCategory, "default");
+
+    BOOST_CHECK(found);
+}
+
+/**
+ * Confirm that the management interface is available.
+ */
+BOOST_AUTO_TEST_CASE(GetManagementFacet)
+{
+    bool retrieved = false;
+
+    try
+    {
+        ServiceLocatorManagementPrx management = ServiceLocatorManagementPrx::checkedCast(testbed.discovery, ServiceLocatorManagementFacet);
+        retrieved = true;
+    }
+    catch (const Ice::Exception &e)
+    {
+        BOOST_TEST_MESSAGE(e.ice_name());
+        BOOST_TEST_MESSAGE(e.what());
+    }
+    catch (...)
+    {
+    }
+
+    BOOST_CHECK(retrieved);
+}
+
+/**
  * Confirm that we find no service using locate before we have added one.
  */
 BOOST_AUTO_TEST_CASE(ServiceNotFoundBeforeAdd)
@@ -540,7 +574,8 @@ BOOST_AUTO_TEST_CASE(FindMultipleServicesUsingEmptyCategory)
 
     compareManagement->addLocatorParams(params, "");
 
-    bool found = testbed.findServices("", "", 2);
+    // This takes into account that the service locator internally publishes an IceStorm topic manager service
+    bool found = testbed.findServices("", "", 3);
 
     compareManagement->unregister();
 

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


-- 
asterisk-scf/release/servicediscovery.git



More information about the asterisk-scf-commits mailing list