[hydra-commits] hydra/servicediscovery.git branch "master" updated.

Commits to the Hydra project code repositories hydra-commits at lists.digium.com
Thu Jul 22 10:22:34 CDT 2010


branch "master" has been updated
       via  a3e3a05f27c51f539029895232762f88ab1e7c47 (commit)
       via  a65490068eb21e424d7eaac3ac4c723731842d4d (commit)
       via  347aaefbcb653ec19211359a9965ace810250443 (commit)
       via  9502aface2390830b81bf8d2011bc407d0281ff4 (commit)
       via  08add849d30e939a2e773fddc2ce7b358d04ab92 (commit)
       via  067ed3228e8fb1f7d2db029722bc0f117506e825 (commit)
       via  c664c5d0984c5b7d2172f15454cc5303fed6f040 (commit)
      from  d2396cb459c8fce950de0db1c912bec3bc257559 (commit)

Summary of changes:
 CMakeLists.txt                     |    2 +-
 config/test_icestorm.config        |   30 +++
 config/test_service_locator.config |   10 +
 src/ServiceDiscoveryManagement.cpp |    2 +
 src/ServiceLocator.cpp             |   11 +-
 src/ServiceManagement.cpp          |   17 +-
 test/CMakeLists.txt                |    9 +
 test/TestServiceDiscovery.cpp      |  417 ++++++++++++++++++++++++++++++++++++
 8 files changed, 488 insertions(+), 10 deletions(-)
 create mode 100644 config/test_icestorm.config
 create mode 100644 config/test_service_locator.config
 create mode 100644 test/CMakeLists.txt


- Log -----------------------------------------------------------------
commit a3e3a05f27c51f539029895232762f88ab1e7c47
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Jul 22 12:23:30 2010 -0300

    Unfortunately I can't do the comparison I wanted to do... so check the category.

diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 7b88c77..44364b5 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -42,15 +42,16 @@ bool ServiceManagementImpl::isSupported(const ServiceDiscoveryParamsPtr& params)
 bool ServiceDiscoveryParamsSpec::isSupported(const ServiceDiscoveryParamsPtr& params)
 {
 	/* This is just a simple comparison that acts as a preliminary, and perhaps final, check */
-	if (*_params == *params) {
-		/* If a comparator was provided then yield to it for a final yay or nay */
-		if (!_compare_guid.empty()) {
-			return _management->isSupported(_compare_guid, params);
-		}
-		return true;
+	if (_params->category != params->category) {
+		return false;
 	}
 
-	return false;
+	/* If a comparator was provided then yield to it for a final yay or nay */
+	if (!_compare_guid.empty()) {
+		return _management->isSupported(_compare_guid, params);
+	}
+
+	return true;
 }
 
 void ServiceManagementImpl::addDiscoveryParams(const ServiceDiscoveryParamsPtr& params, const std::string& compare_guid, const Ice::Current&)

commit a65490068eb21e424d7eaac3ac4c723731842d4d
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Jul 22 12:11:35 2010 -0300

    Actually initialize suspended to false so it doesn't turn out to be true right when the service is added.

diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 249a12c..7b88c77 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -12,7 +12,7 @@ using namespace Hydra::Discovery;
 
 ServiceManagementImpl::ServiceManagementImpl(ServiceDiscoveryManagementImpl* management, Ice::ObjectPrx service, Ice::ObjectAdapterPtr adapter,
 					     EventsPrx service_discovery_topic, const string& guid)
-	: _management(management), _service(service), _adapter(adapter), _service_discovery_topic(service_discovery_topic), _guid(guid)
+	: suspended(false), _management(management), _service(service), _adapter(adapter), _service_discovery_topic(service_discovery_topic), _guid(guid)
 {
 	managementprx = ServiceManagementPrx::uncheckedCast(adapter->addWithUUID(this));
 

commit 347aaefbcb653ec19211359a9965ace810250443
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Jul 22 12:09:34 2010 -0300

    Actually add services to our vector of services.

diff --git a/src/ServiceDiscoveryManagement.cpp b/src/ServiceDiscoveryManagement.cpp
index 932c32f..8b8977c 100644
--- a/src/ServiceDiscoveryManagement.cpp
+++ b/src/ServiceDiscoveryManagement.cpp
@@ -45,6 +45,8 @@ ServiceManagementPrx ServiceDiscoveryManagementImpl::addService(const Ice::Objec
 {
 	ServiceManagementImpl* new_service = new ServiceManagementImpl(this, service, _adapter, _service_discovery_topic, guid);
 
+	services.push_back(new_service);
+
 	return new_service->GetServiceManagementPrx();
 }
 

commit 9502aface2390830b81bf8d2011bc407d0281ff4
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Jul 22 12:08:11 2010 -0300

    Add some actual tests, gets to the point where we are now trying to find an actual service we added.

diff --git a/test/TestServiceDiscovery.cpp b/test/TestServiceDiscovery.cpp
index 0ad4512..013ccb0 100644
--- a/test/TestServiceDiscovery.cpp
+++ b/test/TestServiceDiscovery.cpp
@@ -13,6 +13,15 @@
 using namespace std;
 using namespace Hydra::Discovery;
 
+/* A basic compare service implementation that always returns true, this is registered as both a compare service
+ * and a regular service during testing.
+ */
+class TestCompareServiceImpl : public ServiceDiscoveryParamsCompare
+{
+public:
+	bool isSupported(const ServiceDiscoveryParamsPtr&, const Ice::Current&) { return true; };
+};
+
 /* Cache the command line arguments so that Ice can be initialized within the global fixture. */
 struct ArgCacheType
 {
@@ -29,13 +38,23 @@ static ArgCacheType mCachedArgs;
 struct SharedTestData
 {
 public:
+	/* Communicator for stuff */
 	Ice::CommunicatorPtr communicator;
 
+	/* Actual object adapter used for our compare service */
+	Ice::ObjectAdapterPtr adapter;
+
 	/* A proxy to the management service */
 	ServiceDiscoveryManagementPrx management;
 
 	/* A proxy to the actual locate service */
 	ServiceDiscoveryPrx discovery;
+
+	/* A proxy to our own compare service, registered as both a compare service and as a regular service */
+	ServiceDiscoveryParamsComparePrx compare;
+
+	/* A proxy to the service specific management interface */
+	ServiceManagementPrx compare_management;
 };
 static SharedTestData Testbed;
 
@@ -55,12 +74,13 @@ struct GlobalIceFixture
 			int status = 0;
 			try
 				{
-					// Since creating multiple communicators, we have to parse command line args up front.
-					Ice::PropertiesPtr props = Ice::createProperties(mCachedArgs.argc, mCachedArgs.argv);
-					Ice::InitializationData initData;
-					initData.properties = props;
+					Testbed.communicator = Ice::initialize(mCachedArgs.argc, mCachedArgs.argv);
+
+					Testbed.adapter = Testbed.communicator->createObjectAdapterWithEndpoints("CompareServiceAdapter", "default");
+
+					ServiceDiscoveryParamsComparePtr CompareService = new TestCompareServiceImpl();
 
-					Testbed.communicator = Ice::initialize(initData);
+					Testbed.compare = ServiceDiscoveryParamsComparePrx::uncheckedCast(Testbed.adapter->addWithUUID(CompareService));
 
 					Testbed.management = ServiceDiscoveryManagementPrx::checkedCast(Testbed.communicator->stringToProxy("DiscoveryServiceManagement:tcp -p 5674"));
 
@@ -160,6 +180,7 @@ BOOST_AUTO_TEST_CASE(ServicesNotFoundBeforeAdd)
 		BOOST_TEST_MESSAGE(e.ice_name());
 		BOOST_TEST_MESSAGE(e.what());
 		found = false;
+	} catch (...) {
 	}
 
 	BOOST_CHECK(!found);
@@ -170,6 +191,22 @@ BOOST_AUTO_TEST_CASE(ServicesNotFoundBeforeAdd)
  */
 BOOST_AUTO_TEST_CASE(AddService)
 {
+	bool added = false;
+
+	/* Since the service locator doesn't care if there are multiple services registered with the same identifier or
+	 * if the same service is registered multiple times there really isn't any way for this to fail, besides something
+	 * outside the control of the service locator itself or I suppose if it crashes.
+	 */
+	try {
+		Testbed.compare_management = Testbed.management->addService(Testbed.compare, "testcompare");
+		added = true;
+	} catch (const Ice::Exception &e) {
+		BOOST_TEST_MESSAGE(e.ice_name());
+		BOOST_TEST_MESSAGE(e.what());
+	} catch (...) {
+	}
+
+	BOOST_CHECK(added);
 }
 
 /**
@@ -177,6 +214,47 @@ BOOST_AUTO_TEST_CASE(AddService)
  */
 BOOST_AUTO_TEST_CASE(ServiceNotFoundAfterAdd)
 {
+	bool found = true;
+
+	try {
+		ServiceDiscoveryParamsPtr params = new ServiceDiscoveryParams;
+		params->category = "test";
+
+		Ice::ObjectPrx service = Testbed.discovery->locate(params);
+	} catch (const ServiceNotFound&) {
+		found = false;
+	} catch (const Ice::Exception &e) {
+		BOOST_TEST_MESSAGE(e.ice_name());
+		BOOST_TEST_MESSAGE(e.what());
+		found = false;
+	} catch (...) {
+	}
+
+	BOOST_CHECK(!found);
+}
+
+/**
+ * Confirm that we can't find any services after we have added one but before we add parameters.
+ */
+BOOST_AUTO_TEST_CASE(ServicesNotFoundAfterAdd)
+{
+	bool found = true;
+
+	try {
+		ServiceDiscoveryParamsPtr params = new ServiceDiscoveryParams;
+		params->category = "test";
+
+		Ice::ObjectProxySeq services = Testbed.discovery->locateAll(params);
+	} catch (const ServiceNotFound&) {
+		found = false;
+	} catch (const Ice::Exception &e) {
+		BOOST_TEST_MESSAGE(e.ice_name());
+		BOOST_TEST_MESSAGE(e.what());
+		found = false;
+	} catch (...) {
+	}
+
+	BOOST_CHECK(!found);
 }
 
 /**
@@ -184,6 +262,22 @@ BOOST_AUTO_TEST_CASE(ServiceNotFoundAfterAdd)
  */
 BOOST_AUTO_TEST_CASE(AddDiscoveryParamsWithoutCompareService)
 {
+	bool added = false;
+
+	try {
+		ServiceDiscoveryParamsPtr params = new ServiceDiscoveryParams;
+		params->category = "test";
+
+		Testbed.compare_management->addDiscoveryParams(params, "");
+
+		added = true;
+	} catch (const Ice::Exception &e) {
+		BOOST_TEST_MESSAGE(e.ice_name());
+		BOOST_TEST_MESSAGE(e.what());
+	} catch (...) {
+	}
+
+	BOOST_CHECK(added);
 }
 
 /**
@@ -191,6 +285,23 @@ BOOST_AUTO_TEST_CASE(AddDiscoveryParamsWithoutCompareService)
  */
 BOOST_AUTO_TEST_CASE(FindServiceWithoutCompareService)
 {
+	bool found = false;
+
+	try {
+		ServiceDiscoveryParamsPtr params = new ServiceDiscoveryParams;
+		params->category = "test";
+
+		Ice::ObjectPrx service = Testbed.discovery->locate(params);
+
+		found = true;
+	} catch (const ServiceNotFound&) {
+	} catch (const Ice::Exception &e) {
+		BOOST_TEST_MESSAGE(e.ice_name());
+		BOOST_TEST_MESSAGE(e.what());
+	} catch (...) {
+	}
+
+	BOOST_CHECK(found);
 }
 
 /**

commit 08add849d30e939a2e773fddc2ce7b358d04ab92
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Jul 22 11:39:28 2010 -0300

    Add first two tests for making sure no services are found after a clean startup.

diff --git a/test/TestServiceDiscovery.cpp b/test/TestServiceDiscovery.cpp
index 57d5305..0ad4512 100644
--- a/test/TestServiceDiscovery.cpp
+++ b/test/TestServiceDiscovery.cpp
@@ -7,7 +7,13 @@
 
 #include <Ice/Ice.h>
 
-// Cache the command line args so that Ice can be initialized.
+#include "service_discovery.h"
+#include "service_discovery_events.h"
+
+using namespace std;
+using namespace Hydra::Discovery;
+
+/* Cache the command line arguments so that Ice can be initialized within the global fixture. */
 struct ArgCacheType
 {
 public:
@@ -17,6 +23,86 @@ public:
 static ArgCacheType mCachedArgs;
 
 /**
+ * It seems odd that boost doesn't provide an easy way to access the GLOBAL_FIXTURE members.
+ * But it doesn't seem to, so I'm sharing global setup stuff here.
+ */
+struct SharedTestData
+{
+public:
+	Ice::CommunicatorPtr communicator;
+
+	/* A proxy to the management service */
+	ServiceDiscoveryManagementPrx management;
+
+	/* A proxy to the actual locate service */
+	ServiceDiscoveryPrx discovery;
+};
+static SharedTestData Testbed;
+
+/**
+ * A global fixture for Ice initialization.
+ * Provides setup/teardown for the entire set of tests.
+ */
+struct GlobalIceFixture
+{
+	GlobalIceFixture()
+	        {
+			BOOST_TEST_MESSAGE("Setting up ServiceDiscovery test fixture");
+
+			::boost::debug::detect_memory_leaks(false);
+			::boost::unit_test::unit_test_log.set_stream( std::cout );
+
+			int status = 0;
+			try
+				{
+					// Since creating multiple communicators, we have to parse command line args up front.
+					Ice::PropertiesPtr props = Ice::createProperties(mCachedArgs.argc, mCachedArgs.argv);
+					Ice::InitializationData initData;
+					initData.properties = props;
+
+					Testbed.communicator = Ice::initialize(initData);
+
+					Testbed.management = ServiceDiscoveryManagementPrx::checkedCast(Testbed.communicator->stringToProxy("DiscoveryServiceManagement:tcp -p 5674"));
+
+					if (!Testbed.management) {
+						throw "Invalid service discovery management proxy";
+					}
+
+					Testbed.discovery = ServiceDiscoveryPrx::checkedCast(Testbed.communicator->stringToProxy("DiscoveryService:tcp -p 2657"));
+
+					if (!Testbed.discovery) {
+						throw "Invalid service discovery proxy";
+					}
+				}
+			catch (const Ice::Exception& ex)
+				{
+					cerr << ex << endl;
+					status = 1;
+				}
+			catch (const char* msg)
+				{
+					cerr << msg << endl;
+					status = 1;
+				}
+
+		} // end Fixture() constructor
+
+	~GlobalIceFixture()
+	        {
+			BOOST_TEST_MESSAGE("Tearing down service discovery test fixture");
+
+
+			if (Testbed.communicator) {
+				Testbed.communicator->shutdown();
+				Testbed.communicator = 0;
+			}
+		}
+private:
+};
+
+BOOST_GLOBAL_FIXTURE(GlobalIceFixture);
+
+/**
  * Implement our own main to intercept the command line args.
  * (A default main() is provided if we hadn't set BOOST_TEST_NO_MAIN at the top of file.)
  * NOTE: Pass in --log_level=message to see the debug print statements.
@@ -29,10 +115,54 @@ int BOOST_TEST_CALL_DECL main( int argc, char* argv[] )
 }
 
 /**
- * Confirm that we find no service matching our parameters before we have added one.
+ * Confirm that we find no service using locate before we have added one.
  */
 BOOST_AUTO_TEST_CASE(ServiceNotFoundBeforeAdd)
 {
+	/* Assume the worst until proven otherwise */
+	bool found = true;
+
+	try {
+		/* Setup our parameters, for now we are simply using test as the category */
+		ServiceDiscoveryParamsPtr params = new ServiceDiscoveryParams;
+		params->category = "test";
+
+		/* Actually do the locate request */
+		Ice::ObjectPrx service = Testbed.discovery->locate(params);
+
+		/* If we get here we didn't get an exception back telling us no service found... which is wrong! */
+	} catch (const ServiceNotFound&) {
+		found = false;
+	} catch (const Ice::Exception &e) {
+		BOOST_TEST_MESSAGE(e.ice_name());
+		BOOST_TEST_MESSAGE(e.what());
+		found = false;
+	}
+
+	BOOST_CHECK(!found);
+}
+
+/**
+ * Confirm that we find no services using locateAll before we have added one.
+ */
+BOOST_AUTO_TEST_CASE(ServicesNotFoundBeforeAdd)
+{
+	bool found = true;
+
+	try {
+		ServiceDiscoveryParamsPtr params = new ServiceDiscoveryParams;
+		params->category = "test";
+
+		Ice::ObjectProxySeq services = Testbed.discovery->locateAll(params);
+	} catch (const ServiceNotFound&) {
+		found = false;
+	} catch (const Ice::Exception &e) {
+		BOOST_TEST_MESSAGE(e.ice_name());
+		BOOST_TEST_MESSAGE(e.what());
+		found = false;
+	}
+
+	BOOST_CHECK(!found);
 }
 
 /**
@@ -64,6 +194,13 @@ BOOST_AUTO_TEST_CASE(FindServiceWithoutCompareService)
 }
 
 /**
+ * Confirm that the service we got back is usable.
+ */
+BOOST_AUTO_TEST_CASE(UseServiceFoundWithoutCompareService)
+{
+}
+
+/**
  * Confirm that we can add a compare service.
  */
 BOOST_AUTO_TEST_CASE(AddCompare)
@@ -76,3 +213,94 @@ BOOST_AUTO_TEST_CASE(AddCompare)
 BOOST_AUTO_TEST_CASE(AddDuplicateCompare)
 {
 }
+
+/**
+ * Confirm that we can add discovery parameters with a compare service.
+ */
+BOOST_AUTO_TEST_CASE(AddDiscoveryParamsWithCompareService)
+{
+}
+
+/**
+ * Confirm that we can find a service after we add discovery params that use a compare service.
+ */
+BOOST_AUTO_TEST_CASE(FindServiceWithCompareService)
+{
+}
+
+/**
+ * Confirm that the service we got back is usable.
+ */
+BOOST_AUTO_TEST_CASE(UseServiceFoundWithCompareService)
+{
+}
+
+/**
+ * Confirm that we can suspend a service.
+ */
+BOOST_AUTO_TEST_CASE(ServiceSuspend)
+{
+}
+
+/**
+ * Confirm that we can't find a service while it is suspended.
+ */
+BOOST_AUTO_TEST_CASE(FindServiceAfterSuspend)
+{
+}
+
+/**
+ * Confirm that we can unsuspend a service.
+ */
+BOOST_AUTO_TEST_CASE(ServiceUnsuspend)
+{
+}
+
+/**
+ * Confirm that we can find a service after we unsuspend it.
+ */
+BOOST_AUTO_TEST_CASE(FindServiceAfterUnsuspend)
+{
+}
+
+/**
+ * Confirm that we can't remove a non-existent compare service.
+ */
+BOOST_AUTO_TEST_CASE(RemoveNonexistentCompareService)
+{
+}
+
+/**
+ * Confirm that we can remove a compare service.
+ */
+BOOST_AUTO_TEST_CASE(RemoveCompareService)
+{
+}
+
+/**
+ * Confirm that we can't remove a compare service a second time.
+ */
+BOOST_AUTO_TEST_CASE(RemoveAlreadyRemovedCompareService)
+{
+}
+
+/**
+ * Confirm that we can't find a service after its compare service is removed.
+ */
+BOOST_AUTO_TEST_CASE(FindServiceAfterCompareServiceRemoved)
+{
+}
+
+/**
+ * Confirm that we can unregister a service.
+ */
+BOOST_AUTO_TEST_CASE(ServiceUnregister)
+{
+}
+
+/**
+ * Confirm that we can't find a service after it is unregistered.
+ */
+BOOST_AUTO_TEST_CASE(FindServiceAfterUnregister)
+{
+}

commit 067ed3228e8fb1f7d2db029722bc0f117506e825
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Jul 22 10:28:07 2010 -0300

    Add test driver into the build system and start coming up with the list of tests.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 94936f5..381b628 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,4 +16,4 @@ add_subdirectory(slice)
 add_subdirectory(src)
 
 # Finally take care of the test suite
-#add_subdirectory(test)
+add_subdirectory(test)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..90dcb4d
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Create the actual standalone service locator test driver component
+hydra_component_init(service_locator_test CXX)
+hydra_component_add_slice(service_locator_test service_discovery)
+hydra_component_add_slice(service_locator_test service_discovery_events)
+hydra_component_add_file(service_locator_test TestServiceDiscovery.cpp)
+hydra_component_add_ice_libraries(service_locator_test IceStorm)
+hydra_component_add_boost_libraries(service_locator_test unit_test_framework)
+hydra_component_build_standalone(service_locator_test)
+hydra_component_install(service_locator_test RUNTIME bin "Service Locator Test Driver." Core)
diff --git a/test/TestServiceDiscovery.cpp b/test/TestServiceDiscovery.cpp
index e69de29..57d5305 100644
--- a/test/TestServiceDiscovery.cpp
+++ b/test/TestServiceDiscovery.cpp
@@ -0,0 +1,78 @@
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE ServiceDiscoveryTestSuite
+#define BOOST_TEST_NO_MAIN
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/debug.hpp>
+
+#include <Ice/Ice.h>
+
+// Cache the command line args so that Ice can be initialized.
+struct ArgCacheType
+{
+public:
+	int argc;
+	char **argv;
+};
+static ArgCacheType mCachedArgs;
+
+/**
+ * Implement our own main to intercept the command line args.
+ * (A default main() is provided if we hadn't set BOOST_TEST_NO_MAIN at the top of file.)
+ * NOTE: Pass in --log_level=message to see the debug print statements.
+ */
+int BOOST_TEST_CALL_DECL main( int argc, char* argv[] )
+{
+	mCachedArgs.argc = argc;
+	mCachedArgs.argv = argv;
+	return ::boost::unit_test::unit_test_main( &init_unit_test, argc, argv );
+}
+
+/**
+ * Confirm that we find no service matching our parameters before we have added one.
+ */
+BOOST_AUTO_TEST_CASE(ServiceNotFoundBeforeAdd)
+{
+}
+
+/**
+ * Confirm that we can add a service.
+ */
+BOOST_AUTO_TEST_CASE(AddService)
+{
+}
+
+/**
+ * Confirm that we can't find a service after we have added one but before we add parameters.
+ */
+BOOST_AUTO_TEST_CASE(ServiceNotFoundAfterAdd)
+{
+}
+
+/**
+ * Confirm that we can add discover parameters without a compare service.
+ */
+BOOST_AUTO_TEST_CASE(AddDiscoveryParamsWithoutCompareService)
+{
+}
+
+/**
+ * Confirm that we can find a service after we add discovery params that do not use a compare service.
+ */
+BOOST_AUTO_TEST_CASE(FindServiceWithoutCompareService)
+{
+}
+
+/**
+ * Confirm that we can add a compare service.
+ */
+BOOST_AUTO_TEST_CASE(AddCompare)
+{
+}
+
+/**
+ * Confirm that if we try to add a duplicate compare service we get an exception.
+ */
+BOOST_AUTO_TEST_CASE(AddDuplicateCompare)
+{
+}

commit c664c5d0984c5b7d2172f15454cc5303fed6f040
Author: Joshua Colp <jcolp at digium.com>
Date:   Wed Jul 21 14:29:43 2010 -0300

    Add some configuration files for the test driver to get things up and running and also add some log messages to provide some indication of the startup process.

diff --git a/config/test_icestorm.config b/config/test_icestorm.config
new file mode 100644
index 0000000..62aeb7f
--- /dev/null
+++ b/config/test_icestorm.config
@@ -0,0 +1,30 @@
+# This is a configuration file used in conjunction with the service discovery test driver
+
+IceBox.Service.IceStorm=IceStormService,34:createIceStorm --Ice.Config=../config/test_icestorm.config
+
+IceStorm.InstanceName=HydraIceStorm
+#
+# This property defines the endpoints on which the IceStorm
+# TopicManager listens.
+#
+IceStorm.TopicManager.Endpoints=default -p 10000
+
+#
+# This property defines the endpoints on which the topic
+# publisher objects listen. If you want to federate
+# IceStorm instances this must run on a fixed port (or use
+# IceGrid).
+#
+IceStorm.Publish.Endpoints=tcp -p 10001:udp -p 10001
+
+#
+# TopicManager Tracing
+#
+# 0 = no tracing
+# 1 = trace topic creation, subscription, unsubscription
+# 2 = like 1, but with more detailed subscription information
+#
+IceStorm.Trace.TopicManager=2
+
+#
+IceStorm.Flush.Timeout=2000
diff --git a/config/test_service_locator.config b/config/test_service_locator.config
new file mode 100644
index 0000000..42f6e5c
--- /dev/null
+++ b/config/test_service_locator.config
@@ -0,0 +1,10 @@
+# This is a configuration file used in conjunction with the service discovery test driver
+
+# Test endpoints for the service discovery management adapter
+ServiceDiscoveryManagementAdapter.Endpoints=tcp -p 5674
+
+# Test endpoints for the service discovery adapter
+ServiceDiscoveryAdapter.Endpoints=tcp -p 2657
+
+# Test endpoints for IceStorm
+TopicManager.Proxy=HydraIceStorm/TopicManager:default -p 10000
diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index a4f3d7c..dc45c1f 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -56,11 +56,13 @@ Ice::ObjectProxySeq ServiceDiscoveryImpl::locateAll(const ServiceDiscoveryParams
  */
 int ServiceLocatorApp::run(int argc, char* argv[])
 {
+	cout << "Initializing service discovery component" << endl;
+
 	/* Talk to the topic manager to either create or get the service discovery topic, configured or default */
 	IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(communicator()->propertyToProxy("TopicManager.Proxy"));
 
 	if (!topicManager) {
-		cerr << "Failed to get a proxy to the topic manager, pout ;(" << endl;
+		cerr << "Failed to get a proxy to the topic manager." << endl;
 		return 0;
 	}
 
@@ -83,6 +85,7 @@ int ServiceLocatorApp::run(int argc, char* argv[])
 			cerr << "Oh snap! Race condition creating topic, aborting" << endl;
 			return 0;
 		}
+		cout << "Created service discovery event topic" << endl;
 	}
 
 	EventsPrx service_discovery_topic = EventsPrx::uncheckedCast(topic->getPublisher());
@@ -98,6 +101,8 @@ int ServiceLocatorApp::run(int argc, char* argv[])
 
 	management_adapter->activate();
 
+	cout << "Activated service discovery management." << endl;
+
 	Ice::ObjectAdapterPtr discovery_adapter = communicator()->createObjectAdapter("ServiceDiscoveryAdapter");
 
 	ServiceDiscoveryPtr DiscoveryService = new ServiceDiscoveryImpl(DiscoveryServiceManagement);
@@ -106,6 +111,10 @@ int ServiceLocatorApp::run(int argc, char* argv[])
 
 	discovery_adapter->activate();
 
+	cout << "Activated service discovery." << endl;
+
+	cout << "Waiting for requests." << endl;
+
 	/* Now that management and discovery are active we just sit here waiting until we shutdown */
 	communicator()->waitForShutdown();
 

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


-- 
hydra/servicediscovery.git




More information about the asterisk-scf-commits mailing list