[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
Fri Oct 8 17:42:48 CDT 2010


branch "master" has been updated
       via  d1a4a491e1f6d4df22f7d93add6dd47cb3f5c8f1 (commit)
      from  7e2d06d24727f35f9f92d81278209d10c09c935d (commit)

Summary of changes:
 config/README.txt               |   18 +++++--
 config/basicrouting.config      |    4 +-
 config/routingtest-integ.config |   97 +++++++++++++++++++++++++++++++++++++++
 config/routingtest.config       |    5 ++
 config/service_locator.config   |   14 ------
 test/CMakeLists.txt             |    4 +-
 test/MockSession.h              |    1 +
 test/MockSessionEndpoint.cpp    |    2 +-
 test/TestRouting.cpp            |   80 +++++++++++++++++++++++--------
 9 files changed, 179 insertions(+), 46 deletions(-)
 create mode 100644 config/routingtest-integ.config
 delete mode 100644 config/service_locator.config


- Log -----------------------------------------------------------------
commit d1a4a491e1f6d4df22f7d93add6dd47cb3f5c8f1
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Fri Oct 8 17:42:30 2010 -0500

    Migrated the test to icebox service.

diff --git a/config/README.txt b/config/README.txt
index 9433895..e9d1733 100644
--- a/config/README.txt
+++ b/config/README.txt
@@ -1,14 +1,20 @@
 
+To run the routing service with other Asterisk SCF components:
 
-Run Order for testing:
+   iceboxd  --Ice.Config=basicrouting.config
 
-  iceboxd --Ice.Config=icestorm.config
- 
-  service_locator --Ice.Config=service_locator.config
+To run the Routing Service tests as mulitple processes:
 
-  BasicRoutingService --Ice.Config=basicrouting.config
+  iceboxd --Ice.Config=test_service_locator.config
 
-  RoutingTest --Ice.Config=routingtest.config
+  iceboxd  --Ice.Config=basicrouting.config
+
+  iceboxd  --Ice.Config=routingtest.config
+
+
+To run the Routing Service tests in a single process:
+
+   iceboxd --Ice.Config=routingtest-integ.config
 
 
 
diff --git a/config/basicrouting.config b/config/basicrouting.config
index ae9cc08..a2eb94d 100644
--- a/config/basicrouting.config
+++ b/config/basicrouting.config
@@ -1,6 +1,8 @@
 # This is a configuration file for the Basic Routing Service
 
-IceBox.Service.BasicRoutingService=BasicRoutingService:create --Ice.Config=config/basicrouting.config
+IceBox.Service.BasicRoutingService=BasicRoutingService:create 
+
+IceBox.InheritProperties=1 
 
 BasicRoutingServiceAdapter.Endpoints=tcp -p 10050
 
diff --git a/config/routingtest-integ.config b/config/routingtest-integ.config
new file mode 100644
index 0000000..140434f
--- /dev/null
+++ b/config/routingtest-integ.config
@@ -0,0 +1,97 @@
+# This is a configuration file a single process test of the Routing Service.
+
+IceBox.InheritProperties=1 
+
+
+IceBox.Service.ServiceDiscovery=service_locator:create
+IceBox.Service.BasicRoutingService=BasicRoutingService:create 
+
+# Boost Test arguments can be passed here. 
+# IceBox.Service.RoutingTest = RoutingTest:create --log_level=all
+IceBox.Service.RoutingTest = RoutingTest:create 
+
+IceBox.LoadOrder=ServiceDiscovery,BasicRoutingService,RoutingTest
+
+# Where to find the Service Locator manager. 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 4422
+
+# Where to find the Service Locator.
+LocatorService.Proxy=LocatorService:tcp -p 4411
+
+# Test endpoints for IceStorm
+TopicManager.Proxy=HydraIceStorm/TopicManager:default -p 10000
+
+# Category for the bridge service
+BridgeManager.ServiceLocatorId=BridgeService
+
+###########################################
+# Routing Service properties
+
+BasicRoutingServiceAdapter.Endpoints=tcp -p 10050
+
+BasicRoutingServiceAdapter.ThreadPool.Size=4
+BasicRoutingServiceAdapter.ThreadPool.SizeMax=10
+BasicRoutingServiceAdapter.ThreadPool.SizeWarn=9
+
+
+###########################################
+# Test properties
+
+# Test adapter
+TestRoutingAdapterOut.Endpoints=tcp -p 10070
+TestRoutingAdapterIn.Endpoints=tcp -p 10071
+
+# Where to look for the Routing Service LocatorRegistry interface
+LocatorRegistry.Proxy=RoutingServiceLocatorRegistry:tcp -p 10050
+
+SessionRouter.Proxy=SessionRouter:tcp -p 10050
+
+TestRoutingAdapterIn.ThreadPool.Size=4
+TestRoutingAdapterIn.ThreadPool.SizeMax=10
+TestRoutingAdapterIn.ThreadPool.SizeWarn=9
+
+TestRoutingAdapterOut.ThreadPool.Size=4
+TestRoutingAdapterOut.ThreadPool.SizeMax=10
+TestRoutingAdapterOut.ThreadPool.SizeWarn=9
+
+##########################################
+# Service Locator properties
+
+HydraIceStorm.InstanceName=HydraIceStorm
+#
+# This property defines the endpoints on which the IceStorm
+# TopicManager listens.
+#
+HydraIceStorm.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).
+#
+HydraIceStorm.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
+#
+HydraIceStorm.Trace.TopicManager=2
+HydraIceStorm.Transient=1
+
+#
+HydraIceStorm.Flush.Timeout=2000
+# This is a configuration file used in conjunction with the service locator test driver
+
+# Test endpoints for the service locator management adapter
+ServiceLocatorManagementAdapter.Endpoints=tcp -p 4422
+
+# Test endpoints for the service locator adapter
+ServiceLocatorAdapter.Endpoints=tcp -p 4411
+
+
+# Logger configuration
+LoggerAdapter.Endpoints=default
diff --git a/config/routingtest.config b/config/routingtest.config
index 9d32be7..7dd703d 100644
--- a/config/routingtest.config
+++ b/config/routingtest.config
@@ -1,5 +1,10 @@
 # This is a configuration file for the Routing Service Test driver.
 
+
+IceBox.Service.RoutingTest = RoutingTest:create --log_level=all
+
+IceBox.InheritProperties=1 
+
 # Test adapter
 TestRoutingAdapterOut.Endpoints=tcp -p 10070
 TestRoutingAdapterIn.Endpoints=tcp -p 10071
diff --git a/config/service_locator.config b/config/service_locator.config
deleted file mode 100644
index 6e04832..0000000
--- a/config/service_locator.config
+++ /dev/null
@@ -1,14 +0,0 @@
-# This is a configuration file used in conjunction with the service locator test driver
-
-# Test endpoints for the service locator management adapter
-ServiceLocatorManagementAdapter.Endpoints=tcp -p 4422
-
-ServiceLocatorManagementAdapter.ThreadPool.Size=4
-ServiceLocatorManagementAdapter.ThreadPool.SizeMax=10
-ServiceLocatorManagementAdapter.ThreadPool.SizeWarn=9
-
-# Test endpoints for the service locator adapter
-ServiceLocatorAdapter.Endpoints=tcp -p 4411
-
-# Test endpoints for IceStorm
-TopicManager.Proxy=IceStorm/TopicManager:default -p 10000
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 658f5e5..73f93e1 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -20,7 +20,5 @@ hydra_component_add_file(RoutingTest MockEndpointLocator.cpp)
 
 hydra_component_add_ice_libraries(RoutingTest IceStorm)
 hydra_component_add_boost_libraries(RoutingTest unit_test_framework)
-hydra_component_build_standalone(RoutingTest)
+hydra_component_build_icebox(RoutingTest)
 hydra_component_install(RoutingTest RUNTIME bin "Routing Service Test Driver." Test)
-
-boost_add_test(RoutingTest)
diff --git a/test/MockSession.h b/test/MockSession.h
index 7a42d68..d3baf08 100644
--- a/test/MockSession.h
+++ b/test/MockSession.h
@@ -42,6 +42,7 @@ public:
 
 public:
    void setProxy(AsteriskSCF::SessionCommunications::V1::SessionPrx sessionPrx);
+   const std::string& getId() const {return mId;}
 
 private:
    std::string mId;
diff --git a/test/MockSessionEndpoint.cpp b/test/MockSessionEndpoint.cpp
index eb42704..cf9da15 100644
--- a/test/MockSessionEndpoint.cpp
+++ b/test/MockSessionEndpoint.cpp
@@ -55,7 +55,7 @@ void MockSessionEndpoint::perTestCleanup()
    vector<MockSessionPtr>::iterator i;
    for(i = mSessions.begin(); i != mSessions.end(); ++i)
    {
-      string id = (*i)->ice_id();
+      string id = (*i)->getId();
       SharedTestData::instance.adapter_in->remove(SharedTestData::instance.communicator_in->stringToIdentity(id));
    }
 
diff --git a/test/TestRouting.cpp b/test/TestRouting.cpp
index bdea0b3..d866b0a 100644
--- a/test/TestRouting.cpp
+++ b/test/TestRouting.cpp
@@ -13,6 +13,7 @@
 #include <boost/test/debug.hpp>
 
 #include <Ice/Ice.h>
+#include <IceBox/IceBox.h>
 
 #include "SharedTestData.h"
 #include "MockBridge.h"
@@ -33,20 +34,69 @@ using namespace AsteriskSCF::SessionCommunications::Bridging::V1;
 using namespace AsteriskSCF::Core::Discovery::V1;
 using namespace AsteriskSCF::RoutingTest;
 
-/**
- * Instantiate our shared data.
- */
-SharedTestData SharedTestData::instance;
-
 /* Cache the command line arguments so that Ice can be initialized within the global fixture. */
 struct ArgCacheType
 {
 public:
 	int argc;
 	char **argv;
+   Ice::PropertiesPtr inheritedProps;
 };
 static ArgCacheType mCachedArgs;
 
+/**
+ * Test service, for loading into icebox
+ */
+class RoutingServiceTest : public IceBox::Service
+{
+public:
+   void start(const std::string&,
+              const Ice::CommunicatorPtr&,
+              const Ice::StringSeq&);
+   void stop();
+};
+
+void RoutingServiceTest::start(std::string const &name,
+                               Ice::CommunicatorPtr const &communicator,
+                               Ice::StringSeq const &args)
+{
+   std::vector<char const *> argv;
+   argv.push_back(name.c_str());
+   for (Ice::StringSeq::const_iterator i = args.begin();
+        i != args.end();
+        ++i)
+   {
+      argv.push_back(i->c_str());
+   }
+   // null terminated list
+   argv.push_back(0);
+
+   mCachedArgs.argc = argv.size() - 1;
+   mCachedArgs.argv = (char**)&argv[0];
+   mCachedArgs.inheritedProps = communicator->getProperties();
+
+   int r = ::boost::unit_test::unit_test_main(&init_unit_test, mCachedArgs.argc, mCachedArgs.argv);
+   exit(r);
+}
+
+void RoutingServiceTest::stop()
+{
+}
+
+extern "C"
+{
+   HYDRA_ICEBOX_EXPORT IceBox::Service* create(Ice::CommunicatorPtr communicator)
+   {
+      return new RoutingServiceTest;
+   }
+}
+
+/**
+ * Instantiate our shared data.
+ */
+SharedTestData SharedTestData::instance;
+
+
 const string LocatorObjectId("TestLocator");
 
 /**
@@ -65,15 +115,13 @@ struct GlobalIceFixture
       int status = 0;
       try
       {
-         Ice::PropertiesPtr props = Ice::createProperties(mCachedArgs.argc, mCachedArgs.argv);
          Ice::InitializationData initData;
-         initData.properties = props;
+         initData.properties = mCachedArgs.inheritedProps;
 
          // Set up incoming adapter. This is where we'll publish our proxies.
          SharedTestData::instance.communicator_in = Ice::initialize(initData);
 
-         string test = props->getProperty("LocatorRegistry.Proxy");
-
+         Ice::PropertiesPtr props = SharedTestData::instance.communicator_in->getProperties();
 	      SharedTestData::instance.adapter_in = SharedTestData::instance.communicator_in->createObjectAdapterWithEndpoints("TestRoutingAdapterIn", "default -p 10070");
 
          // Serve up our own EndpointLocator, since we're emulating a channel. 
@@ -94,6 +142,8 @@ struct GlobalIceFixture
 
          // 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::PropertiesPtr communicatorProps = SharedTestData::instance.communicator_out->getProperties(); 
+         string locatorProp = communicatorProps->getProperty("LocatorRegistry.Proxy");
          Ice::ObjectPrx locatorObj = SharedTestData::instance.communicator_out->propertyToProxy("LocatorRegistry.Proxy");
          SharedTestData::instance.locatorRegistry = LocatorRegistryPrx::checkedCast(locatorObj);
 
@@ -188,18 +238,6 @@ 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.
- */
-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 );
-}
-
 struct PerTestFixture
 {
 public: 

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


-- 
asterisk-scf/integration/routing.git



More information about the asterisk-scf-commits mailing list