[asterisk-scf-commits] asterisk-scf/integration/servicediscovery.git branch "operation-context-propagation" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Feb 2 14:16:24 CST 2012


branch "operation-context-propagation" has been created
        at  46662a7b26b07f8090151101f1d3137bd147e340 (commit)

- Log -----------------------------------------------------------------
commit 46662a7b26b07f8090151101f1d3137bd147e340
Author: Brent Eagles <beagles at digium.com>
Date:   Thu Feb 2 16:45:57 2012 -0330

    build fixes for operation context (TODO, spread cache throughout)

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 1851327..6edfc3e 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -25,6 +25,7 @@
 #include <AsteriskSCF/Logger/IceLogger.h>
 #include <AsteriskSCF/System/Component/ReplicaIf.h>
 #include <AsteriskSCF/CollocatedIceStorm/CollocatedIceStorm.h>
+#include <AsteriskSCF/Helpers/OperationContext.h>
 
 #include "ServiceLocatorManagement.h"
 #include "ServiceManagement.h"
@@ -297,7 +298,7 @@ void ServiceLocatorApp::start(const string& appName, const Ice::CommunicatorPtr&
 	ServiceLocatorParamsPtr params = new ServiceLocatorParams;
 	params->category = TopicManagerCategory;
 	params->service = "default";
-	icestormManagement->addLocatorParams(params, "");
+	icestormManagement->addLocatorParams(AsteriskSCF::createContext(), params, "");
     }
 
     mDiscoveryAdapter->activate();
diff --git a/src/ServiceLocatorStateListener.cpp b/src/ServiceLocatorStateListener.cpp
index a549e3b..81f95d6 100644
--- a/src/ServiceLocatorStateListener.cpp
+++ b/src/ServiceLocatorStateListener.cpp
@@ -24,6 +24,7 @@
 
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
+#include <AsteriskSCF/Helpers/OperationContext.h>
 
 #include "ServiceLocatorManagement.h"
 #include "ServiceManagement.h"
@@ -145,7 +146,8 @@ public:
 		}
 
 		// Parameters are only ever added, they are never modified or removed
-		i->second->getService()->addLocatorParams(paramsState->params, paramsState->compareGuid);
+		i->second->getService()->addLocatorParams(AsteriskSCF::createContext(),
+                    paramsState->params, paramsState->compareGuid);
 	    }
 	    else if ((comparatorState = ServiceLocatorComparatorStateItemPtr::dynamicCast((*item))))
 	    {
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index fac2e48..34f2e7f 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -369,7 +369,9 @@ bool ServiceLocatorParamsSpec::isSupported(const ServiceLocatorParamsPtr& params
 /**
  * Implementation of the addLocatorParams method as defined in service_locator.ice
  */
-void ServiceManagementImpl::addLocatorParams(const ServiceLocatorParamsPtr& params, const std::string& compareGuid, const Ice::Current&)
+void ServiceManagementImpl::addLocatorParams(
+    const AsteriskSCF::System::V1::OperationContextPtr&,
+    const ServiceLocatorParamsPtr& params, const std::string& compareGuid, const Ice::Current&)
 {
     boost::unique_lock<boost::shared_mutex> lock(mImpl->mLock);
 
diff --git a/src/ServiceManagement.h b/src/ServiceManagement.h
index a1966d7..0a6c3d6 100644
--- a/src/ServiceManagement.h
+++ b/src/ServiceManagement.h
@@ -39,7 +39,8 @@ public:
     //
     // AsteriskSCF::Core::Discovery::V1::ServiceManagement interface.
     //
-    void addLocatorParams(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr&, const std::string&, const Ice::Current& = Ice::Current());
+    void addLocatorParams(const AsteriskSCF::System::V1::OperationContextPtr&, 
+        const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr&, const std::string&, const Ice::Current& = Ice::Current());
     void suspend(const Ice::Current& = Ice::Current());
     void unsuspend(const Ice::Current& = Ice::Current());
     void unregister(const Ice::Current& = Ice::Current());
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index bbfa333..36889da 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,3 +1,4 @@
+include_directories(${astscf-ice-util-cpp_dir}/include)
 astscf_component_init(service_locator_test)
 astscf_component_add_files(service_locator_test TestServiceLocator.cpp)
 astscf_component_add_files(service_locator_test TestComparatorBlocking.cpp)
diff --git a/test/TestComparatorBlocking.cpp b/test/TestComparatorBlocking.cpp
index 7272313..265355f 100644
--- a/test/TestComparatorBlocking.cpp
+++ b/test/TestComparatorBlocking.cpp
@@ -34,6 +34,7 @@
 #include <Ice/Ice.h>
 
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
+#include <AsteriskSCF/Helpers/OperationContext.h>
 
 using namespace AsteriskSCF::Core::Discovery::V1;
 
@@ -160,7 +161,7 @@ public:
         management->addCompare("blocker", blockerProxy);
 
         params->category = "self";
-        proxy->addLocatorParams(params, "blocker");
+        proxy->addLocatorParams(AsteriskSCF::createContext(), params, "blocker");
     }
 
     ~Fixture()
diff --git a/test/TestServiceLocator.cpp b/test/TestServiceLocator.cpp
index c39619d..fc14e48 100644
--- a/test/TestServiceLocator.cpp
+++ b/test/TestServiceLocator.cpp
@@ -26,6 +26,8 @@
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
 
+#include <AsteriskSCF/Helpers/OperationContext.h>
+
 using namespace std;
 using namespace AsteriskSCF::Core::Discovery::V1;
 
@@ -353,7 +355,7 @@ BOOST_AUTO_TEST_CASE(AddLocatorParamsWithoutCompareService)
         params->category = "test";
         params->service = "default";
 
-        testbed.compareManagement->addLocatorParams(params, "");
+        testbed.compareManagement->addLocatorParams(AsteriskSCF::createContext(), params, "");
 
         added = true;
     }
@@ -487,7 +489,7 @@ BOOST_AUTO_TEST_CASE(AddLocatorParamsWithCompareService)
         params->category = "test2";
         params->service = "default";
 
-        testbed.compareManagement->addLocatorParams(params, "testcompare");
+        testbed.compareManagement->addLocatorParams(AsteriskSCF::createContext(), params, "testcompare");
 
         added = true;
     }
@@ -553,7 +555,7 @@ BOOST_AUTO_TEST_CASE(FindMultipleServices)
     params->category = "test";
     params->service = "default";
 
-    compareManagement->addLocatorParams(params, "");
+    compareManagement->addLocatorParams(AsteriskSCF::createContext(), params, "");
 
     bool found = testbed.findServices("test", "", 2);
 
@@ -572,7 +574,7 @@ BOOST_AUTO_TEST_CASE(FindMultipleServicesUsingEmptyCategory)
 
     params->category = "test";
 
-    compareManagement->addLocatorParams(params, "");
+    compareManagement->addLocatorParams(AsteriskSCF::createContext(), params, "");
 
     // This takes into account that the service locator internally publishes an IceStorm topic manager service
     bool found = testbed.findServices("", "", 3);

commit 781b2b7edd18b0f8e0c88e6fe5f53d1ff840210e
Author: Brent Eagles <beagles at digium.com>
Date:   Tue Jan 24 14:18:27 2012 -0330

    Add an accessor to ServiceManagement object to query the registered
    locator param objects.

diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 9db70e6..fac2e48 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -75,6 +75,11 @@ public:
 
     bool isSupported(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr&, const IsSupportedCallbackPtr&);
 
+    ServiceLocatorParamsPtr getParams()
+    {
+        return mStateItem->params;
+    }
+
 private:
     /**
      * Parameters state replication item.
@@ -426,6 +431,19 @@ ServiceStatus ServiceManagementImpl::getStatus() const
     }
 }
 
+ServiceLocatorParamsSeq ServiceManagementImpl::getLocatorParams(const Ice::Current&)
+{
+    
+    boost::shared_lock<boost::shared_mutex> lock(mImpl->mLock);
+    ServiceLocatorParamsSeq result;
+    for (std::vector<boost::shared_ptr<ServiceLocatorParamsSpec> >::const_iterator iter = mImpl->mSupportedLocatorParams.begin();
+         iter != mImpl->mSupportedLocatorParams.end(); ++iter)
+    {
+        result.push_back(ServiceLocatorParamsPtr::dynamicCast((*iter)->getParams()->ice_clone()));
+    }
+    return result;
+}
+
 /**
  * Implementation of the unregister method as defined in service_locator.ice
  */
diff --git a/src/ServiceManagement.h b/src/ServiceManagement.h
index 66fd43f..a1966d7 100644
--- a/src/ServiceManagement.h
+++ b/src/ServiceManagement.h
@@ -45,6 +45,8 @@ public:
     void unregister(const Ice::Current& = Ice::Current());
     AsteriskSCF::Core::Discovery::V1::ServiceStatus getStatus(const Ice::Current&) const { return getStatus(); }
 
+    AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsSeq getLocatorParams(const Ice::Current&);
+
     Ice::ObjectPrx getService();
     AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx getServiceManagementPrx();
     void isSupported(

commit 1b5d9634d1e151d22da4e647d1faff4c39d85f61
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Jan 3 14:37:39 2012 -0600

    Adjust component library names and update test config files

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 78174e6..6a91640 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,20 +1,20 @@
 include_directories(${astscf-ice-util-cpp_dir}/include)
 include_directories(${logger_dir}/include)
 
-astscf_component_init(service_locator)
-astscf_component_add_slices(service_locator PROJECT AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice)
-astscf_component_add_files(service_locator ServiceLocator.cpp)
-astscf_component_add_files(service_locator ServiceLocatorManagement.cpp)
-astscf_component_add_files(service_locator ServiceManagement.cpp)
-astscf_component_add_files(service_locator ServiceManagement.h)
-astscf_component_add_files(service_locator ServiceLocatorManagement.h)
-astscf_component_add_files(service_locator ServiceLocatorStateReplicator.h)
-astscf_component_add_files(service_locator ServiceLocatorStateListener.cpp)
-astscf_component_add_ice_libraries(service_locator IceStorm)
-astscf_component_add_boost_libraries(service_locator core thread date_time)
-astscf_component_build_icebox(service_locator)
-target_link_libraries(service_locator LoggingClient ASTSCFIceUtilCpp)
-astscf_component_install(service_locator)
+astscf_component_init(ServiceLocator)
+astscf_component_add_slices(ServiceLocator PROJECT AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice)
+astscf_component_add_files(ServiceLocator ServiceLocator.cpp)
+astscf_component_add_files(ServiceLocator ServiceLocatorManagement.cpp)
+astscf_component_add_files(ServiceLocator ServiceManagement.cpp)
+astscf_component_add_files(ServiceLocator ServiceManagement.h)
+astscf_component_add_files(ServiceLocator ServiceLocatorManagement.h)
+astscf_component_add_files(ServiceLocator ServiceLocatorStateReplicator.h)
+astscf_component_add_files(ServiceLocator ServiceLocatorStateListener.cpp)
+astscf_component_add_ice_libraries(ServiceLocator IceStorm)
+astscf_component_add_boost_libraries(ServiceLocator core thread date_time)
+astscf_component_build_icebox(ServiceLocator)
+target_link_libraries(ServiceLocator LoggingClient ASTSCFIceUtilCpp)
+astscf_component_install(ServiceLocator)
 
 astscf_component_init(ServiceLocatorStateReplicator)
 astscf_component_add_slices(ServiceLocatorStateReplicator PROJECT AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice)

commit aaff657ebc33e245d2721e2bb27ad3f44f7c7ef9
Merge: f5f07fb e2ae2ad
Author: Mark Michelson <mmichelson at digium.com>
Date:   Fri Dec 30 14:53:50 2011 -0600

    Merge branch 'master' of git.asterisk.org:asterisk-scf/release/servicediscovery


commit f5f07fb426c35417c6f73c7c9b7e4b2ce3d1dc80
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Dec 28 12:17:20 2011 -0600

    Adjust for name changes in ice-util-cpp

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4f106e5..78174e6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -13,7 +13,7 @@ astscf_component_add_files(service_locator ServiceLocatorStateListener.cpp)
 astscf_component_add_ice_libraries(service_locator IceStorm)
 astscf_component_add_boost_libraries(service_locator core thread date_time)
 astscf_component_build_icebox(service_locator)
-target_link_libraries(service_locator LoggingClient astscf-ice-util-cpp)
+target_link_libraries(service_locator LoggingClient ASTSCFIceUtilCpp)
 astscf_component_install(service_locator)
 
 astscf_component_init(ServiceLocatorStateReplicator)

commit 60c7d5708bf016e64b96583af3df8118dc054c5d
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Dec 27 16:46:33 2011 -0600

    Adjust for logger name changes.

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cfd57d9..4f106e5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -13,7 +13,7 @@ astscf_component_add_files(service_locator ServiceLocatorStateListener.cpp)
 astscf_component_add_ice_libraries(service_locator IceStorm)
 astscf_component_add_boost_libraries(service_locator core thread date_time)
 astscf_component_build_icebox(service_locator)
-target_link_libraries(service_locator logging-client astscf-ice-util-cpp)
+target_link_libraries(service_locator LoggingClient astscf-ice-util-cpp)
 astscf_component_install(service_locator)
 
 astscf_component_init(ServiceLocatorStateReplicator)
@@ -23,5 +23,5 @@ astscf_component_add_files(ServiceLocatorStateReplicator ServiceLocatorStateRepl
 astscf_component_add_ice_libraries(ServiceLocatorStateReplicator IceStorm)
 astscf_component_add_boost_libraries(ServiceLocatorStateReplicator thread date_time)
 astscf_component_build_icebox(ServiceLocatorStateReplicator)
-target_link_libraries(ServiceLocatorStateReplicator logging-client)
+target_link_libraries(ServiceLocatorStateReplicator LoggingClient)
 astscf_component_install(ServiceLocatorStateReplicator)
diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index b7ec895..94208ea 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -21,7 +21,7 @@
 #include <AsteriskSCF/Helpers/PropertyHelper.h>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
-#include <AsteriskSCF/logger.h>
+#include <AsteriskSCF/Logger.h>
 #include <AsteriskSCF/Logger/IceLogger.h>
 #include <AsteriskSCF/System/Component/ReplicaIf.h>
 #include <AsteriskSCF/CollocatedIceStorm/CollocatedIceStorm.h>
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index 0cfd407..48e17fe 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -22,7 +22,7 @@
 
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
-#include <AsteriskSCF/logger.h>
+#include <AsteriskSCF/Logger.h>
 #include <AsteriskSCF/Async/ResponseCollector.h>
 
 #include "ServiceLocatorStateReplicationIf.h"
diff --git a/src/ServiceLocatorStateReplicatorApp.cpp b/src/ServiceLocatorStateReplicatorApp.cpp
index 23378f7..ecc505f 100644
--- a/src/ServiceLocatorStateReplicatorApp.cpp
+++ b/src/ServiceLocatorStateReplicatorApp.cpp
@@ -21,7 +21,7 @@
 
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/System/Component/ComponentServiceIf.h>
-#include <AsteriskSCF/logger.h>
+#include <AsteriskSCF/Logger.h>
 #include <AsteriskSCF/Logger/IceLogger.h>
 #include "ServiceLocatorStateReplicator.h"
 
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 2beec01..c329520 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -23,7 +23,7 @@
 
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
-#include <AsteriskSCF/logger.h>
+#include <AsteriskSCF/Logger.h>
 #include <AsteriskSCF/Async/ResponseCollector.h>
 
 #include "ServiceLocatorStateReplicationIf.h"

commit e2ae2ad8314bf9fbc10c8b27f6fdc9e068ee6c78
Author: Brent Eagles <beagles at digium.com>
Date:   Tue Dec 6 17:29:03 2011 -0330

    Modify all unit tests to use loopback adapter.

diff --git a/config/test_component.conf b/config/test_component.conf
index 18866fe..24a5805 100644
--- a/config/test_component.conf
+++ b/config/test_component.conf
@@ -23,25 +23,25 @@ IceBox.LoadOrder=ServiceDiscoveryStateReplicator,ServiceDiscovery,ServiceDiscove
 IceBox.Service.ServiceDiscovery=service_locator:create
 
 # Test endpoints for the service locator local adapter
-ServiceDiscovery.BackplaneAdapter.Endpoints=tcp -p 4410
+ServiceDiscovery.BackplaneAdapter.Endpoints=tcp -h 127.0.0.1 -p 4410
 
 # Test endpoints for the service locator discovery adapter
-ServiceDiscovery.Locator.ServiceAdapter.Endpoints=tcp -p 4411
+ServiceDiscovery.Locator.ServiceAdapter.Endpoints=tcp -h 127.0.0.1  -p 4411
 
 # Test endpoints for the service locator management adapter
-ServiceDiscovery.Management.ServiceAdapter.Endpoints=tcp -p 4412
+ServiceDiscovery.Management.ServiceAdapter.Endpoints=tcp -h 127.0.0.1  -p 4412
 
 # Name for the IceStorm instance
 ServiceDiscovery.IceStorm.InstanceName=ServiceDiscovery
 
 # Proxy to the state replicator
-ServiceDiscovery.StateReplicator.Proxy=ServiceLocatorStateReplicatorService:tcp -p 4413
+ServiceDiscovery.StateReplicator.Proxy=ServiceLocatorStateReplicatorService:tcp -h 127.0.0.1  -p 4413
 
 # Configure ourselves as a master
 ServiceDiscovery.Standalone=no
 
-ServiceDiscovery.IceStorm.TopicManager.Endpoints=default -p 4421
-ServiceDiscovery.IceStorm.Publish.Endpoints=tcp -p 4422:udp -p 4422
+ServiceDiscovery.IceStorm.TopicManager.Endpoints=default -h 127.0.0.1  -p 4421
+ServiceDiscovery.IceStorm.Publish.Endpoints=tcp -h 127.0.0.1  -p 4422:udp -h 127.0.0.1  -p 4422
 ServiceDiscovery.IceStorm.Trace.TopicManager=2
 ServiceDiscovery.IceStorm.Transient=1
 ServiceDiscovery.IceStorm.Flush.Timeout=2000
@@ -52,11 +52,10 @@ ServiceDiscovery.IceStorm.Flush.Timeout=2000
 IceBox.Service.ServiceDiscoveryStateReplicator=ServiceLocatorStateReplicator:create
 
 # Test endpoints for the state replicator
-ServiceDiscoveryStateReplicator.Adapter.Endpoints=tcp -p 4413:udp -p 4413
+ServiceDiscoveryStateReplicator.Adapter.Endpoints=tcp -h 127.0.0.1  -p 4413:udp -h 127.0.0.1  -p 4413
 
 # test configuration
 IceBox.Service.ServiceDiscoveryTest=service_locator_test:create
 
-LocatorService.Proxy=LocatorService:tcp -p 4411
-LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4412
-
+LocatorService.Proxy=LocatorService:tcp -h 127.0.0.1  -p 4411
+LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -h 127.0.0.1  -p 4412
diff --git a/test/TestComparatorBlocking.cpp b/test/TestComparatorBlocking.cpp
index 8827fc2..7272313 100644
--- a/test/TestComparatorBlocking.cpp
+++ b/test/TestComparatorBlocking.cpp
@@ -137,7 +137,7 @@ public:
         blocker(new BlockingComparator()),
         blockerAdapter(
             blockerCommunicator->createObjectAdapterWithEndpoints(
-                "blocker", "default")),
+                "blocker", "default -h 127.0.0.1")),
         blockerProxy(
             ServiceLocatorParamsComparePrx::checkedCast(
                 blockerAdapter->addWithUUID(blocker))),
@@ -145,10 +145,10 @@ public:
         discoveryCommunicator(Ice::initialize()),
         management(ServiceLocatorManagementPrx::checkedCast(
                 discoveryCommunicator->stringToProxy(
-                    "LocatorServiceManagement:tcp -p 4412"))),
+                    "LocatorServiceManagement:tcp -h 127.0.0.1 -p 4412"))),
         discovery(ServiceLocatorPrx::checkedCast(
                 discoveryCommunicator->stringToProxy(
-                    "LocatorService:tcp -p 4411"))),
+                    "LocatorService:tcp -h 127.0.0.1 -p 4411"))),
         proxy(management->addService(management, "self")),
         params(new ServiceLocatorParams())
     {
diff --git a/test/TestServiceLocator.cpp b/test/TestServiceLocator.cpp
index 595b1a2..c39619d 100644
--- a/test/TestServiceLocator.cpp
+++ b/test/TestServiceLocator.cpp
@@ -176,7 +176,7 @@ struct GlobalIceFixture
         {
             testbed.communicatorIncoming = Ice::initialize(mCachedArgs.argc, mCachedArgs.argv);
 
-            testbed.adapter = testbed.communicatorIncoming->createObjectAdapterWithEndpoints("CompareServiceAdapter", "default");
+            testbed.adapter = testbed.communicatorIncoming->createObjectAdapterWithEndpoints("CompareServiceAdapter", "default -h 127.0.0.1");
 
             ServiceLocatorParamsComparePtr CompareService = new TestCompareServiceImpl();
 
@@ -188,14 +188,14 @@ struct GlobalIceFixture
 
             // TODO: This should use a configuration file most likely instead of hardcoding
 
-            testbed.management = ServiceLocatorManagementPrx::checkedCast(testbed.communicatorOutgoing->stringToProxy("LocatorServiceManagement:tcp -p 4412"));
+            testbed.management = ServiceLocatorManagementPrx::checkedCast(testbed.communicatorOutgoing->stringToProxy("LocatorServiceManagement:tcp -h 127.0.0.1 -p 4412"));
 
             if (!testbed.management)
             {
                 throw "Invalid service discovery management proxy";
             }
 
-            testbed.discovery = ServiceLocatorPrx::checkedCast(testbed.communicatorOutgoing->stringToProxy("LocatorService:tcp -p 4411"));
+            testbed.discovery = ServiceLocatorPrx::checkedCast(testbed.communicatorOutgoing->stringToProxy("LocatorService:tcp -h 127.0.0.1 -p 4411"));
 
             if (!testbed.discovery)
             {

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/integration/servicediscovery.git



More information about the asterisk-scf-commits mailing list