[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "async-bridging" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Apr 7 07:38:53 CDT 2011


branch "async-bridging" has been updated
       via  361ce43d6710e456042c5c48f51bd5d594595141 (commit)
      from  e82d5aaaecfa0571d3af66ae59ba4cbc0e485ee6 (commit)

Summary of changes:
 config/test_bridging.conf.in    |   47 ++++-------
 src/BridgeReplicatorService.cpp |   26 +++++-
 src/CMakeLists.txt              |    1 +
 src/Service.cpp                 |   87 +++++++++++++++-----
 src/ServiceUtil.h               |   11 +--
 test/CMakeLists.txt             |    2 -
 test/TestBridging.cpp           |  176 ++++++++++++++++++++++++++-------------
 7 files changed, 228 insertions(+), 122 deletions(-)


- Log -----------------------------------------------------------------
commit 361ce43d6710e456042c5c48f51bd5d594595141
Author: Brent Eagles <beagles at digium.com>
Date:   Thu Apr 7 10:03:23 2011 -0230

    Modifications to make bridging behave a bit more like a proper discoverable
    service should.
    
    * The object adapters for both the replicator and the bridge service no longer
      "require" external configuration. They set default thread pool size and endpoints
      ("default" with no ports etc.)
    * Modified configuration file to remove proxies and endpoint configurations for
      all except the 'bootstrapping' services, and changed the configuration of those
      bootstrapping services to be consistent with other configuration files.
    * Modified the test suite to use discovery instead of proxy properties.
    * Modified registry/location queries to use ServiceLocatorParams instead of strings
      to allow different param types to be used.
    * Add missing file to CMakeLists.txt.

diff --git a/config/test_bridging.conf.in b/config/test_bridging.conf.in
index 47fd93f..37d7b8c 100644
--- a/config/test_bridging.conf.in
+++ b/config/test_bridging.conf.in
@@ -14,6 +14,13 @@ Ice.Default.CollocationOptimized=0
 #
 IceBox.InheritProperties=1
 
+#
+# It's important to specify a reasonable size for the client thread pool for services
+# that use AMI/AMD
+# 
+Ice.ThreadPool.Client.Size=4
+
+
 ################################################################################
 # The following configuration is required for the the Service Locator component
 # because it loads a collocated instance of IceStorm.
@@ -76,15 +83,6 @@ AsteriskSCF.LoggingService.ThreadPool.Size=4
 AsteriskSCF.LoggingClient.Endpoints=default
 AsteriskSCF.LoggingClient.ThreadPool.Size=4
 
-#
-# The bridging service uses the test channel`s Endpoint
-# to create test sessions and register them with the bridge.
-# NOTE: this will be changed to be accessible through
-# service discovery in a later branch.
-#
-AsteriskSCF.TestChannelService.Endpoints=default -p 55560
-AsteriskSCF.TestChannelService.ThreadPool.Size=4
-TestChannel.Proxy=TestChannel:default -p 55560
 
 #
 # Service Locator configuration. Usually the service locator
@@ -119,24 +117,24 @@ IceBox.Service.TestChannel=${test_channel_bindir}/src at test_channel:create
 IceBox.Service.TestDriver=../test at bridge_component_test:create
 
 #
+# The bridging service uses the test channel`s Endpoint
+# to create test sessions and register them with the bridge.
+# NOTE: this will be changed to be accessible through
+# service discovery in a later branch.
+#
+TestChannel.InstanceName=BridgeTest
+
+#
 # Configuration for the test bridge instances. There are are two: one master
 # (TestBridge) and one standby (TestBridge2).
 # NOTE: These will be changed to be accessible through
 # service discovery in a later branch.
 #
 TestBridge.InstanceName=TestBridge
-TestBridge.BridgeService.Endpoints=default -p 55561
-TestBridge.BridgeService.ThreadPool.Size=4
-TestBridge.Proxy=BridgeManager:default -p 55561
-TestBridge.BridgeServiceInternal.Endpoints=default -p 65461
-TestBridge.BridgeServiceInternal.ThreadPool.Size=4
+TestBridge.ManagerId=TestBridgeManager
 
 TestBridge2.InstanceName=TestBridge2
-TestBridge2.BridgeService.Endpoints=default -p 55572
-TestBridge2.BridgeService.ThreadPool.Size=4
-TestBridge2.Proxy=BridgeManager:default -p 55572
-TestBridge2.BridgeServiceInternal.Endpoints=default -p 65462
-TestBridge2.BridgeServiceInternal.ThreadPool.Size=4
+TestBridge2.ManagerId=TestBridgeManager2
 TestBridge2.StateReplicatorListener=yes
 
 #
@@ -146,17 +144,6 @@ TestBridge2.StateReplicatorListener=yes
 # or specify the proxy in the future)
 # 
 Replicator.InstanceName=Replicator
-Replicator.BridgeReplicator.Endpoints=default -p 63242
-Replicator.Proxy=BridgeReplicator:default -p 63242
-Replicator.BridgeReplicator.ThreadPool.Size=4
-
-#
-# Configure the test's internal object adapter.
-# NOTE: This will not be required in the future.
-#
-TestUtilAdapter.Endpoints=default
-TestUtilAdapter.ThreadPool.Size=4
-Commands.Proxy=TestChannel.Locator.Commands:default -p 55560
 
 #
 # Some IceBox configuration.
diff --git a/src/BridgeReplicatorService.cpp b/src/BridgeReplicatorService.cpp
index 5f40668..06a5394 100644
--- a/src/BridgeReplicatorService.cpp
+++ b/src/BridgeReplicatorService.cpp
@@ -85,11 +85,29 @@ void BridgeReplicatorApp::start(const string& name, const Ice::CommunicatorPtr&
     }
 
     //
+    // Check on the threadpool properties, make sure that they are compatible with the requirements of this 
+    // service. This could be moved into a helper method, but it is somehow more clear for seeing what
+    // is going on during initialization to leave it here.
+    //
+    // TODO: Are there any other properties that need to be double-checked before proceeding?
+    //
+    Ice::Int defaultPoolSize = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.ThreadPool.Server.Size", 0);
+    if (communicator->getProperties()->getPropertyAsIntWithDefault(adapterName + ".ThreadPool.Size", 0) < 4)
+    {
+        if (defaultPoolSize < 4)
+        {
+            logger(Info) << "Configured thread pool size for " << adapterName + " is too small, defaulting to 4";
+            communicator->getProperties()->setProperty(adapterName + ".ThreadPool.Size", "4");
+        }
+    }
+
+    //
     // TODO: All adapter ids should be globally unique. This would allow replicas to be identified.
     // How this might be useful is that it might be used as a replicated state item to identify
     // which adapter is currently the primary in a group of replicas.
     //
-    mAdapter = communicator->createObjectAdapter(adapterName);
+    mAdapter = communicator->createObjectAdapterWithEndpoints(adapterName,
+        communicator->getProperties()->getPropertyWithDefault(adapterName + ".Endpoints", "default"));
 
     //
     // Configure the AsteriskSCF logger.
@@ -99,7 +117,6 @@ void BridgeReplicatorApp::start(const string& name, const Ice::CommunicatorPtr&
     getLoggerFactory().setLogOutput(iceLogger->getLogger());
 
 
-
     string property = communicator->getProperties()->getProperty("ServiceLocatorManagementProxy");
     if(property.size() == 0)
     {
@@ -124,8 +141,11 @@ void BridgeReplicatorApp::start(const string& name, const Ice::CommunicatorPtr&
     bool registered = false;
     try
     {
+        BridgeStateReplicatorParamsPtr locatorParameters = new BridgeStateReplicatorParams;
+        locatorParameters->category = StateReplicatorDiscoveryCategory;
+        locatorParameters->name = communicator->getProperties()->getPropertyWithDefault(name + ".ReplicatorName", "default");
         mLocator = new LocatorRegistrationWrapper<ReplicatorPrx>(communicator, property, replicatorPrx, adapterName, 
-          StateReplicatorDiscoveryCategory);
+          locatorParameters);
         registered = mLocator->registerService();
     }
     catch(const Ice::Exception&)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1c0397a..8275f0f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -26,6 +26,7 @@ asterisk_scf_component_add_file(bridgeservice MediaSplicer.h)
 asterisk_scf_component_add_file(bridgeservice MediaSplicer.cpp)
 asterisk_scf_component_add_file(bridgeservice Tasks.h)
 asterisk_scf_component_add_file(bridgeservice InternalExceptions.h)
+asterisk_scf_component_add_file(bridgeservice BridgeServiceConfig.h)
 asterisk_scf_component_add_file(bridgeservice ListenerManager.h)
 asterisk_scf_component_add_slice(bridgeservice ./BridgeReplicatorIf.ice)
 
diff --git a/src/Service.cpp b/src/Service.cpp
index 42fd326..aa56ab8 100644
--- a/src/Service.cpp
+++ b/src/Service.cpp
@@ -138,12 +138,51 @@ void BridgingApp::start(const std::string& name, const Ice::CommunicatorPtr& com
     }
 
     //
+    // Check on the threadpool properties, make sure that they are compatible with the requirements of this 
+    // service. This could be moved into a helper method, but it is somehow more clear for seeing what
+    // is going on during initialization to leave it here.
+    //
+    // TODO: Are there any other properties that need to be double-checked before proceeding?
+    //
+    Ice::Int defaultPoolSize = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.ThreadPool.Server.Size", 0);
+    if (communicator->getProperties()->getPropertyAsIntWithDefault(adapterName + ".ThreadPool.Size", 0) < 4)
+    {
+        if (defaultPoolSize < 4)
+        {
+            logger(Info) << "Configured thread pool size for " << adapterName + " is too small, defaulting to 4";
+            communicator->getProperties()->setProperty(adapterName + ".ThreadPool.Size", "4");
+        }
+    }
+    if (communicator->getProperties()->getPropertyAsIntWithDefault(adapterName + "Internal.ThreadPool.Size", 0) < 4)
+    {
+        if (defaultPoolSize < 4)
+        {
+            logger(Info) << "Configured thread pool size for " << adapterName + "Internal is too small, defaulting to 4";
+            communicator->getProperties()->setProperty(adapterName + "Internal.ThreadPool.Size", "4");
+        }
+    }
+    defaultPoolSize = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.ThreadPool.Client.Size", 0);
+    if (defaultPoolSize < 4)
+    {
+        logger(Warning) << "Client thread pool size is too small. It should be set to 4 or greater";
+    }
+
+    
+    //
     // TODO: All adapter ids should be globally unique. This would allow replicas to be identified.
     // How this might be useful is that it might be used as a replicated state item to identify
     // which adapter is currently the primary in a group of replicas.
     //
-    mAdapter = communicator->createObjectAdapter(adapterName);
-    mInfrastructureAdapter = communicator->createObjectAdapter(adapterName + "Internal");
+    mAdapter = communicator->createObjectAdapterWithEndpoints(adapterName, 
+        communicator->getProperties()->getPropertyWithDefault(adapterName + ".Endpoints", "default"));
+
+    //
+    // We do not activate the main object adapter until most everything is initialized. The infrastructure
+    // adapter is for internally accessed objects or for supporting things that will be externally
+    // accessible until later so activating it now is fine.
+    //
+    mInfrastructureAdapter = communicator->createObjectAdapterWithEndpoints(adapterName + "Internal",
+        communicator->getProperties()->getPropertyWithDefault(adapterName + "Internal.Endpoints", "default"));
     mInfrastructureAdapter->activate();
 
     //
@@ -153,23 +192,31 @@ void BridgingApp::start(const std::string& name, const Ice::CommunicatorPtr& com
     ConfiguredIceLoggerPtr iceLogger = createIceLogger(mAdapter);
     getLoggerFactory().setLogOutput(iceLogger->getLogger());
 
-    std::string property = communicator->getProperties()->getProperty("ServiceLocatorManagementProxy");
-    if (property.size() == 0)
+    //
+    // While this property is checked early in this method, it is not used until later on.
+    // This is to avoid several initialization steps if the final steps of initialization
+    // cannot be performed.
+    //
+    std::string serviceLocatorManagementProperty = communicator->getProperties()->getProperty("ServiceLocatorManagementProxy");
+    if (serviceLocatorManagementProperty.empty())
+    {
+        throw IceBox::FailureException(__FILE__, __LINE__, 
+            "Configuration error: Unable to locate property `ServiceLocatorManagementProxy'");
+    }
+
+    string locatorPropertyString = communicator->getProperties()->getProperty("LocatorService.Proxy");
+    if (locatorPropertyString.empty())
     {
-        throw IceBox::FailureException(__FILE__, __LINE__, "Configuration error: Unable to locate property `ServiceLocatorManagementProxy'");
+        throw IceBox::FailureException(__FILE__, __LINE__,
+            "Configuration error: Unable to locate property `LocatorService.Proxy`");
     }
     
-    ServiceLocatorPrx locator = ServiceLocatorPrx::checkedCast(communicator->propertyToProxy("LocatorService.Proxy"));
-    /*
-     * TODO
-     
+    ServiceLocatorPrx locator = ServiceLocatorPrx::checkedCast(communicator->stringToProxy(locatorPropertyString));
+       
     BridgeStateReplicatorParamsPtr searchParams = new BridgeStateReplicatorParams;
     searchParams->category = StateReplicatorDiscoveryCategory;
     searchParams->name = communicator->getProperties()->getPropertyWithDefault("Bridge.StateReplicatorName", "default");
-    */
-    ServiceLocatorParamsPtr searchParams = new ServiceLocatorParams;
-    searchParams->category = StateReplicatorDiscoveryCategory;
-
+  
     ReplicatorSmartPrx replicator;
     try
     {
@@ -180,12 +227,8 @@ void BridgingApp::start(const std::string& name, const Ice::CommunicatorPtr& com
         logger(Error) << "Bridge state replicator lookup failed. Continuing without replication. " << ex.what();
     }
    
-    
-    //
-    // TODO: The bridge manager's identity should come from a central configuration and/or a replicator
-    // service.
-    //
-    std::string managerName = "BridgeManager";
+    std::string managerName = 
+        communicator->getProperties()->getPropertyWithDefault(name + ".ManagerId", "BridgeManager");
 
     //
     // It's very important that uncheckedCast's be used here as there are no guarantees
@@ -231,9 +274,11 @@ void BridgingApp::start(const std::string& name, const Ice::CommunicatorPtr& com
     bool registered = false;
     try
     {
+        ServiceLocatorParamsPtr parameters(new ServiceLocatorParams);
+        parameters->category = BridgeServiceDiscoveryCategory;
         mLocator = 
-            new LocatorRegistrationWrapper<BridgeManagerPrx>(communicator, property, bridgeManagerPrx, adapterName, 
-              BridgeServiceDiscoveryCategory);
+            new LocatorRegistrationWrapper<BridgeManagerPrx>(communicator, serviceLocatorManagementProperty, bridgeManagerPrx, 
+               adapterName, parameters);
         registered = mLocator->registerService();
     }
     catch (const Ice::Exception&)
diff --git a/src/ServiceUtil.h b/src/ServiceUtil.h
index 4b159e9..6ccab39 100644
--- a/src/ServiceUtil.h
+++ b/src/ServiceUtil.h
@@ -33,12 +33,12 @@ class LocatorRegistrationWrapper : public IceUtil::Shared
 {
 public:
     LocatorRegistrationWrapper(const Ice::CommunicatorPtr& communicator, const std::string& proxyString, const T& service,
-        const std::string& name, const std::string& category) :
+        const std::string& name, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr& params) :
         mCommunicator(communicator),
         mProxyString(proxyString),
         mService(service),
         mName(name),
-        mCategory(category)
+        mParameters(params)
     {
     }
 
@@ -53,10 +53,7 @@ public:
                 AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx::uncheckedCast(management->addService(mService, mName));
             if(mServiceManagement)
             {
-                AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr params = new 
-                    AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams();
-                params->category = mCategory;
-                mServiceManagement->addLocatorParams(params, "");
+                mServiceManagement->addLocatorParams(mParameters, "");
                 return true;
             }
         }
@@ -86,7 +83,7 @@ private:
     std::string mProxyString;
     T mService;
     std::string mName;
-    std::string mCategory;
+    AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr mParameters;
     AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx mServiceManagement;
 };
 //
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4b34369..2dfcc0e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -7,8 +7,6 @@ include_directories("../src")
 include_directories(${utils_dir}/SmartProxy/include)
 asterisk_scf_component_add_slice(bridge_component_test CommandsIf)
 asterisk_scf_component_add_file(bridge_component_test TestBridging.cpp)
-asterisk_scf_component_add_file(bridge_component_test SessionListenerI.h)
-asterisk_scf_component_add_file(bridge_component_test SessionListenerI.cpp)
 asterisk_scf_component_add_file(bridge_component_test BridgeListenerI.h)
 asterisk_scf_component_add_file(bridge_component_test BridgeListenerI.cpp)
 asterisk_scf_component_add_file(bridge_component_test BridgeManagerListenerI.h)
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index ff1013e..2cc8273 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -24,8 +24,8 @@
 
 #include "BridgeManagerListenerI.h"
 #include "BridgeListenerI.h"
-#include "SessionListenerI.h"
 #include "TestCommandDriver.h"
+#include "../src/ServiceUtil.h"
 
 #include <Ice/Ice.h>
 #include <IceBox/IceBox.h>
@@ -33,15 +33,22 @@
 //
 // TODO:
 // Add tests to exercise input validation.
-//
 
 using namespace AsteriskSCF::BridgingTest;
 using namespace AsteriskSCF::SessionCommunications::V1;
+using namespace AsteriskSCF::Core::Discovery::V1;
+using namespace AsteriskSCF::Core::Routing::V1;
 using namespace std;
 
 /* Cache the command line arguments so that Ice can be initialized within the global fixture. */
 namespace
 {
+
+void propGetSet(const Ice::PropertiesPtr& p, const string& propertyName, const string& value)
+{
+    p->setProperty(propertyName, p->getPropertyWithDefault(propertyName, value));
+}
+
 class TestEnvironment : public IceUtil::Shared
 {
 public:
@@ -51,43 +58,36 @@ public:
         mArgv(0)
     {
         //
-        // TODO: stl ensures that a std::vector's memory organization is compatible with
-        // casting to C pointers, so this should be converted to take advantage of that.
-        // (see the other test suites).
+        // This will work as long as we use the member mArgs as the basis for the vector
+        // of char*.
         //
-        const char* fakeName = "BRIDGE_TEST_SERVICE";
-        mArgc = args.size() + 1;
-        mArgv = new char*[mArgc];
-        size_t len = strlen(fakeName);
-        mArgv[0] = new char[len + 1];
-        strncpy(mArgv[0], fakeName, len);
-        for(size_t i = 1; i < mArgc; ++i)
+        mArgs.insert(mArgs.begin(), "BRIDGE_TEST_SERVICE");
+        for (Ice::StringSeq::const_iterator i = mArgs.begin(); i != mArgs.end(); ++i)
         {
-            mArgv[i] = new char[args[i].size() + 1];
-            strncpy(mArgv[i], args[i].c_str(), args[i].size());
+            mArgv.push_back(i->c_str());
         }
-    }
+        mArgv.push_back((const char*)0);
 
-    ~TestEnvironment()
-    {
-        if (mArgc > 0)
-        {
-            for(size_t i = 0; i < mArgc; ++i)
-            {
-                delete[] mArgv[i];
-            }
-            delete[] mArgv;
-        }
+        //
+        // Establish some required settings if they aren't set in configuration. The setProperty/getProperty
+        // usage is a little more expensive in that you are always setting whether it's set or not, but it 
+        // avoids having the "if" statement.
+        //
+        Ice::PropertiesPtr properties = mCommunicator->getProperties();
+        propGetSet(properties, "TestUtilAdapter.ThreadPool.Size", "4");
+        propGetSet(properties, "TestUtilAdapter.ThreadPool.Size", "4");
+        propGetSet(properties, "TestUtilAdapter.Endpoints", "default");
+        lookupProxies();
     }
 
     size_t argc()
     {
-        return mArgc;
+        return mArgs.size();
     }
 
     char** argv()
     {
-        return mArgv;
+        return (char**)&mArgv[0];
     }
 
     Ice::CommunicatorPtr communicator()
@@ -100,12 +100,68 @@ public:
         return mCommunicator->getProperties();
     }
 
+    BridgeManagerPrx primaryBridgeManager() 
+    {
+        return mPrimary;
+    }
+
+    BridgeManagerPrx standbyBridgeManager()
+    {
+        return mStandby;
+    }
+
 private:
+
+    void lookupProxies()
+    {
+        ServiceLocatorPrx locator(ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy")));
+        if (!locator)
+        {
+            throw IceBox::FailureException(__FILE__, __LINE__, 
+                "Configuration error: Unable to locate required property");
+        }
+        //
+        // Get all registered bridge manager proxies and use identity comparisons to get
+        // the correct one.
+        //
+        ServiceLocatorParamsPtr searchParams(new ServiceLocatorParams);
+        searchParams->category = BridgeServiceDiscoveryCategory;
+        Ice::ObjectProxySeq results = locator->locateAll(searchParams);
+        if (results.size() < 2)
+        {
+            throw IceBox::FailureException(__FILE__, __LINE__, 
+                "Configuration Error: Unable to find test bridge managers");
+        }
+
+        for (Ice::ObjectProxySeq::const_iterator i = results.begin(); i != results.end(); ++i)
+        {
+            string idString = mCommunicator->identityToString((*i)->ice_getIdentity());
+            if (idString == "TestBridgeManager")
+            {
+                mPrimary = BridgeManagerPrx::checkedCast((*i));
+                if (!mPrimary)
+                {
+                    throw IceBox::FailureException(__FILE__, __LINE__, 
+                        "Configuration Error: Lookup for primary bridge manager failed");
+                }
+            }
+            else if (idString == "TestBridgeManager2")
+            {
+                mStandby = BridgeManagerPrx::checkedCast((*i));
+                if (!mStandby)
+                {
+                    throw IceBox::FailureException(__FILE__, __LINE__, 
+                        "Configuration Error: Lookup for standby bridge manager failed");
+                }
+            }
+        }
+    }
+
+    BridgeManagerPrx mPrimary;
+    BridgeManagerPrx mStandby;
     Ice::CommunicatorPtr mCommunicator;
     Ice::StringSeq mArgs;
-
-    size_t mArgc;
-    char** mArgv;
+    vector<char const *> mArgv;
 };
 typedef IceUtil::Handle<TestEnvironment> TestEnvironmentPtr;
 
@@ -161,11 +217,23 @@ public:
         Ice::InitializationData initData;
         initData.properties = properties;
         mCommunicator = Ice::initialize(initData);
+
+        ServiceLocatorPrx locator(ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy")));
+        BOOST_REQUIRE(locator);
+
+        ServiceLocatorParamsPtr searchParams(new ServiceLocatorParams);
+        searchParams->category = "TestChannel";
+        Ice::ObjectPrx obj = locator->locate(searchParams);
+        BOOST_REQUIRE(obj);
+        mLocatorPrx = EndpointLocatorPrx::checkedCast(obj);
+        BOOST_REQUIRE(mLocatorPrx);
+        //
+        // Retrieve the command facet of the test channel's endpoint locator.
+        //
+        AsteriskSCF::TestChannel::V1::CommandsPrx prx(AsteriskSCF::TestChannel::V1::CommandsPrx::checkedCast(mLocatorPrx, "Commands"));
+        BOOST_REQUIRE(prx);
         mDriver = new TestCommandDriver;
-        AsteriskSCF::TestChannel::V1::CommandsPrx prx = AsteriskSCF::TestChannel::V1::CommandsPrx::checkedCast(mCommunicator->propertyToProxy("Commands.Proxy"));
         mDriver->setHandler(prx);
-        mLocatorPrx =
-            AsteriskSCF::Core::Routing::V1::EndpointLocatorPrx::checkedCast(mCommunicator->propertyToProxy("TestChannel.Proxy"));
     }
 
     ~TestChannelWrapper()
@@ -250,14 +318,12 @@ public:
             IceEnvironment testEnv(env()->properties());
             try
             {
-                Ice::ObjectAdapterPtr testAdapter = testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
+                Ice::ObjectAdapterPtr testAdapter = testEnv.communicator()->createObjectAdapter("TestUtilAdapter");                
                 testAdapter->activate();
                 BridgeManagerListenerIPtr servant = new BridgeManagerListenerI;
                 AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx listenerPrx;
                 addServant(listenerPrx, testAdapter, servant, testEnv.strToIdent("testBridgeManagerListener"));
-
-                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx =
-                    AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::checkedCast(testEnv.communicator()->propertyToProxy("TestBridge.Proxy"));
+                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx = env()->primaryBridgeManager();
                 BOOST_CHECK(mgrPrx);
 
                 mgrPrx->addListener(listenerPrx);
@@ -294,14 +360,13 @@ public:
             IceEnvironment testEnv(env()->properties());
             try
             {
-                Ice::ObjectAdapterPtr testAdapter = testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
+                Ice::ObjectAdapterPtr testAdapter =  testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
                 testAdapter->activate();
                 BridgeManagerListenerIPtr servant = new BridgeManagerListenerI;
                 AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx listenerPrx;
                 addServant(listenerPrx, testAdapter, servant, testEnv.strToIdent("testBridgeManagerListener"));
 
-                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx =
-                    AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::checkedCast(testEnv.communicator()->propertyToProxy("TestBridge.Proxy"));
+                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx = env()->primaryBridgeManager();
                 BOOST_CHECK(mgrPrx);
                 mgrPrx->addListener(listenerPrx);
                 BOOST_CHECK(servant->stoppingCalls() == 0);
@@ -391,14 +456,13 @@ public:
             IceEnvironment testEnv(env()->properties());
             try
             {
-                Ice::ObjectAdapterPtr testAdapter = testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
+                Ice::ObjectAdapterPtr testAdapter =  testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
                 testAdapter->activate();
                 BridgeManagerListenerIPtr servant = new BridgeManagerListenerI;
                 AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx listenerPrx;
                 addServant(listenerPrx, testAdapter, servant, testEnv.strToIdent("testBridgeManagerListener"));
 
-                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx =
-                    AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::checkedCast(testEnv.communicator()->propertyToProxy("TestBridge.Proxy"));
+                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx = env()->primaryBridgeManager();
                 BOOST_CHECK(mgrPrx);
                 mgrPrx->addListener(listenerPrx);
                 BOOST_CHECK(servant->stoppingCalls() == 0);
@@ -499,14 +563,13 @@ public:
             TestChannelWrapper channel(env()->properties());
             try
             {
-                Ice::ObjectAdapterPtr testAdapter = testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
+                Ice::ObjectAdapterPtr testAdapter =  testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
                 testAdapter->activate();
                 BridgeManagerListenerIPtr servant = new BridgeManagerListenerI;
                 AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx listenerPrx;
                 addServant(listenerPrx, testAdapter, servant, testEnv.strToIdent("testBridgeManagerListener"));
 
-                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx =
-                    AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::checkedCast(testEnv.communicator()->propertyToProxy("TestBridge.Proxy"));
+                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx = env()->primaryBridgeManager();
                 BOOST_CHECK(mgrPrx);
                 mgrPrx->addListener(listenerPrx);
                 BOOST_CHECK(servant->stoppingCalls() == 0);
@@ -560,10 +623,9 @@ public:
             TestChannelWrapper channel(env()->properties());
             try
             {
-                Ice::ObjectAdapterPtr testAdapter = testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
+                Ice::ObjectAdapterPtr testAdapter =  testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
                 testAdapter->activate();
-                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx =
-                    AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::checkedCast(testEnv.communicator()->propertyToProxy("TestBridge.Proxy"));
+                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx = env()->primaryBridgeManager();
                 BOOST_CHECK(mgrPrx);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
                 AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("111");
@@ -634,19 +696,15 @@ public:
             TestChannelWrapper channel(env()->properties());
             try
             {
-                Ice::ObjectAdapterPtr testAdapter = testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
+                Ice::ObjectAdapterPtr testAdapter =  testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
                 testAdapter->activate();
                 BridgeManagerListenerIPtr servant = new BridgeManagerListenerI;
                 AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx listenerPrx;
                 addServant(listenerPrx, testAdapter, servant, testEnv.strToIdent("testBridgeManagerListener"));
 
-                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx =
-                    AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::checkedCast(
-                        testEnv.communicator()->propertyToProxy("TestBridge.Proxy"));
+                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx = env()->primaryBridgeManager();
                 BOOST_CHECK(mgrPrx);
-                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx2 =
-                    AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::checkedCast(
-                        testEnv.communicator()->propertyToProxy("TestBridge2.Proxy"));
+                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx2 = env()->standbyBridgeManager();
                 BOOST_CHECK(mgrPrx2);
                 
                 mgrPrx->addListener(listenerPrx);
@@ -726,9 +784,9 @@ class TestRunner : public IceUtil::Thread
 public:
     void run()
     {
-        int argc = globalTestEnvironment->argc();
-        char** argv = globalTestEnvironment->argv();
-        int r = ::boost::unit_test::unit_test_main(&init_unit_test, argc, argv);
+        int r = ::boost::unit_test::unit_test_main(&init_unit_test, 
+            static_cast<int>(globalTestEnvironment->argc()), 
+            globalTestEnvironment->argv());
         exit(r);
 
         Ice::InitializationData initData;

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


-- 
asterisk-scf/integration/bridging.git



More information about the asterisk-scf-commits mailing list