[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu Aug 19 16:02:15 CDT 2010
branch "master" has been updated
via dc0f3c3372fcfaf9e01697c10c1f81d8d33ff96b (commit)
from d19dcc898d7fe4e5e96d667c1940e2bf98a46053 (commit)
Summary of changes:
bin/install_debug.bat | 12 ++++++++
config/basicrouting.config | 10 +++---
config/routingtest.config | 11 +++++++
src/BasicRoutingServiceApp.cpp | 24 ++++++++++++----
src/RoutingServiceEventPublisher.cpp | 22 ++++++++++----
test/TestRouting.cpp | 52 +++++++++++++++++++++++-----------
6 files changed, 97 insertions(+), 34 deletions(-)
create mode 100644 bin/install_debug.bat
create mode 100644 config/routingtest.config
- Log -----------------------------------------------------------------
commit dc0f3c3372fcfaf9e01697c10c1f81d8d33ff96b
Author: Ken Hunt <ken.hunt at digium.com>
Date: Thu Aug 19 15:58:47 2010 -0500
Initial test running.
diff --git a/bin/install_debug.bat b/bin/install_debug.bat
new file mode 100644
index 0000000..5e26ea9
--- /dev/null
+++ b/bin/install_debug.bat
@@ -0,0 +1,12 @@
+copy /Y /B ..\build\src\Debug\BasicRoutingService.exe .
+copy /Y /B ..\build\slice\Core\Discovery\Debug\ServiceLocatorIf_CXXd.dll .
+copy /Y /B ..\build\slice\Core\Endpoint\Debug\EndpointIf_CXXd.dll .
+copy /Y /B ..\build\slice\Core\Routing\Debug\RoutingIf_CXXd.dll .
+copy /Y /B ..\build\slice\Core\Bridging\Debug\BridgeServiceIf_CXXd.dll .
+copy /Y /B ..\build\slice\Core\Bridging\Debug\BridgeServiceIf_CXXd.dll .
+copy /Y /B ..\build\slice\System\Component\Debug\ComponentServiceIf_CXXd.dll .
+copy /Y /B ..\build\test\Debug\RoutingTest.exe .
+copy /Y /B ..\scripts\routing.lua .
+copy /Y /B ..\config\basicrouting.config .
+copy /Y /B ..\config\icestorm.config .
+copy /Y /B ..\config\routingtest.config .
diff --git a/config/basicrouting.config b/config/basicrouting.config
index 46074bc..a042664 100644
--- a/config/basicrouting.config
+++ b/config/basicrouting.config
@@ -1,11 +1,11 @@
# This is a configuration file for the Basic Routing Service
-# Basic routing service
-BasicRoutingServiceAdapter.Endpoints=tcp -p 10054
+# Endpoints for the adapter
+BasicRoutingServiceAdapter.Endpoints=tcp -p 10050
-# Basic routing service admin
-BasicRoutingServiceAdminAdapter.Endpoints=tcp -p 10055
+# Where to find the Service Locator. We need the Service Locator in order to be able to plug in to the Asterisk SCF system Discovery mechanisms.
+LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 10078
# Endpoints for Icestorm events
-TopicManager.Proxy=HydraIceStorm/TopicManager:default -p 10012
+TopicManager.Proxy=IceStorm/TopicManager:default -p 10012
diff --git a/config/routingtest.config b/config/routingtest.config
new file mode 100644
index 0000000..9b27cbd
--- /dev/null
+++ b/config/routingtest.config
@@ -0,0 +1,11 @@
+# This is a configuration file for the Routing Service Test driver.
+
+# Test adapter
+TestRoutingAdapter=tcp -p 10070
+
+# Where to look for the Routing Service LocatorRegistry interface
+LocatorRegistry.Proxy=RoutingServiceLocatorRegistry:tcp -p 10050
+
+# Endpoints for Icestorm events
+TopicManager.Proxy=IceStorm/TopicManager:default -p 10012
+
diff --git a/src/BasicRoutingServiceApp.cpp b/src/BasicRoutingServiceApp.cpp
index f2158f9..ead2f8e 100644
--- a/src/BasicRoutingServiceApp.cpp
+++ b/src/BasicRoutingServiceApp.cpp
@@ -114,9 +114,9 @@ private:
ComponentServicePtr mComponentService;
};
-static const string RegistryLocatorObjectId("RoutingServiceRegistryLocator");
+static const string RegistryLocatorObjectId("RoutingServiceLocatorRegistry");
static const string RoutingAdminObjectId("RoutingAdmin");
-static const string ComponentServiceId("BasicRoutingService");
+static const string ComponentServiceId("BasicRoutingComponent");
/**
* This class provides implementation for the ComponentService interface.
@@ -178,26 +178,38 @@ void BasicRoutingServiceApp::registerWithServiceLocator()
try
{
// Get a proxy to the management interface for the Service Locator, so we can add ourselves into the system discovery mechanisms.
- mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(communicator()->propertyToProxy("ServiceLocatorManagementProxy"));
+ mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(communicator()->propertyToProxy("LocatorServiceManagement.Proxy"));
+
+ if (mServiceLocatorManagement == 0)
+ {
+ cout << "Unable to obtain proxy to ServiceLocatorManagement interface. Check config file. This component can't be found until this is corrected." << endl;
+ return;
+ }
// Get a proxy to our RoutingAdmin interface and add it to the Service Locator.
Ice::ObjectPrx adminObjectPrx = mAdapter->createDirectProxy(communicator()->stringToIdentity(RoutingAdminObjectId));
RoutingServiceAdminPrx adminPrx = RoutingServiceAdminPrx::checkedCast(adminObjectPrx);
- mAdminManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(adminPrx, "BasicRoutingServiceAdmin"));
+ // The GUID passed in to add service needs to be unique for reporting.
+ string adminServiceGuid("BasicRoutingServiceAdmin");
+ mAdminManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(adminPrx, adminServiceGuid));
setCategory(mAdminManagement, Routing::V1::RoutingServiceAdminDiscoveryCategory);
// Get a proxy to our RegistryLocator interface and add it to the Service Locator.
Ice::ObjectPrx locatorObjectPrx = mAdapter->createDirectProxy(communicator()->stringToIdentity(RegistryLocatorObjectId));
LocatorRegistryPrx locatorRegistryPrx = LocatorRegistryPrx::checkedCast(locatorObjectPrx);
- mRegistryLocatorManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(locatorRegistryPrx, "BasicRoutingServiceRegistryLocator"));
+ // The GUID passed in to add service needs to be unique for reporting.
+ string locatorServiceGuid("BasicRoutingServiceRegistryLocator");
+ mRegistryLocatorManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(locatorRegistryPrx, locatorServiceGuid));
setCategory(mRegistryLocatorManagement, Routing::V1::RoutingServiceLocatorRegistryDiscoveryCategory);
// Get a proxy to our ComponentService interface and add it to the Service Locator.
Ice::ObjectPrx componentServiceObjectPrx = mAdapter->createDirectProxy(communicator()->stringToIdentity(ComponentServiceId));
ComponentServicePrx componentServicePrx = ComponentServicePrx::checkedCast(componentServiceObjectPrx);
- mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(componentServicePrx, "BasicRoutingService"));
+ // The GUID passed in to add service needs to be unique for reporting.
+ string componentServiceGuid("BasicRoutingService");
+ mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(componentServicePrx, componentServiceGuid));
setCategory(mRegistryLocatorManagement, Routing::V1::ComponentServiceDiscoveryCategory);
}
diff --git a/src/RoutingServiceEventPublisher.cpp b/src/RoutingServiceEventPublisher.cpp
index 8b7a059..4eeb91f 100644
--- a/src/RoutingServiceEventPublisher.cpp
+++ b/src/RoutingServiceEventPublisher.cpp
@@ -29,17 +29,26 @@ public:
void initialize()
{
const Ice::CommunicatorPtr& communicator = BasicRoutingServiceDataModel::getInstance().getCommunicator();
+ IceStorm::TopicManagerPrx topicManager(0);
- IceStorm::TopicManagerPrx topicManager =
- IceStorm::TopicManagerPrx::checkedCast(communicator->propertyToProxy("TopicManager.Proxy"));
+ try
+ {
+ topicManager = IceStorm::TopicManagerPrx::checkedCast(communicator->propertyToProxy("TopicManager.Proxy"));
+
+ if(!topicManager)
+ {
+ cerr << "Invalid proxy to IceStorm. Missing config for TopicManager.Proxy?" << endl;
+ return;
+ }
- if(!topicManager)
+ cout << "RoutingServiceEventPublisher::initialize(): Got IceStorm proxy: TopicManager.Proxy" << endl;
+ }
+ catch(const IceUtil::Exception&)
{
- cerr << "Invalid proxy to IceStorm. Missing config for TopicManager.Proxy?" << endl;
+ cout << "Can't get IceStorm TopicManager. Check config, and make sure IceStorm is running." << endl;
+ return;
}
- cout << "RoutingServiceEventPublisher::initialize(): Got IceStorm proxy: TopicManager.Proxy" << endl;
-
IceStorm::TopicPrx topic;
try
{
@@ -54,6 +63,7 @@ public:
catch(const IceStorm::TopicExists&)
{
cerr << "Possible race condition creating IceStorm topic " << Event::TopicId << ". Suggest Restart!" << endl;
+ return;
}
}
diff --git a/test/TestRouting.cpp b/test/TestRouting.cpp
index dafa158..4a23243 100644
--- a/test/TestRouting.cpp
+++ b/test/TestRouting.cpp
@@ -80,6 +80,8 @@ public:
};
static SharedTestData Testbed;
+const string LocatorObjectId("TestLocator");
+
/**
* A global fixture for Ice initialization.
* Provides setup/teardown for the entire set of tests.
@@ -96,35 +98,38 @@ struct GlobalIceFixture
int status = 0;
try
{
- Testbed.communicator_incoming = Ice::initialize(mCachedArgs.argc, mCachedArgs.argv);
+ // Testbed.communicator_incoming = Ice::initialize(mCachedArgs.argc, mCachedArgs.argv);
+ Ice::PropertiesPtr props = Ice::createProperties(mCachedArgs.argc, mCachedArgs.argv);
+ Ice::InitializationData initData;
+ initData.properties = props;
+ Testbed.communicator_incoming = Ice::initialize(initData);
+
+ string test = props->getProperty("LocatorRegistry.Proxy");
+
+ Testbed.adapter = Testbed.communicator_incoming->createObjectAdapterWithEndpoints("TestRoutingAdapter", "default -p 10070");
- //Ice::ObjectFactoryPtr baseEndpointFactory = new BaseEndpointFactory();
- //Testbed.communicator_incoming->addObjectFactory(baseEndpointFactory, Hydra::Core::Endpoint::V1::BaseEndpoint::ice_staticId());
-
// Serve up our own EndpointLocator, since we're emulating a channel.
TestEndpointLocatorImpl *locator = new TestEndpointLocatorImpl();
Testbed.mEndpointLocator = locator;
- Testbed.adapter->add(Testbed.mEndpointLocator, Testbed.communicator_incoming->stringToIdentity("Locator"));
+ Testbed.adapter->add(Testbed.mEndpointLocator, Testbed.communicator_incoming->stringToIdentity(LocatorObjectId));
-
- // Get ref to Routing Service so we can test it. Getting direct for now, but
- // need to test acquiring reference via ServiceLocator as well.
- Ice::ObjectPrx base = Testbed.communicator_incoming->stringToProxy("RoutingServiceLocatorRegistry:default -p 10047");
- LocatorRegistryPrx server = LocatorRegistryPrx::checkedCast(base);
-
- Testbed.adapter = Testbed.communicator_incoming->createObjectAdapterWithEndpoints("RoutingServiceAdapter", "default");
Testbed.adapter->activate();
// Now that the adapter has been activated, get a local proxy to our EndpointLocator.
- Ice::ObjectPrx locatorObjectPrx = Testbed.adapter->createDirectProxy(Testbed.communicator_incoming->stringToIdentity("Locator"));
+ Ice::ObjectPrx locatorObjectPrx = Testbed.adapter->createDirectProxy(Testbed.communicator_incoming->stringToIdentity(LocatorObjectId));
Testbed.mEndpointLocatorPrx = EndpointLocatorPrx::checkedCast(locatorObjectPrx);
- PopulateEndpoints();
+ // Get ref to Routing Service so we can test it. Getting direct for now, but
+ // need to test acquiring reference via ServiceLocator as well.
+ Ice::ObjectPrx base = Testbed.communicator_incoming->propertyToProxy("LocatorRegistry.Proxy");
+ Testbed.locatorRegistry = LocatorRegistryPrx::checkedCast(base);
if (!Testbed.locatorRegistry)
{
throw "Invalid service proxy";
}
+
+ PopulateEndpoints();
}
catch (const Ice::Exception& ex)
{
@@ -176,7 +181,7 @@ struct GlobalIceFixture
}
}
private:
-
+ int mGlob;
};
BOOST_GLOBAL_FIXTURE(GlobalIceFixture);
@@ -194,10 +199,11 @@ int BOOST_TEST_CALL_DECL main( int argc, char* argv[] )
}
/**
- * Confirm that we find no service using locate before we have added one.
+ * Test adding and removing a locator with the routing service's Locator Registry.
*/
-BOOST_AUTO_TEST_CASE(MyFirstTest)
+BOOST_AUTO_TEST_CASE(AddAndRemoveEndpointLocator)
{
+ // T
bool succeeded(true);
try
{
@@ -206,7 +212,19 @@ BOOST_AUTO_TEST_CASE(MyFirstTest)
catch (...)
{
succeeded = false;
+ BOOST_TEST_MESSAGE("Exception adding EndpointLocator.");
}
BOOST_CHECK(succeeded);
+
+ try
+ {
+ Testbed.locatorRegistry->removeEndpointLocator("TestChannel");
+
+ }
+ catch (...)
+ {
+ succeeded = false;
+ BOOST_TEST_MESSAGE("Exception removing EndpointLocator.");
+ }
}
-----------------------------------------------------------------------
--
asterisk-scf/integration/routing.git
More information about the asterisk-scf-commits
mailing list